[Community Puzzle] No More Pythons, Please!

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @VictoriousTriceraton,validated by @Draftnote and @Westicles.
If you have any issues, feel free to ping them.

1 Like

Sure of the “Real Madness” Validator ? I have no “hard-code” and pass all other tests and other validators…
Fun Puzzle :slight_smile:

The second character from the head cannot be ‘o’. In other words snake is always of length 3 or more. Without this condition Validator 5th fails, even if 5th Test passes.

Also check that your code moves from o to | only if it’s over/under and from o to - only if it’s on its right/left.

Right. And how can a snake have another head right after its head? The snake has only 1 head :slight_smile:
And based on the rules at the end of the problems of the statement - the minimum possible size can be 3.

1 Like

Sure, I start with “o” and my code check only “-” or “|” next.

And I check independantly vertical and horizontal cases. After “o” is “-” only if "o"row == "-"row

My solution counts the size of each snake while removing them from the drawing. On that test, I get a blank field with dots “.” at the end. So yes, sure =)

Mine stocks snakes’s history in an array and check if the cell I’m on is an other snake…
Maybe I should use yours to see if it’s make a difference…

There can also be a problem with the size of the execution stack if you do it recursively but there are longer snakes in other validators so it would fail in other validators too.

Yes =) That is why this problem don’t have tag “recursion”. But someone use sys.setrecursionlimit(6400) (in python3) to get 100% with Recursive Algorithm =)

6400 - because 80x80 - max possible size of grid.

Where is said in statement that snake cannot be of size 2? For example ‘o>’

In previous post, i meant second character from the tail cannot be ‘o’ (if somene starts with tail), Sorry.

In tests and validators you won’t see:




If your solution deal with such 2-length snakes it will be aslo 100% in puzzle. You get wrong - because you count, for example "o<" as snake… but this can be a fish, not a snake :wink:

This is why i didn’t make such snakes in test cases. You can tell visually that a lot of the combinations wouldn’t be valid.

  1. Snake head next to a tail that points at the head. This can’t be a snake of size 2 because the tail points in the wrong direction, so it’s either two separate snakes, or a snake facing its own tail.
    Example: “o<” is not a valid snake, but “<-o<-o” is two valid snakes.

  2. Snake head next to a tail that points sideways. This can’t be a snake of size 2, because a turn in the snake requires a “*” character. Similarly to the first case it’s could either be two distinct snakes, or a snake touching its tail.
    Example: “ov” is not a valid snake but the following is two valid snakes

  1. Snake head next to a tail that points away from the head. This is a valid snake of size 2, but I avoided putting those in the test cases to make the solutions easier to implement.
    Example: “o>” is valid

For those who can’t pass the 5th validator, your solution is probably not fast enough. The last validator has over 400 snakes, and their sizes vary from 3 to [the answer to the problem :-)]

I don’t think so, according to the statement.

It doesn’t matter if you count such cases as a two-character snake or not. in tests you will not encounter such a situation, and therefore you will not get an error during validation.

Yes, and we are both right. :beers:

1 Like

That was a size problem.
My code was checking if a cell had been seen in an other snake to eliminate it. I though win time…
But I wasn’t :slight_smile:

1 Like

Hey everyone!
I have some trouble with the “Real Madness” validator, I guess my code isn’t fast enough
is “o—<” a snake ?
and “o----^”