diff --git a/.editorconfig b/.editorconfig index cc1dd3a..c4f8836 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,6 +14,6 @@ insert_final_newline = true indent_size = 4 [*.txt] -indent_size = 1 -trim_trailing_whitespace = false -insert_final_newline = false +indent_size = unset +trim_trailing_whitespace = unset +insert_final_newline = unset diff --git a/challenges/ascii-art/README.md b/challenges/ascii-art/README.md new file mode 100644 index 0000000..5d94727 --- /dev/null +++ b/challenges/ascii-art/README.md @@ -0,0 +1,56 @@ +# ascii-art + +Created by [@Divlo](https://github.com/Divlo) on 1 May 2022. + +## Instructions + +### Goal + +In stations and airports you often see this type of screen: + +![Led Display](./led_display.jpg) + +Have you ever asked yourself how it might be possible to simulate this display on a good old terminal? We have: with ASCII art! + +### Rules + +ASCII art allows you to represent forms by using characters. To be precise, in our case, these forms are words. For example, the word "MANHATTAN" could be displayed as follows in ASCII art: + +```txt +# # # ### # # # ### ### # ### +### # # # # # # # # # # # # # # +### ### # # ### ### # # ### # # +# # # # # # # # # # # # # # # # +# # # # # # # # # # # # # # # # +``` + +​Your mission is to write a program that can display a line of text in ASCII art in a style you are given as input. + +### Input + +- **Line 1:** The width `W` of a letter represented in ASCII art. All letters are the same width. +- **Line 2:** The height `H` of a letter represented in ASCII art. All letters are the same height. +- **Line 3:** The line of text `T`, composed of `N` ASCII characters. +- **Following lines:** the string of characters `ABCDEFGHIJKLMNOPQRSTUVWXYZ?` Represented in ASCII art. + +### Output + +The text `T` in ASCII art. + +The characters a to z are shown in ASCII art by their equivalent in upper case. + +The characters that are not in the intervals `[a-z]` or `[A-Z]` will be shown as a question mark in ASCII art. + +### Constraints + +- 0 < W < 30 +- 0 < H < 30 +- 0 < N < 200 + +## Source + +- [CodinGame](https://www.codingame.com/training/easy/ascii-art) + +## Examples + +See the `test` folder for examples of input/output. diff --git a/challenges/ascii-art/led_display.jpg b/challenges/ascii-art/led_display.jpg new file mode 100644 index 0000000..856b597 Binary files /dev/null and b/challenges/ascii-art/led_display.jpg differ diff --git a/challenges/ascii-art/solutions/.gitkeep b/challenges/ascii-art/solutions/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/challenges/ascii-art/test/1/input.txt b/challenges/ascii-art/test/1/input.txt new file mode 100644 index 0000000..1c35b44 --- /dev/null +++ b/challenges/ascii-art/test/1/input.txt @@ -0,0 +1,8 @@ +4 +5 +E + # ## ## ## ### ### ## # # ### ## # # # # # ### # ## # ## ## ### # # # # # # # # # # ### ### +# # # # # # # # # # # # # # # # # ### # # # # # # # # # # # # # # # # # # # # # # # # +### ## # # # ## ## # # ### # # ## # ### # # # # ## # # ## # # # # # # ### # # # ## +# # # # # # # # # # # # # # # # # # # # # # # # # # ## # # # # # # # # ### # # # # +# # ## ## ## ### # ## # # ### # # # ### # # # # # # # # # ## # ### # # # # # # ### # \ No newline at end of file diff --git a/challenges/ascii-art/test/1/output.txt b/challenges/ascii-art/test/1/output.txt new file mode 100644 index 0000000..d04d1f4 --- /dev/null +++ b/challenges/ascii-art/test/1/output.txt @@ -0,0 +1,5 @@ +### +# +## +# +### diff --git a/challenges/ascii-art/test/2/input.txt b/challenges/ascii-art/test/2/input.txt new file mode 100644 index 0000000..7a57d34 --- /dev/null +++ b/challenges/ascii-art/test/2/input.txt @@ -0,0 +1,8 @@ +4 +5 +MANHATTAN + # ## ## ## ### ### ## # # ### ## # # # # # ### # ## # ## ## ### # # # # # # # # # # ### ### +# # # # # # # # # # # # # # # # # ### # # # # # # # # # # # # # # # # # # # # # # # # +### ## # # # ## ## # # ### # # ## # ### # # # # ## # # ## # # # # # # ### # # # ## +# # # # # # # # # # # # # # # # # # # # # # # # # # ## # # # # # # # # ### # # # # +# # ## ## ## ### # ## # # ### # # # ### # # # # # # # # # ## # ### # # # # # # ### # \ No newline at end of file diff --git a/challenges/ascii-art/test/2/output.txt b/challenges/ascii-art/test/2/output.txt new file mode 100644 index 0000000..dce26a2 --- /dev/null +++ b/challenges/ascii-art/test/2/output.txt @@ -0,0 +1,5 @@ +# # # ### # # # ### ### # ### +### # # # # # # # # # # # # # # +### ### # # ### ### # # ### # # +# # # # # # # # # # # # # # # # +# # # # # # # # # # # # # # # # diff --git a/challenges/ascii-art/test/3/input.txt b/challenges/ascii-art/test/3/input.txt new file mode 100644 index 0000000..19187e3 --- /dev/null +++ b/challenges/ascii-art/test/3/input.txt @@ -0,0 +1,8 @@ +4 +5 +ManhAtTan + # ## ## ## ### ### ## # # ### ## # # # # # ### # ## # ## ## ### # # # # # # # # # # ### ### +# # # # # # # # # # # # # # # # # ### # # # # # # # # # # # # # # # # # # # # # # # # +### ## # # # ## ## # # ### # # ## # ### # # # # ## # # ## # # # # # # ### # # # ## +# # # # # # # # # # # # # # # # # # # # # # # # # # ## # # # # # # # # ### # # # # +# # ## ## ## ### # ## # # ### # # # ### # # # # # # # # # ## # ### # # # # # # ### # \ No newline at end of file diff --git a/challenges/ascii-art/test/3/output.txt b/challenges/ascii-art/test/3/output.txt new file mode 100644 index 0000000..dce26a2 --- /dev/null +++ b/challenges/ascii-art/test/3/output.txt @@ -0,0 +1,5 @@ +# # # ### # # # ### ### # ### +### # # # # # # # # # # # # # # +### ### # # ### ### # # ### # # +# # # # # # # # # # # # # # # # +# # # # # # # # # # # # # # # # diff --git a/challenges/ascii-art/test/4/input.txt b/challenges/ascii-art/test/4/input.txt new file mode 100644 index 0000000..e627594 --- /dev/null +++ b/challenges/ascii-art/test/4/input.txt @@ -0,0 +1,8 @@ +4 +5 +M@NH@TT@N + # ## ## ## ### ### ## # # ### ## # # # # # ### # ## # ## ## ### # # # # # # # # # # ### ### +# # # # # # # # # # # # # # # # # ### # # # # # # # # # # # # # # # # # # # # # # # # +### ## # # # ## ## # # ### # # ## # ### # # # # ## # # ## # # # # # # ### # # # ## +# # # # # # # # # # # # # # # # # # # # # # # # # # ## # # # # # # # # ### # # # # +# # ## ## ## ### # ## # # ### # # # ### # # # # # # # # # ## # ### # # # # # # ### # \ No newline at end of file diff --git a/challenges/ascii-art/test/4/output.txt b/challenges/ascii-art/test/4/output.txt new file mode 100644 index 0000000..6c36b12 --- /dev/null +++ b/challenges/ascii-art/test/4/output.txt @@ -0,0 +1,5 @@ +# # ### ### # # ### ### ### ### ### +### # # # # # # # # # # # +### ## # # ### ## # # ## # # +# # # # # # # # # # +# # # # # # # # # # # # # diff --git a/challenges/ascii-art/test/5/input.txt b/challenges/ascii-art/test/5/input.txt new file mode 100644 index 0000000..071cd47 --- /dev/null +++ b/challenges/ascii-art/test/5/input.txt @@ -0,0 +1,14 @@ +21 +11 +MANHATTAN + .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .-----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. +| .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | +| | __ | | | | ______ | | | | ______ | | | | ________ | | | | _________ | | | | _________ | | | | ______ | | | | ____ ____ | | | | _____ | | | | _____ | | | | ___ ____ | | | | _____ | | | | ____ ____ | | | | ____ _____ | | | | ____ | | | | ______ | | | | ___ | | | | _______ | | | | _______ | | | | _________ | | | | _____ _____ | | | | ____ ____ | | | | _____ _____ | | | | ____ ____ | | | | ____ ____ | | | | ________ | | | | ______ | | +| | / \ | | | | |_ _ \ | | | | .' ___ | | | | | |_ ___ `. | | | | |_ ___ | | | | | |_ ___ | | | | | .' ___ | | | | | |_ || _| | | | | |_ _| | | | | |_ _| | | | | |_ ||_ _| | | | | |_ _| | | | ||_ \ / _|| | | ||_ \|_ _| | | | | .' `. | | | | |_ __ \ | | | | .' '. | | | | |_ __ \ | | | | / ___ | | | | | | _ _ | | | | ||_ _||_ _|| | | ||_ _| |_ _| | | | ||_ _||_ _|| | | | |_ _||_ _| | | | | |_ _||_ _| | | | | | __ _| | | | | / _ __ `. | | +| | / /\ \ | | | | | |_) | | | | | / .' \_| | | | | | | `. \ | | | | | |_ \_| | | | | | |_ \_| | | | | / .' \_| | | | | | |__| | | | | | | | | | | | | | | | | | | |_/ / | | | | | | | | | | | \/ | | | | | | \ | | | | | | / .--. \ | | | | | |__) | | | | | / .-. \ | | | | | |__) | | | | | | (__ \_| | | | | |_/ | | \_| | | | | | | | | | | | | \ \ / / | | | | | | /\ | | | | | | \ \ / / | | | | \ \ / / | | | | |_/ / / | | | | |_/____) | | | +| | / ____ \ | | | | | __'. | | | | | | | | | | | | | | | | | | | _| _ | | | | | _| | | | | | | ____ | | | | | __ | | | | | | | | | | | _ | | | | | | | __'. | | | | | | _ | | | | | |\ /| | | | | | | |\ \| | | | | | | | | | | | | | | ___/ | | | | | | | | | | | | | __ / | | | | '.___`-. | | | | | | | | | | | ' ' | | | | | \ \ / / | | | | | |/ \| | | | | | > `' < | | | | \ \/ / | | | | .'.' _ | | | | / ___.' | | +| | _/ / \ \_ | | | | _| |__) | | | | | \ `.___.'\ | | | | _| |___.' / | | | | _| |___/ | | | | | _| |_ | | | | \ `.___] _| | | | | _| | | |_ | | | | _| |_ | | | | | |_' | | | | | _| | \ \_ | | | | _| |__/ | | | | | _| |_\/_| |_ | | | | _| |_\ |_ | | | | \ `--' / | | | | _| |_ | | | | \ `-' \_ | | | | _| | \ \_ | | | | |`\____) | | | | | _| |_ | | | | \ `--' / | | | | \ ' / | | | | | /\ | | | | | _/ /'`\ \_ | | | | _| |_ | | | | _/ /__/ | | | | | |_| | | +| ||____| |____|| | | | |_______/ | | | | `._____.' | | | | |________.' | | | | |_________| | | | | |_____| | | | | `._____.' | | | | |____||____| | | | | |_____| | | | | `.___.' | | | | |____||____| | | | | |________| | | | ||_____||_____|| | | ||_____|\____| | | | | `.____.' | | | | |_____| | | | | `.___.\__| | | | | |____| |___| | | | | |_______.' | | | | |_____| | | | | `.__.' | | | | \_/ | | | | |__/ \__| | | | | |____||____| | | | | |______| | | | | |________| | | | | (_) | | +| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +| '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | + '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' \ No newline at end of file diff --git a/challenges/ascii-art/test/5/output.txt b/challenges/ascii-art/test/5/output.txt new file mode 100644 index 0000000..e726886 --- /dev/null +++ b/challenges/ascii-art/test/5/output.txt @@ -0,0 +1,11 @@ + .----------------. .----------------. .-----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .-----------------. +| .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | | .--------------. | +| | ____ ____ | | | | __ | | | | ____ _____ | | | | ____ ____ | | | | __ | | | | _________ | | | | _________ | | | | __ | | | | ____ _____ | | +| ||_ \ / _|| | | | / \ | | | ||_ \|_ _| | | | | |_ || _| | | | | / \ | | | | | _ _ | | | | | | _ _ | | | | | / \ | | | ||_ \|_ _| | | +| | | \/ | | | | | / /\ \ | | | | | \ | | | | | | | |__| | | | | | / /\ \ | | | | |_/ | | \_| | | | | |_/ | | \_| | | | | / /\ \ | | | | | \ | | | | +| | | |\ /| | | | | | / ____ \ | | | | | |\ \| | | | | | | __ | | | | | / ____ \ | | | | | | | | | | | | | | | | / ____ \ | | | | | |\ \| | | | +| | _| |_\/_| |_ | | | | _/ / \ \_ | | | | _| |_\ |_ | | | | _| | | |_ | | | | _/ / \ \_ | | | | _| |_ | | | | _| |_ | | | | _/ / \ \_ | | | | _| |_\ |_ | | +| ||_____||_____|| | | ||____| |____|| | | ||_____|\____| | | | | |____||____| | | | ||____| |____|| | | | |_____| | | | | |_____| | | | ||____| |____|| | | ||_____|\____| | | +| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +| '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | | '--------------' | + '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' diff --git a/challenges/ascii-art/test/6/input.txt b/challenges/ascii-art/test/6/input.txt new file mode 100644 index 0000000..edad916 --- /dev/null +++ b/challenges/ascii-art/test/6/input.txt @@ -0,0 +1,8 @@ +4 +5 +MAN HAT TAN + # ## ## ## ### ### ## # # ### ## # # # # # ### # ## # ## ## ### # # # # # # # # # # ### ### +# # # # # # # # # # # # # # # # # ### # # # # # # # # # # # # # # # # # # # # # # # # +### ## # # # ## ## # # ### # # ## # ### # # # # ## # # ## # # # # # # ### # # # ## +# # # # # # # # # # # # # # # # # # # # # # # # # # ## # # # # # # # # ### # # # # +# # ## ## ## ### # ## # # ### # # # ### # # # # # # # # # ## # ### # # # # # # ### # \ No newline at end of file diff --git a/challenges/ascii-art/test/6/output.txt b/challenges/ascii-art/test/6/output.txt new file mode 100644 index 0000000..b73e578 --- /dev/null +++ b/challenges/ascii-art/test/6/output.txt @@ -0,0 +1,5 @@ +# # # ### ### # # # ### ### ### # ### +### # # # # # # # # # # # # # # # # +### ### # # ## ### ### # ## # ### # # +# # # # # # # # # # # # # # # # +# # # # # # # # # # # # # # # # # # diff --git a/challenges/defibrillators/README.md b/challenges/defibrillators/README.md index 42eef2a..0ab28f3 100644 --- a/challenges/defibrillators/README.md +++ b/challenges/defibrillators/README.md @@ -52,7 +52,7 @@ The name of the defibrillator located the closest to the user’s position. ## Source -- [CodinGame](https://www.codingame.com/ide/puzzle/defibrillators) +- [CodinGame](https://www.codingame.com/training/easy/defibrillators) ## Examples