Morellet’s random lines puzzle


#1

Hi every one

"These lines draw a somewhat strange chess board that you fill with only two colours." is the only definition of Morellet lines in the Morellet’s random lines puzzle.

We are asked to tell if two points have the same color. How should I answer this question with the current definition? There is no clear rule in how the colors are chosen.

I managed to get 100% by assuming that two neighbor areas should not have the same colors. But it is clearly not the case even in the first google image results of "morellet lines":


Maybe I missed something?

Thanks


Morellet’s random lines Error on last test "Mind the sign"
#2

We just need to know, are the colours the same.
There are only two.
The points in one, or s+2*n, sector are the same color.


#3

Hi there,

I tried to solve the puzzle Morellet’s random lines. I was thinking I successed because I passed all the tests in the interactive window but when I submit, he failed on the last one "Mind the sign".
Is people have met the same anoying problem ? Or I messed something in my code ?

Thanks in advance for your help guys.


#4

Maybe two lines are the same?


#5

Hi nicola1, thanks for your answer :slight_smile:
It wasn't two same lines, it was two same intersection point from two different lines, that I count twice instead of once...

Have a good day


#6

I have problem with Morellet’s random lines. All passed from ide but last one doesn't pass. I see that someone had that issue, but can't figure out how he solved it.


#7

Why? Timeout or wrong output?


#8

Sry, from ide all passed, when submitted last one didn't pass so i don't know exactly why it didn't.


#9

Maybe your algorithm is faulty. :wink:


#10

I count all lines between two points (discarding same lines and those where points are on same side) and if that number is odd then NO, if it's even then YES.


#11

What if three lines meet at the same point?


#12

It should be NO if there are 3 lines between points. If poins are on same side of one of those lines, it is YES.
-4 1 2 4
3
5 4 0
-5 4 0
-5 -1 0
YES

-4 1 4 1
3
5 4 0
-5 4 0
-5 -1 0
NO


#13

Do you have idea what could be wrong?


#14

Hi,
you should consider case where you have one of a or b equal to 0.


#15

In some odd way my code did’nt passed all test via interactive IDE.
BUT managed to get 100% in validation!
After, review some code from other member - I also found possible logical errors there.
Consider review an test cases.


#16

Maybe your code is a bit faulty.


#17

@UPS have you understood why your code failed the tests in IDE? To my understanding, you were lucky that your code passed the validators.


#18

Maybe. But in this case validator tests are inconvenience. This code would not have passed the test.
More over: I carefully readed other solushion (only one published in GO). And found errors. It cant pass obvious test:
0 9 0 -9
1
0 1 1

So I conclude about wrong\incomplete tests on validator\IDE in this pazzle.