Skip to content

BailinYe/MiniChess_AI

Repository files navigation

Mini Chess AI

Overview: This project implements a simplified version of Chess called Mini Chess, played on a 5x5 board. The goal is to develop an AI using Minimax and Alpha-Beta pruning, along with different heuristics to evaluate game states.

Features: Game Modes: - Human vs Human (H-H) - Human vs AI (H-AI) - AI vs Human (AI-H) - AI vs AI (AI-AI)

Chess Mechanics:

  • Basic chess piece movement:
    • King (K): Moves 1 square in any direction. The goal is to capture the opponent’s king.
    • Queen (Q): Moves any number of squares in any direction.
    • Bishop (B): Moves diagonally any number of squares.
    • Knight (N): Moves in an L-shape (2 squares in one direction and 1 in a perpendicular direction). It can jump over other pieces.
    • Pawns (p): Moves 1 square forward and captures diagonally. Pawns promote to a Queen upon reaching the 5th row opposite their side.
  • Pawn promotion to Queen upon reaching the last rank.
  • Win condition: Capturing the opponent's King.
  • Draw condition: No piece change in 10 turns.

AI Implementation:

  • Minimax Algorithm
  • Alpha-Beta Pruning
  • Heuristic Evaluations (e0, e1, e2)

Game Trace Logging:

  • Stores move history, board states, and AI decisions.

How to Play:

  • The game starts with an initial board setup.
  • Players enter moves using chess notation (e.g., B2 B3).
  • AI will play automatically if set in AI mode.
  • Moves are validated before execution.
  • The game continues until a King is captured (win) or no pieces change for 10 turns (draw).

AI Heuristics:

  • e0 (Basic Heuristic): Based on piece values.
  • e1 & e2 (Custom Heuristics): To be implemented.

How to run the project:
in command prompt: python MiniChessSkeletonCode.py

About

A group project for AI course.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages