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.
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:
-
Clone the repository:
git clone https://github.com/samasthtc/ENCS3340-Magnetic-Cave-Game.git cd ENCS3340-Magnetic-Cave-Game
-
Install the required dependencies:
pip install pygame
-
Run the game:
python MagneticCave.py
- 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).
- Manual entry for both players: Both
■
and□
moves are made manually. - Manual for
■
and automatic for□
:■
moves are manual,□
moves are made by AI. - Automatic for
■
and manual for□
:■
moves are made by AI,□
moves are manual.
- Python 3.x
- Pygame