[Community Puzzle] Messed up mosaics

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Gautzilla,validated by @FredericLocquet,@papyjo and @TBali.
If you have any issues, feel free to ping them.

Hmm, validators 6 & 7 are not passed…
How could it be ?

Did you pass the tests 6 & 7? If so it’s kinda strange, the 2 last validators are roughly similar to their respective test cases (same size, pattern and staggering scheme).

What are your program’s outputs for these validators?

Hello, same for me, online test 7 didn’t pass. Maybe something is missing on the public tests.

Validator 7 is the only case where the line containing the messed up pattern is in the form of “partial end of correct pattern” + “incorrect pattern” + “correct patterns up to the end of the line”. This is not featured in the other cases.

1 Like

wow, great observation skills! Thanks for pointing that out.
@LeGourdin & @dark_vidor, did it help? What are your program’s output for these validators?

Hello, I’ve pass all tests on IDE, but validator 6 and 7 failed for me too.
I think my code answers the case mentioned by @5DN1L.
:pensive: :pensive:

If I can give an advice, my code passed all tests by doing this:

  • construct the “expected line” from the pattern, by concat (nb+1) pattern so that the “expected line” is longer than the line
  • try to find the line in the expected line
  • if you find, the line is ok
  • if you don’t find, find the possibility with only one diff.
1 Like

@5DN1L : Thanks!
Tips for others, try this line “-}--}--}--}--{--}--{--}-{”
Should return position 2 as false

I used this criteria and it worked well:

Print the index i of the row for which row[i…end] is not a valid part of the repeating pattern but row[i+1…end] is valid.

Thanks @Remi , for your tips, it’s really help me.
I’ve to refactor all my code now it’s work perfectly.
:star_struck:

Hi,
Could someone explain me what is the difference between validator 4 and test 4. All tests are ok for me but not validator 4 …
Thx

Hi,

Wild guess would be you are using some regex to solve it and the fact that there’s an asterisk and a dot in the pattern is messing with it.

Does your code works with:
In:

6
.-*
.-*.-*.-*
.-*.-*.-*
--*.-*.-*
.-*.-*.-*
.-*.-*.-*
.-*.-*.-*

Out:
(0,2)

Thanks for your help. My code works on your example. I don’t use regex.

They are pretty similar but don’t use the same pattern:

the test uses the pattern |\_/
the validator uses the pattern .-*-

Note that the validator’s pattern has 2 identical chars, that might where your code is struggling!

thx a lot, for others : I had an issue when the mistake was the first symbol

Hey, why isnt the answer (1,2) since the second occurrence of - is at index 1 and not 0

That’s because the second occurrence of - is at the right place: it is part of the pattern.

Since there can only be one misplaced tile in the mosaic, considering the first - as correct would mean that the line should be:

-*.-*.-*. : correct line
--*.-*.-* : 8 misplaced tiles

instead, if you consider that the first - is the misplaced one (and should be . since it’s followed by a - (see pattern)), you have:

.-*.-*.-* : correct line
--*.-*.-* : 1 misplaced tile

Validator 7 is Tough to figure out (because it’s not visible and doing something slightly different), look at the above hint and DRAW it out in TEXT to figure out what is going on and why the code is struggling to find a match.

As general feedback… I appreciated working on this, and it really annoyed me finding a solution that kept from breaking the CVTs you created :wink: yet glad when I did, Thank you!

1 Like