An Interactive Constraint-Based Approach to Minesweeper
نویسندگان
چکیده
We present a Java applet that uses Constraint Processing (CP) to assist a human in playing the popular game Minesweeper. Our goal is to illustrate the power of CP techniques to model and solve combinatorial problems in a context accessible to the general public. Minesweeper is a video game that has been included with Microsoft Windows since 1989. In this game, the player is presented with a grid of squares. Each of these squares may conceal a mine. When the player clicks on a square, it is revealed. If the square is a mine, the game is over. If the square is not a mine, it is replaced by a number indicating how many of the adjacent squares are mines. The goal of the game is to reveal all squares that are not mines. These simple rules yield a complex problem: Kaye proved that the minesweeper-consistency problem is NP-complete (2000). The minesweeper-consistency problem is to determine if, given a board with some known squares, there exists a layout of mines in the unknown squares that is consistent with the numbers displayed. A few programs have been written to solve Minesweeper. One notable such program was developed by Collet (2004), and uses the Oz language to model and solve Minesweeper as a set of Boolean linear constraints. In his implementation, Collet defines constraints intensionally and generates dual variables to achieve higher-level consistency1. This model artificially and unnecessarily increases the number of variables (thus increasing the cost in terms of time and space), and obscures the concept of ‘consistency level,’ which is central to Constraint Processing. Like (Collet 2004), our program assists the player in solving Minesweeper puzzles by modeling them as Constraint Satisfaction Problems (CSPs). Although our model is similar to that of Collet, it was developed independently. Also, our constraints are defined in extension, and, importantly, our implementation uses textbook propagation-algorithms to determine the locations of mines, thus better serving our pedagogical goals.
منابع مشابه
Algorithmic Approaches to Playing Minesweeper
This thesis explores the challenges associated with designing a Minesweeper solving algorithm. In particular, it considers how to best start a game, various heuristics for handling guesses, and different strategies for making deterministic deductions. The paper explores the single point approach and the constraint satisfaction problem model for playing Minesweeper. I present two novel implement...
متن کاملAutomatically Identifying Trigger-based Behavior in Malware
Malware often contains hidden behavior which is only activated when properly triggered. Well known examples include: the MyDoom worm which DDoS’s on particular dates, keyloggers which only log keystrokes for particular sites, and DDoS zombies which are only activated when given the proper command. We call such behavior trigger-based behavior. Currently, trigger-based behavior analysis is often ...
متن کاملA Novel Interactive Possibilistic Mixed Integer Nonlinear Model for Cellular Manufacturing Problem under Uncertainty
Elaborating an appropriate cellular manufacturing system (CMS) could solve many structural and operational issues. Thereby, considering some significant factors as worker skill, machine hardness, and product quality levels could assist the companies in current competitive environment. This paper proposes a novel interactive possibilistic mixed integer nonlinear approach to minimize the total co...
متن کاملA Chance Constraint Approach to Multi Response Optimization Based on a Network Data Envelopment Analysis
In this paper, a novel approach for multi response optimization is presented. In the proposed approach, response variables in treatments combination occur with a certain probability. Moreover, we assume that each treatment has a network style. Because of the probabilistic nature of treatment combination, the proposed approach can compute the efficiency of each treatment under the desirable reli...
متن کاملCombining Myopic Optimization and Tree Search: Application to MineSweeper
Many reactive planning tasks are tackled by optimization combined with shrinking horizon at each time step: the problem is simplified to a non-reactive (myopic) optimization problem, based on the available information at the current time step and an estimate of future behavior, then it is solved; and the simplified problem is updated at each time step thanks to new information. This is in parti...
متن کامل