Skip to content

For this project, I developed a game with an AI model player using the MinMax Alpha-Beta algorithm.

Notifications You must be signed in to change notification settings

samasthtc/ENCS3340-Magnetic-Cave-Game

Repository files navigation

♟️ Magnetic Cave Game

Table of Contents

Overview

Magnetic Cave Game is a strategic two-player game implemented using Python and Pygame. This game can be played with two players or one player and an AI opponent. The game involves placing magnetic bricks on an 8x8 board, aiming to align five consecutive bricks horizontally, vertically, or diagonally. The minimax algorithm is used to power the AI, ensuring it makes reasonable moves to either win or at least tie the game.

Getting Started

To get started with Magnetic Cave Game, ensure you have Python and Pygame installed on your system. Follow the instructions below to run the game:

  1. Clone the repository:

    git clone https://github.com/samasthtc/ENCS3340-Magnetic-Cave-Game.git
    cd ENCS3340-Magnetic-Cave-Game
  2. Install the required dependencies:

    pip install pygame
  3. Run the game:

    python MagneticCave.py

How to Play

  • The game starts by prompting you to choose a game mode.
  • Players take turns to place their magnetic bricks ( for black and for white) on the board.
  • The goal is to align five consecutive bricks in any direction.
  • The game ends when a player wins or when the board is full (resulting in a tie).

Game Modes

  1. Manual entry for both players: Both and moves are made manually.
  2. Manual for and automatic for : moves are manual, moves are made by AI.
  3. Automatic for and manual for : moves are made by AI, moves are manual.

Dependencies

  • Python 3.x
  • Pygame

Demo

White blocks black from winning.
White blocks black from winning

Trying an illegal move.
Trying an illegal move

White wins!
White wins!

Tie!
Tie!

About

For this project, I developed a game with an AI model player using the MinMax Alpha-Beta algorithm.

Topics

Resources

Stars

Watchers

Forks

Languages