Algorithm and data structure for solving the game “Globs”/flood fill/“FloodIt”

后端 未结 7 2033
感情败类
感情败类 2021-01-31 19:35

Suggest an algorithm and data structure for solving the game Globs (http://www.deadwhale.com/play.php?game=131). It\'s pretty fun in a geeky kind of way.

State t

7条回答
  •  醉梦人生
    2021-01-31 20:15

    Given the fixed starting state and limited number of moves I think you can fully explore a decision tree. For each round, there are only 5 possible moves and wasted moves (choosing a color that will not 'glob' any neighbors what-so-ever) can be eliminated as the tree is built. Once the decision tree is built I think you could explore the point value of each path but if you needed more optimization a A* would definitely get you close.

    For each round, I would have the basic state as a matrix of bit arrays for the state of the unglobbed locations (since the color no longer matters in the globbed locations you could save memory on your state data structure by leaving off the color bits) and a point value for each decision possible. Then your A*, or breadth first algorithm can just maximize the path values as normal. Save the path, and once your analysis is complete, make all of the determined moves.

提交回复
热议问题