From f52a00d4b063c91164d4048e3710bdd8344d529c Mon Sep 17 00:00:00 2001 From: MSilva95 Date: Wed, 27 Oct 2021 17:11:41 +0100 Subject: [PATCH 1/8] changing the flag example --- subjects/ascii-art/reverse/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subjects/ascii-art/reverse/README.md b/subjects/ascii-art/reverse/README.md index e040e1dc..2663c883 100644 --- a/subjects/ascii-art/reverse/README.md +++ b/subjects/ascii-art/reverse/README.md @@ -13,7 +13,7 @@ The argument will be a **flag**, `--reverse=`, in which `--reverse` is ```console Usage: go run . [OPTION] -EX: go run . something standard --reverse= +EX: go run . --reverse= ``` ### Instructions From c9b52e9cc8c7120e52529f0e3a4d49614c07cd0e Mon Sep 17 00:00:00 2001 From: OGordoo Date: Wed, 27 Oct 2021 17:23:29 +0100 Subject: [PATCH 2/8] fs readme outputs fix --- subjects/ascii-art/fs/audit.md | 48 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/subjects/ascii-art/fs/audit.md b/subjects/ascii-art/fs/audit.md index 876717ca..56eeab60 100644 --- a/subjects/ascii-art/fs/audit.md +++ b/subjects/ascii-art/fs/audit.md @@ -105,14 +105,14 @@ o \ / $ ##### Try passing as arguments `"ABCDEFGHIJKLMNOPQRSTUVWXYZ" shadow | cat -e` ``` - $ - _|_| _|_|_| _|_|_| _|_|_| _|_|_|_| _|_|_|_| _|_|_| _| _| _|_|_| _| _| _| _| _| _| _| _| _|_| _|_|_| _|_| _|_|_| _|_|_| _|_|_|_|_| _| _| _| _| _| _| _| _| _| _| _|_|_|_|_| $ -_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_| _|_| _|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| $ -_|_|_|_| _|_|_| _| _| _| _|_|_| _|_|_| _| _|_| _|_|_|_| _| _| _|_| _| _| _| _| _| _| _| _| _| _|_|_| _| _|_| _|_|_| _|_| _| _| _| _| _| _| _| _| _| _| _| $ -_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| $ -_| _| _|_|_| _|_|_| _|_|_| _|_|_|_| _| _|_|_| _| _| _|_|_| _|_| _| _| _|_|_|_| _| _| _| _| _|_| _| _|_| _| _| _| _|_|_| _| _|_| _| _| _| _| _| _| _|_|_|_|_| $ - $ - $ + $ + _|_| _|_|_| _|_|_| _|_|_| _|_|_|_| _|_|_|_| _|_|_| _| _| _|_|_| _| _| _| _| _| _| _| _| _|_| _|_|_| _|_| _|_|_| _|_|_| _|_|_|_|_| _| _| _| _| _| _| _| _| _| _| _|_|_|_|_| $ +_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_| _|_| _|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| $ +_|_|_|_| _|_|_| _| _| _| _|_|_| _|_|_| _| _|_| _|_|_|_| _| _| _|_| _| _| _| _| _| _| _| _| _| _|_|_| _| _|_| _|_|_| _|_| _| _| _| _| _| _| _| _| _| _| _| $ +_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| $ +_| _| _|_|_| _|_|_| _|_|_| _|_|_|_| _| _|_|_| _| _| _|_|_| _|_| _| _| _|_|_|_| _| _| _| _| _|_| _| _|_| _| _| _| _|_|_| _| _|_| _| _| _| _| _| _| _|_|_|_|_| $ + $ + $ ``` ###### Does it display the string in the right template as an ASCII art representation as shown above? @@ -120,14 +120,14 @@ _| _| _|_|_| _|_|_| _|_|_| _|_|_|_| _| _|_|_| _| _| _|_|_| ##### Try passing as arguments `"\"#$%&/()*+,-./" thinkertoy | cat -e` ``` - | | $ - | | | | -O-O- O o / \ o | o o $ - -O-O- o | | o / o / o o \|/ | / $ - | | -O-O- / /| o | | --O-- -o- o $ - -O-O- | | o / o o-O- / o o /|\ | o-o / $ - | | -O-O- O | o \ / o | o o O o $ - | | | $ - $ +o o | | $ +| | | | -O-O- O o / \ o | o o $ + -O-O- o | | o / o / o o \|/ | / $ + | | -O-O- / /| o | | --O-- -o- o $ + -O-O- | | o / o o-O- / o o /|\ | o-o / $ + | | -O-O- O | o \ / o | o o O o $ + | | | $ + $ ``` ###### Does it display the string in the right template as an ASCII art representation as shown above? @@ -135,14 +135,14 @@ _| _| _|_|_| _|_|_| _|_|_| _|_|_|_| _| _|_|_| _| _| _|_|_| ##### Try passing as arguments `"It's Working" thinkertoy | cat -e` ``` - o $ - o-O-o o | o o o $ - | | | | | / o $ - | -o- o-o o o o o-o o-o OO o-o o--o $ - | | \ \ / \ / | | | | \ | | | | | $ - o-O-o o o-o o o o-o o o o | o o o--O $ - | $ - o--o $ + o $ +o-O-o o | o o o $ + | | | | | / o $ + | -o- o-o o o o o-o o-o OO o-o o--o $ + | | \ \ / \ / | | | | \ | | | | | $ +o-O-o o o-o o o o-o o o o | o o o--O $ + | $ + o--o $ ``` ###### Does it display the string in the right template as an ASCII art representation as shown above? From 4971a94ee9a2f4f6834e301970f5abf5fb3195f2 Mon Sep 17 00:00:00 2001 From: MSilva95 Date: Thu, 28 Oct 2021 12:33:47 +0100 Subject: [PATCH 3/8] fix reverse examples --- subjects/ascii-art/reverse/audit.md | 2 +- subjects/ascii-art/reverse/example.md | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/subjects/ascii-art/reverse/audit.md b/subjects/ascii-art/reverse/audit.md index d1388d17..c0ac9c9c 100644 --- a/subjects/ascii-art/reverse/audit.md +++ b/subjects/ascii-art/reverse/audit.md @@ -32,7 +32,7 @@ EX: go run . --reverse= ##### Try passing to the reverse flag `"--reverse=example03.txt"` the [example 03](example.md). -`(somthing&234)` +`something&234` ###### Does it display the value above? diff --git a/subjects/ascii-art/reverse/example.md b/subjects/ascii-art/reverse/example.md index 2543e0a0..7620f1d2 100644 --- a/subjects/ascii-art/reverse/example.md +++ b/subjects/ascii-art/reverse/example.md @@ -76,14 +76,14 @@ $ ### example05 ```console -__ _ _ _ _ _ _ _ __ _ __ __ _ __ $ -\ \ | | ( | ) _| || |_ | | (_) / / ___ ( ) / / \ \ /\| |/\ _ / / $ - \ \ | | V V |_ __ _| / __) / / ( _ ) |/ | | | | \ ` ' / _| |_ ______ / / $ - \ \ | | _| || |_ \__ \ / / / _ \/\ | | | | |_ _| |_ _| |______| / / $ - \ \ |_| |_ __ _| ( / / / _ | (_> < | | | | / , . \ |_| _ _ / / $ - \_\ (_) |_||_| |_| /_/ (_) \___/\/ | | | | \/|_|\/ ( ) (_) /_/ $ - \_\ /_/ |/ $ - $ +__ _ _ _ _ _ _ _ __ _ __ __ _ __ $ +\ \ | | ( | ) _| || |_ | | (_) / / ___ ( ) / / \ \ /\| |/\ _ / / $ + \ \ | | V V |_ __ _| / __) / / ( _ ) |/ | | | | \ ` ' / _| |_ ______ / / $ + \ \ | | _| || |_ \__ \ / / / _ \/\ | | | | |_ _| |_ _| |______| / / $ + \ \ |_| |_ __ _| ( / / / _ | (_> < | | | | / , . \ |_| _ _ / / $ + \_\ (_) |_||_| |_| /_/ (_) \___/\/ | | | | \/|_|\/ ( ) (_) /_/ $ + \_\ /_/ |/ $ + $ $ ``` From 4a76bbcec59c7a9ff5c4b414a531ab9e36382cbe Mon Sep 17 00:00:00 2001 From: Christopher Fremond <34804391+Frenchris@users.noreply.github.com> Date: Tue, 2 Nov 2021 13:08:37 +0000 Subject: [PATCH 4/8] Update README.md --- subjects/give-back/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subjects/give-back/README.md b/subjects/give-back/README.md index 871d072c..eff5a757 100644 --- a/subjects/give-back/README.md +++ b/subjects/give-back/README.md @@ -2,7 +2,7 @@ ### Instruction -Declare an `giveBack` function an argument and return a new function that when +Declare a `giveBack` function which takes an argument and returns a new function that when called will return the argument of the `giveBack` function ### Usage From 1e4904a00df55948faf1cbc0d5a46fe4ab595504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Wed, 3 Nov 2021 13:29:24 +0100 Subject: [PATCH 5/8] Update README.md --- subjects/diamon/README.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/subjects/diamon/README.md b/subjects/diamon/README.md index c6e91668..92bb660f 100644 --- a/subjects/diamon/README.md +++ b/subjects/diamon/README.md @@ -1,3 +1,33 @@ ## 🌟 Diamon -diamon (pyramid + reversed pyramid) +### Instructions + +Create a `diamon` function that takes a string and a number as parameters +and return a diamon shape constructed by 2 arguments: + - the characters (as a string) to be repeated + - the size of a side (as a number) + +Just like pyramid + a reversed pyramid + +### Output example + +- `*` character and side of 5 : + +``` + * + *** + ***** + ******* +********* + ******* + ***** + *** + * +``` + +> No new line in last line + +### Notions + +- [nan-academy.github.io/js-training/examples/loops](https://nan-academy.github.io/js-training/examples/loops.js) +- [nan-academy.github.io/js-training/examples/recursion](https://nan-academy.github.io/js-training/examples/recursion.js) From 3c37510aa9d4eebadfc01a244f3fb7ac3724ba9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Wed, 3 Nov 2021 13:31:00 +0100 Subject: [PATCH 6/8] Create diamon_test.js --- js/tests/diamon_test.js | 193 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 js/tests/diamon_test.js diff --git a/js/tests/diamon_test.js b/js/tests/diamon_test.js new file mode 100644 index 00000000..696094db --- /dev/null +++ b/js/tests/diamon_test.js @@ -0,0 +1,193 @@ +export const tests = [] +const t = f => tests.push(f) +t(({ code }) => code.split('\n').filter(s => s.trim()).length < 78) +t(({ code }) => !code.includes('$')) + +t(({ eq }) => eq(diamon('x', 1)), $a.trim()) +t(({ eq }) => eq(diamon('x', 2)), $b.trim()) +t(({ eq }) => eq(diamon('x', 3)), $c.trim()) +t(({ eq }) => eq(diamon('<>', 4)), $d.trim()) +t(({ eq }) => eq(diamon('#', 40)), $e.trim()) +t(({ eq }) => eq(diamon('{}', 12)), $f.trim()) +t(({ eq }) => eq(diamon('ABC', 7)), $g.trim()) +t(({ eq }) => eq(diamon('<^>', 13)), $h.trim()) + +Object.freeze(tests) + +const $a = `x` +const $b = ` + x +xxx + x +` + +const $c = ` + x + xxx +xxxxx + xxx + x +` + +const $d = ` + <> + <><><> + <><><><><> +<><><><><><><> + <><><><><> + <><><> + <> +` + +const $e = ` + + # + ### + ##### + ####### + ######### + ########### + ############# + ############### + ################# + ################### + ##################### + ####################### + ######################### + ########################### + ############################# + ############################### + ################################# + ################################### + ##################################### + ####################################### + ######################################### + ########################################### + ############################################# + ############################################### + ################################################# + ################################################### + ##################################################### + ####################################################### + ######################################################### + ########################################################### + ############################################################# + ############################################################### + ################################################################# + ################################################################### + ##################################################################### + ####################################################################### + ######################################################################### + ########################################################################### + ############################################################################# +############################################################################### + ############################################################################# + ########################################################################### + ######################################################################### + ####################################################################### + ##################################################################### + ################################################################### + ################################################################# + ############################################################### + ############################################################# + ########################################################### + ######################################################### + ####################################################### + ##################################################### + ################################################### + ################################################# + ############################################### + ############################################# + ########################################### + ######################################### + ####################################### + ##################################### + ################################### + ################################# + ############################### + ############################# + ########################### + ######################### + ####################### + ##################### + ################### + ################# + ############### + ############# + ########### + ######### + ####### + ##### + ### + # +` + +const $f = ` + {} + {}{}{} + {}{}{}{}{} + {}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} +{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{}{}{} + {}{}{}{}{}{}{} + {}{}{}{}{} + {}{}{} + {} +` + +const $g = ` + ABC + ABCABCABC + ABCABCABCABCABC + ABCABCABCABCABCABCABC + ABCABCABCABCABCABCABCABCABC + ABCABCABCABCABCABCABCABCABCABCABC +ABCABCABCABCABCABCABCABCABCABCABCABCABC + ABCABCABCABCABCABCABCABCABCABCABC + ABCABCABCABCABCABCABCABCABC + ABCABCABCABCABCABCABC + ABCABCABCABCABC + ABCABCABC + ABC +` + +const $h = ` + <^> + <^><^><^> + <^><^><^><^><^> + <^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> +<^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^><^><^> + <^><^><^><^><^><^><^> + <^><^><^><^><^> + <^><^><^> + <^> +` From 2ee663e9404bd568b1831b8507bd2eb8c7d6db41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Wed, 3 Nov 2021 13:46:02 +0100 Subject: [PATCH 7/8] Clarify using-reduce sumOrMul descriptions --- subjects/using-reduce/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/subjects/using-reduce/README.md b/subjects/using-reduce/README.md index 6a784192..a3a640a4 100644 --- a/subjects/using-reduce/README.md +++ b/subjects/using-reduce/README.md @@ -7,7 +7,9 @@ Create three functions : - `adder` that receives an array and adds its elements. - `sumOrMul` that receives an array and adds or multiplies its elements - depending on whether the element is an odd or an even number. + depending on whether the element is an odd or an even number, where: + - even = multiply + - odd = add - `funcExec` that receives an array of functions and executes them. @@ -17,9 +19,9 @@ initial value for the functions execution. Example: ```js -sumOrMul([1, 2, 3, 4], 5) - // -> (((5 + 1) * 2) + 3) * 4 - // -> 60 +sumOrMul([1, 2, 3, 5, 8], 5) + // -> ((((5 + 1) * 2) + 3) + 5) * 8 + // -> 160 ```` #### Special instruction From 18c91ffd676f9a019703e4fad1ef3a65fddb562f Mon Sep 17 00:00:00 2001 From: Christopher Fremond <34804391+Frenchris@users.noreply.github.com> Date: Wed, 3 Nov 2021 12:48:26 +0000 Subject: [PATCH 8/8] Update README.md --- subjects/diamon/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subjects/diamon/README.md b/subjects/diamon/README.md index 92bb660f..8ea4e028 100644 --- a/subjects/diamon/README.md +++ b/subjects/diamon/README.md @@ -3,11 +3,11 @@ ### Instructions Create a `diamon` function that takes a string and a number as parameters -and return a diamon shape constructed by 2 arguments: +and returns a diamond shape constructed by 2 arguments: - the characters (as a string) to be repeated - the size of a side (as a number) -Just like pyramid + a reversed pyramid +It is just like pyramid + a reversed pyramid ### Output example