Generate a minesweeper board which doesn't need guessing

前端 未结 3 353
鱼传尺愫
鱼传尺愫 2020-12-24 07:43

I am designing a Minesweeper-like game (with modified rules), and I want to prevent player from guessing. My goal is: The generated board is with few revealed squares, and p

3条回答
  •  隐瞒了意图╮
    2020-12-24 08:31

    It's well-known solving minesweeper is NP-complete.

    This is true but perhaps not as relevant as you think. The proposed algorithm is something like "repeatedly generate random boards until the computer can solve one". NP-hardness is a property of the worst case, but here we're really interested in the average-case hardness. If an unusually hard board is generated, we can time out the solver and restart with a new board.

    Also, even if there were an oracle to distinguish good boards from bad, would you really want the user to have to solve a hard problem in order to avoid guessing? A less talented computer solver might bias the choice toward fairer boards.

提交回复
热议问题