Giter VIP home page Giter VIP logo

minesweeperai's Introduction

Minesweeper AI

Introduction

Minesweeper AI is a sophisticated implementation of the classic Minesweeper game, enhanced with an artificial intelligence that can assist in making moves. The game has been developed in Python and utilizes the Pygame library for rendering the game's graphical user interface.

Features

  • Classic Minesweeper gameplay with customizable board sizes and mine counts.
  • An AI assistant that can suggest safe moves or make random moves when no safe move is apparent.
  • Visual and interactive GUI built with Pygame.
  • Reset functionality to start a new game at any point.

Installation

To run Minesweeper AI on your machine, follow these steps:

  1. Ensure you have Python 3. installed on your system. You can download Python here.

  2. Clone the repository to your local machine: https://github.com/roniboukheir1/MinesweeperAI.git

  3. Navigate to the cloned repository's directory.

  4. Install the required dependencies: pip3 install pygame

  5. Run the game: python MinesweeperGame.py

Usage

  • Left-click on a cell to uncover it.
  • Right-click to place a flag on a cell you suspect contains a mine.
  • Click the "AI Move" button to let the AI make a move.
  • Click the "Reset" button to start a new game.

How it Works

Minesweeper Class

  • Initializes the game with a specified grid size and number of mines.
  • Randomly places mines on the grid.
  • Calculates the number of adjacent mines for each cell.

MinesweeperAI Class

  • Keeps track of safe moves, mines, and other game knowledge.
  • Analyzes the game state to suggest the next move.
  • Can make a random move if no safe move is identified.

Pygame Interface

  • Renders the game board and responds to user interactions.
  • Displays flags, mines, and numbers indicating the count of adjacent mines.
  • Provides buttons for AI assistance and game reset.

Contributing

We welcome contributions to Minesweeper AI. If you have suggestions or bug reports, please open an issue. If you'd like to contribute to the codebase, please open a pull request.


Enjoy playing Minesweeper AI and testing your skills against the AI assistant!

minesweeperai's People

Contributors

roniboukheir1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.