Code a Chess Game with Stockfish API – JavaScript Tutorial
freeCodeCamp.org freeCodeCamp.org
9.46M subscribers
34,613 views
0

 Published On May 2, 2024

Learn how to code a chess game that can be played against another person or a computer, using the Stockfish API. The tutorial uses JavaScript and Angular, but you can follow along if you don't know Angular.

💻 Code: https://github.com/awsomeCStutorials/...

Stockfish API: https://stockfish.online/

✏️ Course created by @RobertsTech139
You can email Roberts if you have questions: [email protected]
  / roberts-tech-2a6977307  

⭐️ Contents ⭐️
⌨️ (0:00:00) Introduction
⌨️ (0:02:09) Object-oriented model for a chess app
⌨️ (0:03:55) Create a new Angular project
⌨️ (0:04:07) Abstract Piece class
⌨️ (0:07:07) Bishop class
⌨️ (0:08:22) Knight class
⌨️ (0:09:54) Queen class
⌨️ (0:11:25) Rook class
⌨️ (0:13:14) King class
⌨️ (0:14:37) Pawn class
⌨️ (0:17:06) Chessboard class basic props
⌨️ (0:20:36) Generate chess-board component
⌨️ (0:20:57) working on displaying the chessboard in the browser
⌨️ (0:27:58) Showing a final view of a chess board with pieces
⌨️ (0:28:12) Discussing how we can implement methods
⌨️ (0:32:13) Implementing method to check if the player is in check
⌨️ (0:37:08) Implement a method to see if the position is safe after the move
⌨️ (0:39:17) Implement a method to find all possible safe squares
⌨️ (0:46:39) Method that marks selected piece and piece's safe squares
⌨️ (0:52:16) Method that prevents selecting pieces of a player who is not playing
⌨️ (0:53:22) Implement a method that is responsible for moving pieces
⌨️ (0:56:22) Implement placingPiece method
⌨️ (1:00:03) Declare properties and methods that signalize if the king is in check
⌨️ (1:07:46) Implementing Castling move
⌨️ (1:14:48) implementing EnPassant move
⌨️ (1:21:03) implementing Pawn promotion
⌨️ (1:34:14) Implement a method that checks if a checkmate or stalemate is happening
⌨️ (1:36:32) Implement a method that checks if the game is overdue 50-move rule
⌨️ (1:37:58) Insufficient material poistions
⌨️ (1:41:48) Show game over the message in the application
⌨️ (1:43:31) Demonstrating that checkmate, stalemate, and insufficient material position detection are working
⌨️ (1:44:25) FEN Converter class
⌨️ (1:56:41) Implement a method that detects if the same position occurred 3 times (Threefold repetition rule)
⌨️ (2:01:19) Method that flips the board
⌨️ (2:03:00) Generate computer mode component, stockfish service
⌨️ (2:04:08) Quick explanation of stockfish rest API that we are going to use to get moves from the computer
⌨️ (2:05:42) Implement a method that retrieves the best move from the Stockfish engine
⌨️ (2:13:27) Install angular material
⌨️ (2:14:05) Working on nav menu component
⌨️ (2:18:40) Working on computer mode component
⌨️ (2:22:43) Working on a dialog component
⌨️ (2:37:10) Changes to make our application compatible with the new version of Stockfish API
⌨️ (2:38:01) showing play against computer dialog cmp
⌨️ (2:37:12) Working on a component that shows us the list of previous moves in the game
⌨️ (2:58:25) Implement a method that stores move in short algebraic notation
⌨️ (3:07:07) Implement a method to emit sound after each move type
⌨️ (3:12:22) Implement a method to navigate between moves in the move list component using the left and right arrow

🎉 Thanks to our Champion and Sponsor supporters:
👾 davthecoder
👾 jedi-or-sith
👾 南宮千影
👾 Agustín Kussrow
👾 Nattira Maneerat
👾 Heather Wcislo
👾 Serhiy Kalinets
👾 Justin Hual
👾 Otis Morgan
👾 Oscar Rahnama

--

Learn to code for free and get a developer job: https://www.freecodecamp.org

Read hundreds of articles on programming: https://freecodecamp.org/news

show more

Share/Embed