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!
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.
#13 The King
- Java Chess Programming Video - 11/23/2015 [14:12]
Classes: King
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).
>--> #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!
>--> #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.