Chess Game in Python
Python Projects

Chess Game In PYTHON With Source Code

Project: Chess Game in Python with source code

About Project

Chess Game project is written in Python. The project file contains image files and python scripts (chess.py). GUI uses pygame library. Talking about the gameplay, its a strategy board game between a Player and AI. There’s a colored checkered gameboard with 64 squares arranged in an 8×8 grid. The chess board contains different color each time the player starts the game. During the gameplay, at some point, the AI might take a bit time for its movement. Whenever the AI that plays against the human evaluates all possible moves made by either player up to a certain level of depth.

A simple and clean GUI is provided for easy gameplay. The gameplay design is so simple that the user won’t find it difficult to use and understand. Different images are used in the development of this game project, the gaming environment is just like the real chess board game. In order to run the project, you must have installed Python and Pygame on your PC. Chess Game in Python project with source code is free to download. Use for education purpose only! For the project demo, have a look at the image slider below.

https://youtu.be/yPGje_SpKoY
Chess Game in Python project demo

DOWNLOAD CHESS GAME IN PYTHON WITH SOURCE CODE: CLICK THE BUTTON BELOW


Got stuck or need help customizing Chess Game as per your need, just sign up to ask your questions in the forum or just comment down below and we will do our best to answer your question ASAP.

0 0 votes
Article Rating
Subscribe
Notify of
guest
15 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
deep
deep
3 years ago

hello i am getting error in chess game Type error:integer argument expected got float line number 1353. please help me

Hans
Hans
2 years ago

how can i start chess.py in Python without pygame to play DOS-like?

Kumar
Kumar
2 years ago

Im getting float errors . can you please give a solution

codeprojects
Editor
2 years ago
Reply to  Kumar

can you state the exact error?

Ranjan
Ranjan
2 years ago
Reply to  codeprojects

Traceback (most recent call last):
File “E:/python project/chess/ChessGame_PYTHON/Chess/chess.py”, line 1353, in
(square_width*6,square_height*2))
TypeError: integer argument expected, got float

Abdullah
Abdullah
2 years ago

Traceback (most recent call last):
File “D:\Abdullah\ChessGame_PYTHON\Chess\chess.py”, line 1352, in
pieces_image = pygame.transform.scale(pieces_image,
TypeError: integer argument expected, got float

Ali Berhan
Ali Berhan
2 years ago

Hello, I am getting an error like this: pygame.error: Couldn’t open Media\board.png. How can i fix that ?

Akhila
Akhila
2 years ago
Reply to  Ali Berhan

I’m too facing the same error called (pygame.error:couldn’t open media\board.png)
how should I fix that .If you found any answer for that please inform me

Last edited 2 years ago by Akhila
Masteros
Masteros
1 year ago

Hello I learned to program a long time ago, I started with Assembler and C; now that I would like to do something concrete, so I chose preferably an oop language specifically Python. It is very simple but that does not mean that I can do everything, I must wait until I have mastered python properly before creating an application. I found this project “Chess game in Python with source code” and I have the idea to surprise my friends by inviting them to play online through a private room; my friends are scattered all over the world; they are… Read more »

im stuc7yngvgft674
im stuc7yngvgft674
1 year ago

ummmmm. wherwe is the script

Anthony M
Anthony M
1 year ago

1. for this error: “(pygame.error:couldn’t open media\board.png)” I just changed the directory to: background = pygame.image.load(‘Media/board.png’).convert() for all of the references…

2. For the float error I just changed it to reflect and int : pieces_image = pygame.transform.scale(pieces_image,
(int(square_width*6),int(square_height*2))

However now I am getting a new error: File “/home/bigbaer/Documents/PygameChess1/ChessGame_PYTHON/Chess/chess1.py”, line 1354
circle_image_green = pygame.transform.scale(circle_image_green,
^
SyntaxError: invalid syntax

any suggestions?

Brian Chakuinga
Brian Chakuinga
1 year ago

good job????, but I can’t download the project???

Scotty
1 year ago

There is still error on the board when click to move; however, I fix this problems. I hope this helps 🙂

#Rescale the images so that each piece can fit in a square:

pieces_image = pygame.transform.scale(pieces_image,
(int(square_width*6),int(square_height*2)))
circle_image_green = pygame.transform.scale(circle_image_green,
(int(square_width), int(square_height)))
circle_image_capture = pygame.transform.scale(circle_image_capture,
(int(square_width), int(square_height)))
circle_image_red = pygame.transform.scale(circle_image_red,
(int(square_width), int(square_height)))
greenbox_image = pygame.transform.scale(greenbox_image,
(int(square_width), int(square_height)))
yellowbox_image = pygame.transform.scale(yellowbox_image,
(int(square_width), int(square_height)))
circle_image_yellow = pygame.transform.scale(circle_image_yellow,
(int(square_width), int(square_height)))
circle_image_green_big = pygame.transform.scale(circle_image_green_big,
(int(square_width), int(square_height)))
withfriend_pic = pygame.transform.scale(withfriend_pic,
(int(square_width*4),int(square_height*4)))
withAI_pic = pygame.transform.scale(withAI_pic,
(int(square_width*4),int(square_height*4)))
playwhite_pic = pygame.transform.scale(playwhite_pic,
(int(square_width*4),int(square_height*4)))
playblack_pic = pygame.transform.scale(playblack_pic,
(int(square_width*4),int(square_height*4)))
flipEnabled_pic = pygame.transform.scale(flipEnabled_pic,
(int(square_width*4),int(square_height*4)))
flipDisabled_pic = pygame.transform.scale(flipDisabled_pic,
(int(square_width*4),int(square_height*4)))

Sorrthorn
Sorrthorn
10 months ago

I have a problem when i run it say
Traceback (most recent call last):
File “/storage/emulated/0/Download/CHESS_GAME_IN_PYTHON_WITH_SOURCE_CODE/ChessGame_PYTHON/Chess/chess.py”, line 2703, in
TypeError: integer argument expected, got float

Abdu
Abdu
7 months ago

I have this Error Please Tell Me how i can solve this Error?

Traceback (most recent call last):
  File “c:\Users\ABDULRAHMAN\Downloads\ChessGame_PYTHON\Chess\chess.py”, line 154, in <module>
    import pygame #Game library
ModuleNotFoundError: No module named ‘pygame’

15
0
Would love your thoughts, please comment.x
()
x