June 2025 - Challenge
This was nothing out of the ordinary for an IBM puzzle, and I found it to be a fun and relatively quick challenge, but nothing too inspiring.
Stats:
Difficulty: 5/10
Enjoyability: 7/10
Leaderboard Placing: 11/80
The approach:
I wrote some simple Python code to find solutions to a game of any size via a depth-first search. The 20x20 board is too large for a solution to be found by this method, but by inspecting the solutions found to smaller boards, I was able to devise a systematic way of sweeping out the edges of the board in a zig-zag pattern and turning a corner each time one was reached. This led to the following solution to the first problem, which I don’t expect you to read, but note that it’s highly repetitive, with the periodic chunks becoming shorter and shorter as a consequence of us spiralling inwards towards the middle of the board:
CHCHCHCHCHCHCHCHCHCHCHCHCHCHCHCHCHCHBGDBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB EBDAFDGDGDGDGDGDGDGDGDGDGDGDGDGDGDGDGDFCHFAFAFAFAFAFAFAFAFAFAFAFAFAFH EBHCHCHCHCHCHCHCHCHCHCHCHCHCHBGDBEBEBEBEBEBEBEBEBEBEBDAFDGDGDGDGDGDG DGDGDGDGDFCHFAFAFAFAFAFAFAFHEBHCHCHCHCHCHCHCHBGDBEBEBEBEBDAFDGDGDGDGD FCHFAFHEBHCHBGD
I found this solution “semi-manually”, in the sense that I wrote some code to execute moves for me and display the results on a makeshift board, and then I formed the above solution by copy-and-pasting the right patterns a bunch of times and just running my code to see if it landed me where I thought it should.
As for the bonus problem, this was also too large to be solved purely by DFS, so I hoped my newfound method of zig-zagging my way around the board could be used to find a solution “semi-manually” as it could for the original problem. This proved to be a little too difficult since the new starting position wasn’t amenable to a nicely symmetric solution like the original problem, so I opted for a hybrid approach. In particular, I used my zig-zag method to partially colour the board until it was in a state from which DFS could examine all possibilities, and with a little trial and error I eventually found the following solution:
CHCHCHCHBGDBEBEBDAFDGDGDGDGDGDGDFCHFHEGHFHADFGAGABAGABHBGACDFDEDEDBDA