Skip to content

About

Simple Chess Engine built using pytorch for basic understanding of Machine Learning.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

E4 Chess Engine

A self-learning chess AI that trains itself by playing against itself, then plays against you.


Setup (do this once)

1. Make sure you have Python installed Python 3.9 or higher. Check with:

python --version

2. Install the required libraries Open a terminal, go into the project folder, and run:

cd chess_ai_project
pip install -r requirements.txt

How to use it

Step 1 — Train the AI first

The AI starts knowing nothing. Run this to teach it by having it play games against itself:

python main.py train --cycles 5 --games 20

This takes a few minutes. You'll see it playing games and updating itself. Run it again any time you want it to get stronger — it picks up where it left off.

Step 2 — Start the server

python main.py server

You should see:

Uvicorn running on http://0.0.0.0:8000

Step 3 — Open your browser

Go to:

http://127.0.0.1:8000

The chess board will load and you can play.


Playing against the AI

  • Pick White or Black using the buttons above the board
  • Drag and drop pieces to make your move
  • The AI responds automatically
  • Hit New Game to start over at any time

Making the AI stronger

Just run the training command again. More cycles = stronger AI:

python main.py train --cycles 20 --games 50

The AI also learns a little from every game you play against it automatically.


Troubleshooting

Nothing shows up at localhost:8000 Make sure you're running the server from inside the chess_ai_project folder, not from outside it.

Please note that Training is slow That's normal on a regular laptop. Fewer games per cycle = faster but weaker. More games = slower but stronger.


Developed and Maintained by Atul / Lisk

About

Simple Chess Engine built using pytorch for basic understanding of Machine Learning.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages