A Java Swing application that solves Go (board game) life-and-death problems using alpha-beta minimax search. Built as a Master's dissertation project.
- Java 21 or later
Using the Gradle wrapper:
./gradlew buildOr with a system-installed Gradle (8.x+):
gradle build./gradlew runOr run the built JAR directly:
java -jar build/libs/GoLifeAndDeath.jarThe application opens a 19x19 Go board with a control panel on the right.
Switch between modes using the Game Options radio buttons:
- Play against human -- Two players alternate clicking on the board to place stones.
- Play against computer -- Play moves against the AI engine. Choose the computer's colour (black/white) and configure search depth/breadth, then press START for the computer to move.
- Edit the Go Board -- Set up a custom board position for analysis.
In edit mode you can:
- Add white/black stones -- Select a stone colour and click intersections.
- Clear spaces -- Remove individual stones.
- Mark out of bounds -- Mark areas outside the problem region (click "Set Space to Out of Bounds" to fill all remaining empty space).
- Set life/death group -- Click a stone to designate the group whose survival is being evaluated. A red dot marks the selected group.
- Load or edit a problem position.
- Select Play against computer.
- Choose the computer's colour.
- Set MAX DEPTH (search tree depth limit; 99 = essentially unlimited) and MAX BREADTH (number of candidate moves evaluated per level).
- Press START if it is the computer's turn, or click the board to play your move.
- Press PASS to skip your turn.
- LOAD -- Opens a file chooser to load a
.txtproblem file. Sample problems are included in thegoProblems/directory. - SAVE -- Saves the current board position and description to a file.
Problem files are plain text:
<19 rows of 19 characters each, top row first>
<turn>,<lifeRow>,<lifeColumn>
<optional description>
Characters: x (black), o (white), - (empty), * (out of bounds).
src/main/java/com/golifeanddeath/
GoMain.java Entry point
model/
GoBoard.java Board state representation
GameHistory.java Move history for Ko detection
engine/
AlphaBetaDB.java Alpha-beta minimax search engine
BoardEvaluator.java Static board evaluation heuristics
MoveChecker.java Move validation and capture logic
NextMoves.java Candidate move generation
ui/
GoGUI.java Swing GUI and event handling
BoardImage.java Board rendering
io/
GoFileHandler.java Load/save problem files
goProblems/ Sample life-and-death problems