__MACOSX/._Minesweeper_Student-master Minesweeper_Student-master/.DS_Store __MACOSX/Minesweeper_Student-master/._.DS_Store __MACOSX/Minesweeper_Student-master/._Minesweeper_Python...

Need help on python project


__MACOSX/._Minesweeper_Student-master Minesweeper_Student-master/.DS_Store __MACOSX/Minesweeper_Student-master/._.DS_Store __MACOSX/Minesweeper_Student-master/._Minesweeper_Python __MACOSX/Minesweeper_Student-master/._WorldGenerator Minesweeper_Student-master/Minesweeper_Python/Minesweeper_Student_Manual.pdf   Minesweeper Student Manual For Introduction to Artificial Intelligence By: Justin Chung, John Lu, Sui Ting Yeung, Jian Li, Abdullah Younis, Jan Christian, Joyce Le Contact: Joyce Le (lejy @uci.edu ) Last Updated: 20 July 2019 by Joyce Le 1  mailto:[email protected]   Table of Contents  I. Introduction  3 II. Minesweeper Game Mechanics  3 Performance Measure  3 Environment  3 Actuators  4 Sensors  4 III. Tasks to Complete  4 Setup Your Environment  4 Program Your AI  5 Compile Your AI  5 Test Your AI  5 Write Your Project Report  5 Submit Your Project  6 IV. WorldGenerator Manual  6 The Minesweeper World File  6 Using the Python Script  6 Using the Bash Script  8 Example World  8 V. Understanding the Tournament  9 VI. Scoring Explanation & Common Mistakes  10 Team Formation  10 Submission  11 Final Report  11 Tournament Bonus  11 Common Mistakes  12 VII. Appendix: Shell Manual  13 Name  13 Synopsis  13 Options  13 Operands  13 Examples  14 Notes  15 2    I. Introduction In this programming assignment, you will be tasked with implementing a Minesweeper AI Agent, which should be able to play and solve the Minesweeper game. You will have the choice of programming in C++, Java, or Python. Much of the code has already been written for you. Your agent should be able to take in percepts and act accordingly. Your grade will depend on your agent’s performance measure. At the end of the quarter, your agent will compete against your peers’ agents in a class-wide tournament. II. Minesweeper Game Mechanics This version of Minesweeper is based on the classic computer game. You can easily find out the details of the game from the web, for example: https://en.wikipedia.org/wiki/Minesweeper_(video_game) However, there are a few differences designed to better evaluate your agent which will become apparent as you play with and familiarize yourself with the game. In Minesweeper, you are given a board that is set up as a 2D grid of tiles. Each tile covers either: (1) a hint number ( that tells how many mines are around that tile ) or (2) a mine. Ultimately, your agent’s goal is to uncover all tiles which do not contain a mine. A more concrete definition of the game is given by the following PEAS description. Performance Measure ● The performance measure of your agent will be a score calculated based on number of worlds your agent has completed. Points are awarded to your agent only if it successfully solves the entire world. Each difficulty has different weight. ● The game ends when your agent chooses to leave the game or if your agent uncovers a mine. In either of these cases you'll get a zero. Environment ● Each difficulty has a different dimension and number of mines: ○ Beginner: 8 row x 8 column with 10 mines ○ Intermediate: 16x16 with 40 mines ○ Expert: 16x30 with 99 mines ● The board begins with 1 random tile already uncovered and presumably safe ● Mines are randomly placed throughout the board. ● Your agent dies when it uncovers a mine. Actuators ● Your agent has 4 moves: ○ (1) The action UNCOVER reveals a covered tile. ○ (2) The action FLAG places a flag on a tile. ○ (3) The action UNFLAG removes a flag from a tile if that tile has a flag. ○ (4) The action LEAVE ends the game immediately. 3    ● The actions UNCOVER, FLAG, and UNFLAG are to be coupled with a pair of coordinates which allows the agent to act on a single tile. Sensors ● Your agent will receive only one percept: ○ Following an UNCOVER action, your argent will perceive the hint number associated with the previous UNCOVER action. This number represents how many mines are within that tile’s immediate neighbors. ○ Following a FLAG or UNFLAG action, your agent will perceive -1. III. Tasks to Complete Setup Your Environment NOTE THAT THE CODES YOU WILL SUBMIT MUST RUN IN OPENLAB! This project will take advantage of UCI's openlab; any other coding environment is not supported. ● Install Required Applications ○ To connect to openlab, you will need to use SSH. SSH stands for Secure Shell. It is a program designed to allow users to log into another computer over a network, to execute commands on that computer and to move files to and from that computer. ○ A Mac user can simply use the terminal application, whereas a Windows user will need to either install PuTTY or use Git if they have it installed on their local machine. You can download PuTTY from here . Download the MSI installer for Windows, and run the installer for PuTTY. ● Connect to Openlab ○ Connecting to openlab is as easy as SSHing into the open lab server. If you are on Windows and using PuTTY, type “openlab.ics.uci.edu” into the Host Name box; make sure the port is 22 and the SSH flag is ticked. Click open, and login using your ICS account info. If you are using Mac, open the terminal found under Application -> Utilities. Enter ‘ssh [email protected]’ and login using your into ICS account (same command for Window users SSHing using Git). ● Download the shells on Openlab ○ To download the shells on Openlab, you will use Git. On openlab, whether through PuTTY or terminal, execute the following git clone command: Git clone [address] Extra Information about Openlab: http://www.ics.uci.edu/~lab/students/#unix https://www.ics.uci.edu/computing/linux/hosts.php Extra Information about UNIX: https://cgi.math.princeton.edu/compudocwiki/index.php? title=Documentation_and _Information:Getting_started_with_Linux 4    Program Your AI Once you have your environment setup, you can start to program your agent. In the ‘src’ folder of your shell you will find the source code of the project. You are only allowed to make changes to the MyAI class. You are not allowed to copy source codes from any source because it violates Academic Honesty, however, you are allowed to include standard libraries. Compile Your AI Compiling your program is easy as executing the command make from the shell’s root directory (the directory with the makefile in it). Test Your AI To run your program after you have compiled it, navigate to the bin folder. You should find the compiled program inside. Refer to the Shell Manual Appendix for help running it. To generate large amounts of worlds to use with the folder option, refer to the World Generator. If you are using the Python Shell make sure you are using Python 3.5.2. On openlabs, run the command " module load python/3.5.2" to load Python 3.5.2. Write Your Project Report Write a report according to your Professor’s instructions. The report template is at the bottom of this document.   Submit Your Project At this point you should have your most up-to-date source code in the ‘src’ folder, your compiled project in the ‘bin’ folder, and your final report completely filled out and ready to be submitted. Navigate to your shell’s root directory and execute the command make submission. It will ask you for some information and create a zip file inside the folder. Submit this zip file to EEE or Canvas. Make sure your final report is in pdf format and submit it to EEE or Canvas as well. IV. WorldGenerator Manual *NOTE : Before you go ahead creating your own custom boards and world files, create a folder called “Problems” inside the “WorldGenerator” folder. Any worlds you create using either the given Python script or bash scripts will automatically put the generated worlds inside this folder and refresh its contents with the newly created files.   The Minesweeper World File If you’d like to create your own custom Minesweeper World, you can manually create a text file in the following format: [rowDimension][space][colDimension] [startingRow][space][startingColumn] [2D grid of board] 5    • “StartingRow” and “startingColumn” represent the coordinates of the first tile that the world uncovers for you. This feature is designed to guarantee your agent will be safe on its’ starting tile. • The 2D grid should be a sequence of 0’s and 1’s. Columns are separated by a single space while rows are separated by a new line. 0’s represent safe tiles while 1’s represent tiles with mines. The bottom left-most tile should be interpreted as (1, 1). When selecting starting tile, the tiles around it will always be safe, namely 0. • If your 2D grid does not contain at least a 3x3 square of 0’s ( because the starting tile must be a safe tile ), the world is considered invalid. Using the Python script ● There is a Python script “WorldGenerator.py” that you can use to easily generate a set of worlds in the form of txt files. ● If you see "Error opening file" in your console when running the script, that means you haven't create a folder called "Problems" in the directory you are running this script, hence the script fails to locate.  ● To run the script, issue the command: python3 WorldGenerator.py [numFiles] [filename] [rowDimension]  [colDimension] [numMines] The arguments in square brackets are in that order and represent the following: numFiles - The number of files to generate filename - The base name of the file rowDimension - The number of rows colDimension - The number of columns numMines - The number of mines Note that all arguments are required and
May 15, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here