About Java Chess Engine Project

JChess - How to build a chess game from scratch in the Java programming language by Amir Afghani

- using IntelliJ IDEA [IDE to write code, tests and for debugging], developed on a Mac and guided with Joshua Bloch's Effective Java book!

Software Architecture & Design - Amir's YouTube Channel

BlackWidow-Chess Code Repository on GitHub - source code for Amir's finished project

Click on the title for each lecture to follow along and build your own version of the Black Widow chess program. I am working my way through the course by creating this website, attempting to make an HTML5-CSS-JavaScript UI in addition to [a replacement for] the Java AWT interface from the course. More about that when we get there. Putting the project on GitHub.

First, establish the skeleton of the engine. Be patient, this project takes quite a while!

There are many ways to represent the components of chess, including the board, the pieces and the moves in a game. This is the way Amir has chosen to do it.

#1 Introduction & the Tile Class - Java Chess Programming Video - 08/04/2015 [11:05]
Classes: Tile [abstract], Empty Tile, Occupied Tile, Piece [stub]
#2 Immutability Enhancements to the Tile Class - Java Chess Programming Video - 08/05/2015 [20:56]
Immutability [ImmutableMap: Google Guava library]; Classes: Tile

The Pieces: Lectures #3-9

The Pawns (Part 1): Lectures #10-12

Wikipedia King Description
#13 The King - Java Chess Programming Video - 11/23/2015 [14:12]
Classes: King

The Board: Lectures #14-16

The Players: Lectures #17-20

Chess Moves: Lectures #21-28


Next, let's start building the GUI with Java Swing. This part of the Java program runs on the JVM of the computer, not in the browser. A new browser version will be in a totally new section (developed by me after the course is completed and debugged).

GUI: Lectures #29-40

The Pawns (Part 2): Lectures #41-43

>--> #44 Unit Tests - Java Chess Programming Video - 08/10/2016 [8:08]
Classes: Board
RUNTIME PROBLEM: Ignores mouseClicks (but does not throw exception);
Clone all the rest of the BlackWidow files from GitHub - you cannot finish the project without including unit tests [123 compile errors]. Note: this is turning out to be a complicated clustertask!

AI - Artificial Intelligence: Lectures #45-50

>--> #51 Connecting the AI to the GUI - Java Chess Programming Video - 12/22/2016 [46:41]
Classes: GameSetup, Table, TableGameAIWatcher, AIThinkTank, JavachessboardApplication [JChess]
continuing with the instructor lectures to implement the AI (in order for the imported tests to work)
BUILD BROKEN: working on importing instructor's JUnit tests - cannot finish without continuing [88 compile errors]
>--> #52 The FEN file Format - Java Chess Programming Video - 01/23/2017 [28:45]
Classes: FenUtilities, Player, King, Board
continuing with the instructor lectures to implement the AI (in order for the imported tests to work)
BUILD BROKEN: working on importing instructor's JUnit tests - cannot finish without continuing [17 compile errors]
All the BUILD errors have been fixed. Now comes the fun part: debugging!
The plan: learn how to repair the program so that it works (and continue to document what is learned: about Java, about debugging with the IDE, about Swing, and most importantly about how to write an alternative to the Swing version).

01/03/2021 - After much effort I now have a version that builds and runs some of the code, but fails in many respects (most of the JUnit tests are failing at this time).
09/02/2021 - Returning to the project after many months, I found that it will not run at all now (most of the JUnit tests are working, but the FEN tests are failing at this time). I get a ClassNotFoundException in the Main method executing the run command on the SpringBootApplication annotated file! I have looked at Java Code Geeks and Baeldung and Stack Overflow articles, but had no luck so far. Next step is to call JetBrains (or email John Thompson).

My strategy is to go back over the design and write my own JUnit tests, learning as I go and discovering more about Java in the process; I struggle to understand some of the code (and clearly some of the logic is just not working properly). I will also contact the author to give him feedback about the problems I have encountered. His version seems to be written in a mixture of Java 8 and JUnit 4 (with perhaps some Java 11 in places); I am using Java 11 and JUnit 4.13.