Skip to content

rsamwilson2323-cloud/Chess-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ™Ÿ๏ธ Gesture Controlled Chess AI

Gesture Controlled Chess AI is an interactive chess system that allows players to play chess using hand gestures detected through a webcam.

The project combines Computer Vision ๐Ÿ‘๏ธ, Artificial Intelligence ๐Ÿง , and Game Logic โ™Ÿ๏ธ to create a unique chess experience. Hand gestures are detected using MediaPipe, processed with OpenCV, and the chess game is handled using python-chess and Pygame.

The project also integrates the Groq API โšก to provide AI-powered chess insights and move analysis.


โœจ Features

โ™Ÿ๏ธ Play chess against an AI opponent ๐Ÿ–๏ธ Control chess pieces using hand gestures ๐Ÿ“ท Real-time webcam gesture detection ๐Ÿง  AI-powered chess move analysis using Groq API ๐ŸŽฎ Interactive chess board interface using Pygame โšก Fast and responsive gameplay


๐Ÿง  Technologies Used

  • Python ๐Ÿ
  • OpenCV โ€“ Computer vision processing
  • MediaPipe โ€“ Hand tracking and gesture detection
  • Pygame โ€“ Chess board interface
  • python-chess โ€“ Chess game logic
  • Groq API โ€“ AI-powered move analysis

๐Ÿ“‚ Project Structure

Chess-AI
โ”‚
โ”œโ”€โ”€ chess AI.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ LICENSE

โš™๏ธ Installation

1๏ธโƒฃ Clone the Repository

git clone https://github.com/rsamwilson2323-cloud/Chess-AI.git
cd Chess-AI

2๏ธโƒฃ Install Dependencies

pip install -r requirements.txt

๐Ÿ”‘ Groq API Setup

This project uses the Groq API for AI-powered chess insights.

Step 1 โ€” Create a Groq Account

Go to the Groq Console:

https://console.groq.com/

Sign up or log in.


Step 2 โ€” Generate an API Key

  1. Open API Keys
  2. Click Create API Key
  3. Copy the generated key

Example:

gsk_xxxxxxxxxxxxxxxxxxxxxxxxx

Step 3 โ€” Add the API Key to the Code

Open the file:

chess AI.py

Find this section:

from groq import Groq

client = Groq(api_key="YOUR_API_KEY_HERE")

Replace it with your actual API key:

from groq import Groq

client = Groq(api_key="gsk_your_actual_api_key_here")

โ–ถ๏ธ Usage

Run the program:

python "chess AI.py"

๐Ÿ“ท The webcam will start automatically and begin detecting hand gestures.

To exit the program:

Press ENTER โŽ


๐Ÿ–๏ธ Gesture Controls

Gesture Action
Hand detection Activates gesture tracking
Finger movement Select chess pieces
Gesture confirmation Perform the move

โš ๏ธ Gesture accuracy may vary depending on lighting and camera quality.


โš™๏ธ How It Works

1๏ธโƒฃ The webcam captures hand movements 2๏ธโƒฃ MediaPipe detects and tracks hand landmarks 3๏ธโƒฃ Gesture movements are converted into chess commands 4๏ธโƒฃ The python-chess engine validates moves 5๏ธโƒฃ The Groq AI assistant provides move analysis 6๏ธโƒฃ Pygame displays the chess board and updates moves


๐Ÿš€ Future Improvements

โ™Ÿ๏ธ Stronger chess AI engine integration ๐ŸŽ™๏ธ Voice control support ๐ŸŒ Online multiplayer mode ๐Ÿค– Improved gesture recognition accuracy ๐Ÿ“Š AI-based move explanations


๐Ÿ‘จโ€๐Ÿ’ป Author

Sam Wilson

๐ŸŒ GitHub https://github.com/rsamwilson2323-cloud

๐Ÿ’ผ LinkedIn https://www.linkedin.com/in/sam-wilson-14b554385


๐Ÿ“œ License

This project is licensed under the MIT License.

About

Gesture Controlled AI Chess is a computer vision project that lets users play chess using hand gestures. It uses MediaPipe for hand tracking, OpenCV for camera input, Pygame for the interface, and Groq LLaMA3 AI for the opponent. Players control the cursor with their finger and move pieces using a pinch gesture. โ™Ÿ๏ธ๐Ÿ–๏ธ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages