A chess engine with basic AI capabilities (search for best move using MinMax algorithm)

Overview

AI CHESS ENGINE, by KEN WU

Video Demo: https://www.youtube.com/watch?v=GqyVCjIernA

Description:

This is an AI chess engine that uses the MinMax algorithm to find the next best move to play. The project consists of three files: chessMain.py, chessEngine.py, and chessAI.py. chessMain.py contains the "main" function which draws the chess board and deals with user inputs. chessEngine.py is responsible for the majority of move mechanics and board graphics/game states. chessAI.py contains the MinMax algorithm.

I chose to implement the Min Max algorithm instead of the greedy algorithm. When I implemented the greedy algorithm, I realized that the AI would simply look one move ahead and choose the move that grants it the most material points. This is a naive algorithm because it doesn't take into account the possible retaliatory moves the opponent can make. For example, in the case where the AI can take a pawn with its queen, it will do so, without checking whether the opponent can take its queen the next move. The Min Max algorithm, on the other hand, evaluates not only the best possible move for its current board position but also tries to minimize the opponent's best move. For instance, if move A grants the AI +1 point but allows the opponent to make a +5 move while move B grants the AI 0 point yet limits the opponent's best move to only 1 point, it will choose move B over move A, because move B minimizes the opponent's score while simultaneously maximizing its own score.

You might also like...
PyChess - a chess client for Linux/Windows

PyChess - a free chess client for Linux/Windows The mission of PyChess is to create a free, pleasant, PyGObject based chess game for the Linux desktop

This a Chess PGN saver which allows you to save your game pgns, in a .pgn file
This a Chess PGN saver which allows you to save your game pgns, in a .pgn file

PGN Saver This a Chess PGN saver which allows you to save your game pgns, in a .pgn file This can be a very useful tool for the people using chessbase

In the works, creating a new Chess Board and way to Play...

sWJz4KingsChess date started on github.com 11-13-2021 In the works, creating a new Chess Board and way to Play... starting to write this in Pygame, an

Running Chess Night results tabulation

Running Chess Night results tabulation

A playable version of Chess – classic two-player, various AI levels, and the crazyhouse variant! Written in Python 3

A playable version of Chess – classic two-player, various AI levels, and the crazyhouse variant! Written in Python 3. Requires the installation of PIL/Pillow and Requests

SuperChess is a GUI application for playing chess.

About SuperChess is a GUI application for playing chess. It is written in Python 3.10 programming language, uses PySide6 GUI library, python-chess lib

Chess - A python gui application

Chess Python version 3.10 or greater is required to play. Note This is a gui application, and as such will not run inside WSL.

Visualizing and learning from games on chess.com
Visualizing and learning from games on chess.com

Better Your Chess What for? This project aims to help you learn from all the chess games you've played online, starting with a simple way to download

j-chess implementation in python

j-chess-client-python This repository aims to be a starting point for implementing a chess ai for the j-chess-server in python. To start, you can copy

Owner
Ken Wu
Melbourne Uni Business Grad 20' | Entrepreneur | Learning to Code
Ken Wu
Minimalistic generic chess variant GUI using pyffish and PySimpleGUI, based on the PySimpleGUI Chess Demo

FairyFishGUI Minimalistic generic chess variant GUI using pyffish and PySimpleGUI, based on the PySimpleGUI Chess Demo. Supports all chess variants su

Fabian Fichter 6 Dec 20, 2022
Chesston (Chess+Python) is a two-player chess game with graphical user interface written in PyQt5

♟️ Chesston (Chess+Python) is a two-player chess game with graphical user interface written in PyQt5. ?? Dependencies This program uses Py

null 6 May 26, 2022
MinMax Algo , Python

Write a PYTHON program to play the game of TIC-TAC-TOE on a 3×3 board with alternate inputs from user and computer.

Naman  Anand 1 Nov 26, 2021
A base chess engine that makes moves on an instance of board.

A base chess engine that makes moves on an instance of board.

null 0 Feb 11, 2022
A Neural Network based chess engine and GUI made with Python and Tensorflow/Keras.

Haxaw-Chess Haxaw: Haxaw is the Neural Network based chess engine made with Python and Tensorflow/Keras. Also uses the python-chess library. (WIP: Imp

Sarthak Bharadwaj 8 Dec 10, 2022
null 3 Oct 22, 2021
Flappy Bird clone utilizing facial recognition to move the

Flappy Face Flappy Bird clone utilizing facial recognition to move the "bird" How it works Flappy Face uses Facial Recognition to detect your face's p

Brady McDermott 1 Jan 11, 2022
A didactic GUI chess game made in Python3 using pygame.

Chess A didactic GUI chess game made in Python3 using pygame. At the moment, there is no AI. The only way you can test the game is by playing against

Leonardo Delfino 1 Dec 22, 2021
Chess Game using Python

Chess Game is a single-player game where the objective is same as the original chess game. You just need to place your chess piece in a correct position. The purpose of the system is to provide some past time with your friends.

Yogesh Selvarajan 1 Aug 15, 2022
Chess GUI

Lucas Chess Lucas Chess is a GUI of chess: To learn to play chess. To play chess against engines. Dependencies Python 2.7 PyQt4 PyAudio psutil Python

Lucas 322 Dec 20, 2022