Based on a challenge idea I posted in chat and the ensuing conversation. Thanks to NathanMerrill and, zgarb, and Jonathan Frech for assistance in fleshing this out.
There exists a 50x50You're writing two separate programs/functions/routines/etc. The first, which we'll call the helper program, takes the input maze and calls the second, which we'll call the solving bot. The solving bot must solve the maze based on its interaction with the helper program.
The maze is 51x51 characters in size. For clarity herein this challenge description, it is composed of #
walls and
corridors, but you can use any two distinct, consistent ASCII characters of your choice. E.g., use !
for walls and x
for corridors, use 1
for walls and 0
for corridors, etc. This maze is one of many that will be the input to your helper program/function.
The maze start is always guaranteed to be somewhere on the left-most column, and the exit is always guaranteed to be somewhere on the right-most column. The maze is guaranteed to have at least one path from the start to the exit. As a result of this construction, the very top row and very bottom row are all #
, and the very left and right columns are all #
except for the start and exit.
The maze-solvingsolving bot (as a program or function) that you're creating needs to find a solution to the maze (not necessarily the shortest), but is limited in that it can only "see" a new 5x5 section of the maze at a time. The bot is scored by how many times it needs to request a new 5x5 section from the helper program/function.
The upper bound is obviously to simply request every possible 5x5 section, for a score of around 100. The lower bound is where someone with perfect knowledge of the maze can request only those 5x5 sections containing the exact route of the shortest solution, possibly as low as 10. Your bot will be run through (1000?) different mazes, and the bot with the lowestfewest total requests will be the winner.
The solving bot is placed on the left-hand side where the start is, and the first 5x5 section is provided for free. However, the bot doesn't know where, vertically, it is on the left-hand side of the maze. It could be in the top corner (as in the example below), in the bottom corner, or somewhereanywhere in between.
The code you're writing be required to take the maze as an input (STDIN, a file to read, etc.) and call a subroutine of some sort for the solution bot.
Input: 50x50 maze, output(1000?) 51x51 mazes Output: howHow many total requests your solving bot took. Rinse/repeat 1000 times.