Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @flopy78,validated by @David_Augusto_Villa.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @flopy78,validated by @David_Augusto_Villa.
If you have any issues, feel free to ping them.
What is a āzoneā seems to be undefined.
It seems to me that the yellow area is a zone and the two green areas are two other zones.
But disappointingly using this common sense zoning will arrive at an answer different from the ācorrectā one.
I believe the rules could be more precise, especially regarding how ASCII characters should translate into exact shapes or zones on paper. Here are some example questions to illustrate the ambiguities Iām facing:
What is the difference between -
and _
?
Can I assume that each ASCII character corresponds to one cell on the paper sheet?
Can I use repeating characters like ||||
, and if so, should I interpret there to be a boundary or āzoneā between each pair of lines?
Is it possible to have a zone that doesnāt contain any spaces?
For example, given the following image:
Do lines 3-4
create a continuous boundary, similar to 5-6
?
I find it clear that 11-12
forms a continuous boundary, but the distinction is less clear for pairs like 8-9
. Additionally, text patterns like \__/
seem to imply a continuous border, as does \--/
, but when drawn on paper, they might not look the same.
For a structure like 14-15
, how should I interpret the number of zones within it?
In general, there are several unanswered questions, so I would appreciate if the rules could be made more precise overall.
A detailed example would be incredibly helpfulāperhaps a complex ASCII drawing alongside a corresponding paper sheet illustration with clearly labeled zones (colored and numbered). Additional test cases, especially with minimal examples focusing on individual rules, would also be useful.
If you look closely, the spaces you filled in yellow above the wheels are empty ! the ā-ā are adjacent, so you canāt go through it : the āyellowā zone is so not 1 but 3 areasā¦
I hope this will help you !
The areas are made of spaces, so there is no zones in ||||
.
The 3-4 and 5-6 separately form continuous lines.
The difference between - and _ is just estethic, there should be no difference in the way they are processed.
You will never find a structure like teh 14-15 one. Though, there is no zone because thereās no spacing between the +.
Iāve added some precisions in the statement : I hope it will be clearer now
Thank you!
Youāre welcome !
I hope I was clear enoughā¦
Finally I passed all tests, although I passed them after change in code, that I think is incorrect. In my view the problem is in adjacency of zones.
Here is image divided into zones (lower zones have id+10).
If I assume that zone 12 is adjacent to zone 11 and 14, then answer should be 4.
And for me this is the correct answer according to example of two adjacent zones (rectangulars) in problem description.
+---+
| +---+
+---| |
+---+
--- +-------------------------------------------------+
--- |0000000000000000000000000000000000000000000000000|
--- |000000000----------------------000000000000000000|
--- |00000000/11111111|2222222|33333\00000000000000000|
--- |0-------\11111111|2222222|333333\0000000000000000|
--- |/44444444----------------+--------------------+00|
--- ||4444444444-----555555555+555555-----666666666|00|
--- |\444444444/7___8\55555555555555/9___0\66666666/00|
--- |1----------/222\----------------/333\--------/000|
--- |11111111111\___/4444444444444444\___/000000000000|
--- +-------------------------------------------------+
--- graph of adjacent zones
--- 01234 56789 01234
--- 0 01111 01000 10010
--- 1 10101 10000 00000
--- 2 11010 10000 00000
--- 3 10100 10000 00000
--- 4 11000 00100 01000
--- 5 01110 00011 00001
--- 6 10000 00000 10000
--- 7 00001 00000 01100
--- 8 00000 10000 00101
--- 9 00000 10000 00011
--- 10 10000 01000 00010
--- 11 00001 00100 00100
--- 12 00000 00110 01001
--- 13 10000 00001 10001
--- 14 00000 10011 00110
Either I am wrong (then I would like to explain what is wrong in my understanding) or I passed all tests due to their incompleteness. I would like to see how to color the car image with 3 colors.
How to colour the image with 3 colours:
+-------------------------------------------------+
|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|
|AAAAAAAAA----------------------AAAAAAAAAAAAAAAAAA|
|AAAAAAAA/BBBBBBBB|CCCCCCC|BBBBB\AAAAAAAAAAAAAAAAA|
|A-------\BBBBBBBB|CCCCCCC|BBBBBB\AAAAAAAAAAAAAAAA|
|/CCCCCCCC----------------+--------------------+AA|
||CCCCCCCCCC-----AAAAAAAAA+AAAAAA-----BBBBBBBBB|AA|
|\CCCCCCCCC/A___B\AAAAAAAAAAAAAA/B___A\BBBBBBBB/AA|
|A----------/CCC\----------------/CCC\--------/AAA|
|AAAAAAAAAAA\___/BBBBBBBBBBBBBBBB\___/AAAAAAAAAAAA|
+-------------------------------------------------+
And the graph of adjacent zones:
--- 01234 56789 01234
--- 0 01111 01000 00000 <-
--- 1 10101 10000 00000
--- 2 11010 10000 00000
--- 3 10100 10000 00000
--- 4 11000 00100 01000
--- 5 01110 00011 00001
--- 6 10000 00000 10000
--- 7 00001 00000 00100 <-
--- 8 00000 10000 00100 <-
--- 9 00000 10000 00010 <-
--- 10 10000 01000 00010
--- 11 00001 00000 00000 <-
--- 12 00000 00110 00000 <-
--- 13 10000 00001 10000 <-
--- 14 00000 10000 00000 <-