Ken Bayer, Josh Snyder, and Berthe Y. Choueiry Constraint Systems Laboratory University of Nebraska-Lincoln A Constraint-Based Approach to Solving Minesweeper.

Slides:



Advertisements
Similar presentations
How To Chord by Fritz Löhr
Advertisements

Constraint Systems Laboratory February 18, 2009 CSP Modeling Examples CSP: Examples Industrial applications: scheduling, resource allocation, product configuration,
G53CLP Constraint Logic Programming Modeling CSPs – Case Study I Dr Rong Qu.
© 2010 Delmar, Cengage Learning Chapter 9: Using ActionScript.
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
Best-First Search: Agendas
Representing a Game Board In a game, we represent the action taking place using an array – In a very simple game, we use individual variables to represent.
Domineering Solving Large Combinatorial Search Spaces.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
 i may require adding new constraints, except for… o i =1  domain filtering o i =   constraint filtering Robert Woodward & Berthe Y. Choueiry Constraint.
Minesweeper is a game of logic. It originated from “Relentless Logic,” which was written by Conway, Hong, and Smith around In Relentless Logic, the.
Playing Rev9 This is the opening screen the player sees upon starting the game.
Constraint Satisfaction Problems
Minesweeper By Allan Cooke Jon Hilliard. Description We set out to recreate the ever so popular Minesweeper game that Windows users love so much.
Game Mathematics & Game State The Complexity of Games Expectations of Players Efficiency Game Mathematics o Collision Detection & Response o Object Overlap.
Support: UCARE grant awarded to Chris Reeson & CAREER Award # from the National Science Foundation. To the public: –Illustrate the power of CP For.
Constraint Systems Laboratory March 26, 2007Reeson–Undergraduate Thesis1 Using Constraint Processing to Model, Solve, and Support Interactive Solving of.
A game of logic where the player must assign the numbers 1..9 to cells on a 9x9 grid. The placement of the numbers must be such that every number must.
Chapter 5 Outline Formal definition of CSP CSP Examples
HandoutApr. 2007Satisfiability A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
The Program Design Phases
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
 Optimal Packing of High- Precision Rectangles By Eric Huang & Richard E. Korf 25 th AAAI Conference, 2011 Florida Institute of Technology CSE 5694 Robotics.
