A network-ready chess game in Java, playable entirely in the terminal—either versus another human (locally or over the network) or against a simple computer AI.
- Terminal-based chess for two players or vs. computer
- Play in standalone, server, or client mode across a network
- Handles move validation for regulation chess (including special moves, depending on implementation)
- Simple computer AI (decision tree for move selection)
- Easy-to-follow text interface
- Java 8+ (tested with OpenJDK and Oracle JDK)
- Command-line access
Clone the repo and compile all Java files:
git clone https://github.com/matthewJamesAbbott/Java-Chess.git
cd Java-Chess
javac *.javaStandalone vs Human/Computer (no arguments):
java xyz.squig.MainServer mode (wait for remote player):
java xyz.squig.Main -sClient mode (connect to server's IP):
java xyz.squig.Main -c [SERVER_IP_ADDRESS]Help:
java xyz.squig.Main --help- Enter board coordinates as prompted (e.g., number for row, letter for column—
1 a 2 ato move a piece from 1A to 2A; see CLI prompts). - Type
9where prompted to exit immediately.
Core classes and their purposes:
Main.java- Main entry point; handles user prompts and network game setup (client/server/standalone).Board.java- Board state and cell update/access methods.Engine.java- Contains AI logic for generating a move using a move tree.MoveCalculator.java- Evaluates board positions and determines legal moves for all pieces (including AI).Tree.java&TreeNode.java- Used by AI: builds a decision tree for move selection.LinkedList.java&Node.java- Stores and serializes lists of possible moves.
- Text-based UI only (no graphical/X support).
- Requires both client and server to have network connectivity (port 9008).
- AI is a basic material-capture search, not a strong chess engine.
- Games are not persisted—once stopped, progress is lost.
This code is not licensed for redistribution or commercial use;
it is published here for learning and personal exploration.Created by Matthew James Abbott.
Do not reuse or redistribute without explicit permission.
Contact through GitHub for any permission requests.
Enjoy Java Chess!
