Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bashmocha/minesweeper-ai

A simple minesweeper game with AI coded in python. You could play the game either by yourself or with AI.
https://github.com/bashmocha/minesweeper-ai

ai cs50 cs50ai python

Last synced: 24 days ago
JSON representation

A simple minesweeper game with AI coded in python. You could play the game either by yourself or with AI.

Awesome Lists containing this project

README

        

# minesweeper
A Minesweeper game that you can play by yourself or let AI play for you.

**Note:** AI will not always win. There will be some cases where the AI must guess, because it lacks sufficient information to make a safe move. On terminal, there will print whether the AI is making a move it believes to be safe or whether it is making a random move.


gameplay

## Installation

Run `pip3 install -r requirements.txt` to install pygame.

## Getting Started

`cd` to the directory and run `python3 runner.py` to start playing.

## Project description

It is one of the projects for Harvard's online course **CS50’s Introduction to Artificial Intelligence with Python**. There are two main files in this project: `runner.py` and `minesweeper.py`. `runner.py` was implemented by the teaching staff, and contains all of the code to run the graphical interface for the game. In `minesweeper.py`, the `Minesweeper` class was entirely implemented by the teaching staff.
I implemented `hash`, `known_mines`, `known_safes`, `mark_mine`, and `mark_safe` functions in the `Sentence` class, and `add_knowledge`, `neighbors`, `make_safe_move`, and `make_random_move` functions in the `MinesweeperAI` class.