Data Structures Using C++ 2E Chapter 6 Recursion.
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Data Structures Using C++ 2E Chapter 6 Recursion.
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
1 Solving problems by searching This Lecture Chapters 3.1 to 3.4 Next Lecture Chapter 3.5 to 3.7 (Please read lecture topic material before and after each.
Exploiting Automatically Inferred Constraint-Models for Building Identification in Satellite Imagery Research funded by the AFSOR, grant numbers FA
Because the localized R(*,m)C does not consider combinations of relations across clusters, propagation between clusters is hindered. Synthesizing a global.
Motivation & Goal SAT and Constraint Processing (CP) are fundamental areas of Computer Science that address the same computational questions. Compare SAT.
The ‘game’ is played by 12 players and 2 Accountants. The accountants and the first player can volunteer. Other players Are chosen as the game progresses.
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
Problems, Problem Spaces and Search
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
VIRTUAL MEMORY By Thi Nguyen. Motivation  In early time, the main memory was not large enough to store and execute complex program as higher level languages.
Lacey Johnson Summer 2013 Student Research Project – James Madison University Sudoku can be described as a system of polynomials which can then be solved.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
CP Summer School Modelling for Constraint Programming Barbara Smith 4. Combining Viewpoints, Modelling Advice.
Introduction to Computer Programming
Sudoku Solver Cs671 Matt Lehmann. Algorithm Selected Local Hill Climbing/Distributed Breakout Not-complete Not guaranteed to terminate(infinite loops)
Reading Flash. Training target: Read the following reading materials and use the reading skills mentioned in the passages above. You may also choose some.
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
Minesweeper Solver Marina Maznikova Artificial Intelligence II Fall 2011.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Craps Game Application Introducing Random-Number Generation and Enum.
Robust Planning using Constraint Satisfaction Techniques Daniel Buettner and Berthe Y. Choueiry Constraint Systems Laboratory Department of Computer Science.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
Introduction to Game Programming & Design III Lecture III.
Understanding AI of 2 Player Games. Motivation Not much experience in AI (first AI project) and no specific interests/passion that I wanted to explore.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
Chapter 3: I Need a Tour Guide (Introduction to Visual Basic 2012)
Chapter 9: Value-Returning Functions
CS162 Week 5 Kyle Dewey.
Scratch for Interactivity
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Constraint Satisfaction Problems vs. Finite State Problems
Empirical Comparison of Preprocessing and Lookahead Techniques for Binary Constraint Satisfaction Problems Zheying Jane Yang & Berthe Y. Choueiry Constraint.
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Christopher Hodgson and Gregory Tyler Loftis
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Constraint satisfaction problems
Solving Sudoku with Consistency: A Visual and Interactive Approach
CS534 Spring 2019: Logic Based Systems with Minesweeper
Constraint satisfaction problems
Unit II Game Playing.
Presentation transcript:

Ken Bayer, Josh Snyder, and Berthe Y. Choueiry Constraint Systems Laboratory University of Nebraska-Lincoln A Constraint-Based Approach to Solving Minesweeper 1. Minesweeper 1.Kaye, R.: Minesweeper is NP-complete. Mathematical Intelligencer 22. This research was supported by CAREER Award # from the National Science Foundation. 4. The Application References Minesweeper is a game of logic. It originated from ‘Relentless Logic,’ which was written by Conway, Hong, and Smith around In Relentless Logic, the player is a soldier trying to crawl back to the Command Center, avoiding mines. The player knows only the number of mines adjacent to his/her current position. The modern form of Minesweeper was developed by Donner and was released with Windows in The player can click on any square to reveal it. If the square has a mine on it, the player loses. If it doesn’t have a mine, the square is replaced with a number indicating how many adjacent squares are mined. Using this information, the player tries to mark all of the mines on the board. Recently, Kaye showed that determining whether a Minesweeper configuration is consistent is NP-Complete [1]. Relentless Logic Minesweeper in Windows Vista Minesweeper, circa 2000  Motivate the students for the study of Constraint Processing (CP). Minesweeper is perfect to this end because it allows us to illustrate the use of CP algorithms in a familiar context and show how they operate.  Understand and demystify humans’ fascination with puzzles.  Discourage graduate students from losing too much time playing the game by making a program that plays the game for them. 2. Our Goals 3. Our Approach We model Minesweeper as a Constraint Satisfaction Problem (CSP) and explore the application of constraint propagation techniques to interactively determine safe and mined squares. Constraint C 1 :Scope = {A,B,C,D,E,I,J} Exactly 2 neighboring squares must have mines Constraint C 2 : Scope = {D,E,F,G,H,I,J} Exactly 3 neighboring squares must have mines  Every square is a variable with two possible values: safe or mined.  Every safe square yields a ‘sum constraint’ over its 8 neighbors. For example, a square labeled 3 yields a constraint stating the square be surrounded by 3 mines. We use the same rules as the Windows version of Minesweeper. The player can:  Choose a pre-defined level of difficulty or specify the board size and number of mines.  Load a predefined game stored in an xml file.  Trigger constraint propagation at 3 consistency levels: oGAC o2-relational consistency, and o3-relational consistency. We project the generated higher-arity constraints on the domains, but do not save those generated constraints in order to save on memory space.  Execute each consistency algorithm to proceed either step-by- step or to run in a loop until quiescence. 5. Constraint Propagation 3-RC 2-RC GAC GAC, 2-RC, and 3-RC are of increasing complexity: GAC ensures the consistency of each single constraint, 2-RC (respectively 3-RC) ensures the consistency of every combination of 2 (respectively 3) constraints with overlapping scopes. Higher levels of consistency are more costly, but can infer more information. Given the computational cost, one always applies GAC first, then 2-RC, followed by 3-RC. 7. Interesting Configurations Another interesting configuration is the circle of 2’s: neither GAC nor 2-RC yields any filtering. 3-RC is necessary to solve this puzzle! While increasing the level of consistency allows one to eventually find all possible solutions to a given configuration of a Minesweeper instance, constraint propagation cannot guarantee that the player will win every game… … because of situations such as the one pictured here where two possible solutions exist. 6. Previewing Propagation This configuration illustrates a situation where GAC is unable to filter any values; we must look at pairs of constraints (2-RC) to solve this puzzle. 2-RC 3-RC To illustrate the effects of the different levels of consistency, ‘Peek’ buttons show the user, using a color code, the squares whose ‘state’ can be determined by each level of consistency propagation without actually flagging them to reveal them. We use blue for GAC, green for 2-RC, and yellow for 3-RC. Available online at consystlab.unl.edu/our_work/minesweeper.html