i´m a first year CS student, trying to solve the following game in Java.
SS of game
Rules:
1.) The player and computer take turns. The player starts. Before the game 14 random Hexagons get deleted.
2.) The player can delete one Hexagon on each of his turns.
3.) On his turn the computer moves one hexagon from his current position. The priority of the computers movements is known to the player.
4.) The game ends when either 10 turns are over, or the player has deleted all edge hexagons the computer can reach. The computer wins if he reaches an edge Hexagon or an edge Hexagon is reachable after ten moves. Otherwise the player wins and gets score depending on how many hexagons the computer is locked in on.
What i have done so far:
1.) I´ve recreated the game in Java with classes HexagonalButton and HexagonalButtonGrid. The game is playable and seems to move the same as in the actual game.
2.) I´ve included the A* pathfinding algorithm to identify which move the computer will make with its move priority.
3.) I´ve generated a heatmap, by generating every optimal path to the available edge hexagons and calculating how often the computer goes over each hexagon.
I thought by calculating the heatmap i could identify key squares that i should block but this only works partially, because the numbers always decrease steadily from inside to outside. Blocking the innermost hexagons is rarely the way to surround the computer and maximize the area.
Image of Pathfinder
Generated Heatmap
There are cases where clicking on the highest number square on the way to the current path of the computer makes the player win, but it isnt guaranteed. I also have no idea how to even approach the optimization problem of maximizing the middle area at game end. I´ve googled a lot to find out what the next steps might be, but beyond my current point i cant seem to find a way to tackle the surrounding problem.
I would appreciate any hint or pointer on how to further approach this problem. I can provide the code if it helps.
Thanks a lot for any help!
Endolymp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.