This is one of the problem i have been working from a long time.This is a game of PentaHexes. A player gets to choose one of the 22 pentaHexes and flip/rotate the pentahex according to his/her need, and place the pentaHex in the grid. In the 2 player version of the game, i have to keep a check on end-of-game scenario. A game ends when one of the player fails to keep a pentaHex on the grid.
For your reference, the game grid and pentaHexes are shown in the page 40. if you check this link.
I am looking for an algorithm to do this. I can handle coding !
I can do this with a brute force method which would be something like :
each time a penta hex is placed
find all the unused hexagons in the grid.
check the unused PentaHexes,
get the pattern of PentaHex,
check if you can place any of the pentaHex on the Grid,
if YES,
game is not over.
if NO
game over.
You are trying to optimize something that does not exist yet.
Implement it first, use your brute-force idea, and then when you have something that works to a fashion, you will have a far better understanding of what needs to happen. This is the time when you start optimizing and improving your code.
Very, very, rarely does anyone write a piece of code that is perfect in its first iteration.
Don’t fall into the trap of trying have a complete/final design before you code. It is very rare that all contingencies/problems can be foreseen. Use your design as a guideline and scope delimiter; write your first ‘draft’ program; now you can debug and optimize.
You can code, so you know it is an iterative process.