This project is about chess game in 3D mode. Chess is a two-player strategy board game on a checkered board with 8x8 grid dimension. There is two player on each game which the first player as White and the second player as Black.
To use this repository, you will need:
- C++
- FreeGLUT
- Clone this repository
git clone https://github.com/stevenalbert/3d-chess-opengl
- Compile C++ source code files
- Run the executable
Notes: To run this program please put the executable file and model directory in the same directory. This program has only been tested on Windows and Linux.
# build
mkdir -p bin && g++ main.cpp Model.cpp Chess/*.cpp `pkgconf --libs glut gl glu` -o bin/3d-chess-opengl
# run
bin/3d-chess-opengl
- Each player started with 16 pieces (2
Rooks
, 2Knights
, 2Bishops
, 1Queen
, 1King
, and 8Pawns
) on respective side. - First turn is for
White
piece and next turn is forBlack
piece. - Other rules can be read in Rules of Chess - Wikipedia
Check
- WhenKing
is under immediate attack of opponent's pieceCheckmate
-Check
state without valid move left for the player to make theKing
un-Check
-edStalemate
- Not inCheck
state but can't move other than move to theCheck
itself (not implemented)
Win
- The player who givesCheckmate
to opponentLose
- The player who gotCheckmate
Draw
- There is no winner (not implemented)
Key | Action |
---|---|
N |
Start new game |
W |
Move cursor forward 1 step |
A |
Move cursor left 1 step |
S |
Move cursor backward 1 step |
D |
Move cursor right 1 step |
Space |
Select piece Move piece Cancel move |
O |
Approve start new game |
X |
Close game after checkmate Cancel start new game |
Q |
Promote to Queen |
R |
Promote to Rook |
B |
Promote to Bishop |
K |
Promote to Knight |