1 / 26

CPE 481 - Minesweeper

CPE 481 - Minesweeper. Hafeez Jaffer. Introduction. Rules of the game History originally created by Robert Donner and Curt Johnson. New Features. - open and save minefield. - more freedom in choosing minefield dimensions. New Features Cont. Turn Rete engine on/off

vern
Download Presentation

CPE 481 - Minesweeper

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CPE 481 - Minesweeper Hafeez Jaffer

  2. Introduction • Rules of the game • History • originally created by Robert Donner and Curt Johnson

  3. New Features - open and save minefield - more freedom in choosing minefield dimensions

  4. New Features Cont. • Turn Rete engine on/off • Display Rete engine facts • Try all combinations (beta)

  5. Goal of the Assignment • Create a JESS agent that will find mines in a given Minefield • minesweeper.clp • Found in the Jess directory, each rule that is written in this file will be loaded and executed by the MineSweeper program to determine mine locations

  6. Grading Criteria • Logically deduce and flag mine locations in a given solvable minefield (one that doesn't require guessing) • Solve all the test cases in the "testCases" directory • Solve expert minefields in an efficient and fast manner

  7. Point breakdown • 5 points for implementing the deffunctions "flagAllSurroundingUnknowns" and "revealAllSurroundingUnknowns" • 5 points for performance • 10 points for the test runs • 5 points for the README file and documentation of the source code

  8. Submission • "minesweeper.clp" file • containing the JESS rules to solve a given minefield • A README file documenting how your agent deduces mine locations and any known limitations

  9. Test Cases • This presentation contains 6 basic test cases • These may not be the ones I use to test your program

  10. Test Case1

  11. Test Case1 Solution A B C – 1 A B – 1 B C D – 1 C D – 1 1 – 1 = 0. 0 means all that’s left are not mines C is not a mine. A 1 – 1 = 0. 0 means all that’s left are not mines B is not a mine. B C D

  12. Test Case2

  13. Test Case2 Solution C is left after DE is taken out. C must be a mine. (2 – 1 = 1) D E – 1 D E C – 2 A B C D – 1 E C D – 2 E is left after CD is taken out. C must be a mine. (2 – 1 = 1) A B C D E 2 – 1 = 1, the number that’s left is equal to this, therefore mine Jess functions used: Intersection, complement, and test

  14. Test Case3

  15. Test Case3 Solution BCI was taken out, 5 – 3 = 2. That’s the number remaining. If equal, all are mines. DJ are mines A B C F H I – 3 B C D J I – 5 B C D I J – 5 C D E J G K – 3 A B C D E CDJ was taken out, 5 – 3 = 2. That’s the number remaining. If equal, all are mines. BI are mines G F H I J K Jess functions used: Intersection, complement, and test

  16. Test Case4

  17. Test Case4 Solution C D F – 1 C D F I J K – 3 B C H I J – 4 A B C H I E G – 3 BCHI removed, 4 – 3 = 1, That’s the number remaining. So J is a mine. For the bottom, AEG are left. 3 – 4 = -1. This is less than or equal to 0. AEG are not mines. A B C D E F G H I J K Jess functions used: Intersection, complement, and test

  18. Test Case5

  19. Test Case5 Solution B can be revealed because there is only one mine left. B must be 1 so A and D can be revealed A B C D

  20. Test Case6

  21. Test Case6 Solution • Use the “Try all combinations” option from the menu

  22. Implementation Details - Deftemplates (MineSquare (slot id) - integer (slot row) - integer (slot col) - integer (slot status ?status) - integer (multislot surroundingUnknowns) - integer list (slot numSurroundingFlags) - integer ) (MinefieldVariables (slot numberMines) - integer (slot mineHeight) - integer (slot mineWidth) - integer )

  23. Implementation Details - Defglobals • EMPTY_SQUARE (=0) • FLAGGED_MINE (=-2) • UNKNOWN (=-4)

  24. Implementation Details – GUI hooks • (reveal-square ?id) • (flag-square ?id)

  25. Implementation Details – Jess commands • http://www.cs.vu.nl/~ksprac/2002/doc/Jess60/functions.html • length$ • Returns the number of fields in a multifield value. • Subsetp • Returns TRUE if the first argument is a subset of the second (i.e., all the elements of the first multifield appear in the second multifield); otherwise, returns FALSE. • complement$ • Returns a new multifield consisting of all elements of the second multifield not appearing in the first multifield. • intersection$ • Returns the intersection of two multifields. Returns a multifield consisting of the elements the two argument multifields have in common. • Test • Returns true if the argument is true, false otherwise.

  26. Conclusion • Any questions?

More Related