Ad
  • Default User Avatar

    I really like this task. It's was fun. My code gave right answer for first 2 boards. But for board 3 it gave 18 instead of 20.
    I have no idea why. Those are the logs(Zeroes are empty places). Can somebody point me in the right direction?

    [ [ 1, 2, 0, 0, 0, 0, 0, 0, 0, 'Z 18' ]
    [ 3, 'S', 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 2, 'S', 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 1, 'S', 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]

    [ [ 1, 2, 0, 0, 0, 0, 0, 0, 'Z 12', 0 ],
    [ 3, 'S', 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 2, 'S', 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 1, 'S', 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]

    [ [ 1, 2, 0, 0, 0, 0, 0, 'Z 9', 0, 0 ],
    [ 3, 'S', 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 2, 'S', 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 1, 'S', 0, 0, 0, 0, 0, 0, 0, 'Z 10' ],
    [ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 3, 0, 0, 0, 0, 0, 0, 0, 0, 'Z 22' ] ]\

    [ [ 1, 2, 0, 0, 0, 0, 'Z 6', 0, 0, 0 ],
    [ 3, 'S', 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 2, 'S', 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 1, 'S', 0, 0, 0, 0, 0, 0, 'Z 8', 0 ],
    [ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 3, 0, 0, 0, 0, 0, 0, 0, 'Z 19', 0 ] ]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, 0, 0, 0 ],
    [ 2, 0, 0, 0, 0, 'Z 11', 0, 0, 0, 0 ],
    [ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]

    [ [ 1, 2, 0, 'Z 6', 0, 0, 0, 0, 0, 0 ],
    [ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 'Z 2', 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
    [ 0, 0, 'Z 7', 0, 0, 0, 0, 0, 0, 0 ],
    [ 0, 0, 0, 0, 'Z 11', 0, 0, 0, 0, 0 ],
    [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]

  • Default User Avatar

    The way my solution "works" is so scuffed now that I look at Your work.Thank You for Your explanations how it works.