[Community Puzzle] Morellet’s random lines

Colors are set as it would be on a chessboard, everytime you cross a line, color changes.

2 Likes

What do you mean by cross a line? I am not able to understand from the image.

Look at the image in the first post of this thread, but only look at the top left quarter of the image.
It looks like lines were randomly drawn on the image, splitting it into polygons.
Then one polygon was randomly painted red and all polygons that are separated from this red polygon with an even number of lines were painted red too.

Very difficult to visualize when you say “separated with an even number of lines”.

Ok for all the tests but not for “validator 7 : lots of line 2”. Any idea why ?
I discard already done lines, save the new and count the number of different sign of ax+by+c for A and B. I answer with parity of the count.

Can you show me your code in private?

Hey. Got a problem on submission case 07. Test cases passed.
Equal lines are considered one. Counted intersections of this lines with AB in range (A;B). I answer with parity of the count.
Can’t even imagine what’s wrong.
@nicola FYI
@RRRoumy Seems we have the same problem. Did you figure out what was wrong?

You don’t need to count the intersections, you just have to say if you are on a line, on a white zone or on a black zone.
Try by hand with a simple case where you add lines line by line.

No I didn’t, too ifficult without the reason why it doesn’t work ( tests ok, not validator).


To say if it on the same color zone, or not - u have to count intersections, between lines and AB, like on the image. If this count divisible or not by 2 - defines if A and B on the same color zone or not.
I’ve even play with float comparison precision - didn’t give me a lot.

I’ve been working on (and enjoying) this puzzle for several days now.

I pass all tests, but fail the very last validator.
Could you give me that validator (or a version of it) please??

Can you send me your code?
I’ll send back it’s error message.

Thanks so much

The rule is that odd quantity of lines between points result in different colors.

Yes but beware of equal lines.

The problem about the “Mind the sign” validator is the númber 0 in the coefficients.
Try this custom test:

-1 3 2 1
2
2 -2 0
-2 2 0
NO

Comparing coefficients by division can be tricky