No problem being late, I didn't call it yet. :)
Tybalt89's solution doesn't qualify, knowing beforehand that you don't need one of the robots wasn't part of my game. With such a reduced branch factor brute forcing is easy.
Though it made me think about
- the best way to design challenges
- types of challenges and avoiding misunderstandings
My goal was a general algorithm to solve random robot positions in acceptable time.
And to have a problem hard enough to demonstrate some basic and advanced techniques like branch and bound. The recent triangle challenge was far too lightweight in complexity.
FWIW: The origin of this problem was a game we played at our students union in 2005.
But many people attempted to solve the whole problem class in the meantime and published solutions.
UPDATE
- Your solution is correct, it's analogous to the other shown yet. (please add spoiler tags though)
- Runtime on my laptop averaged at 75 seconds after 3 runs
- Memory was ~1.3-1.5GB
Disclaimer: I maybe should write a proper test suite for benchmarking under reproducible conditions.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.