A fully-featured ASCII chess game implemented in Java with terminal-based graphics and interactive gameplay.
AsciiChess is a terminal-based chess game that brings the classic game of chess to your command line. Built with Java 21 and featuring beautiful ASCII art, this implementation provides a complete chess experience with:
- โจ Beautiful ASCII art interface
- ๐ฎ Interactive keyboard controls
- โ๏ธ Full chess piece movement validation
- ๐ค AI opponent (coming soon)
- ๐จ Colorized terminal output
- โจ๏ธ Cross-platform terminal support
- Complete Chess Implementation: All standard chess pieces with proper movement rules
- Interactive Gameplay: Navigate the board using keyboard controls
- Visual Board Display: Clean ASCII representation of the chess board
- Move Validation: Ensures all moves follow chess rules
- Cross-Platform: Works on Windows, macOS, and Linux terminals
- Modern Java: Built with Java 21 and modern development practices
WindowsTerminal_DJTGM58PVs.mp4
- Java 21 or higher
- Maven 3.6+ for building
- A terminal that supports ANSI colors (most modern terminals)
-
Clone the repository:
git clone https://github.com/yourusername/AsciiChess.git cd AsciiChess -
Build the project:
mvn clean compile
-
Run the game:
mvn exec:java -Dexec.mainClass="org.ascii.Main"Or build a JAR file:
mvn assembly:single java -jar target/AsciiChess-1.0-SNAPSHOT-jar-with-dependencies.jar
- Arrow Keys: Navigate the board cursor
- Enter/Space: Select piece or confirm move
- ESC: Cancel current selection
- Q: Quit game
- Start the game and you'll see the chess board
- Use arrow keys to move the cursor to the piece you want to move
- Press Enter to select the piece
- Move the cursor to the destination square
- Press Enter to make the move
- The game alternates between white and black players
src/main/java/org/ascii/
โโโ Main.java # Entry point and game initialization
โโโ chess/
โ โโโ ai/
โ โ โโโ KingsMovement.java # AI movement logic
โ โโโ board/
โ โ โโโ ChessBoard.java # Board representation
โ โ โโโ ChessBox.java # Individual board squares
โ โ โโโ Game.java # Game logic and state
โ โโโ pieces/
โ โ โโโ Bishop.java # Bishop piece implementation
โ โ โโโ ChessPieceType.java # Piece type enumeration
โ โ โโโ ChessToken.java # Base piece class
โ โ โโโ King.java # King piece implementation
โ โ โโโ Knight.java # Knight piece implementation
โ โ โโโ Pawn.java # Pawn piece implementation
โ โ โโโ Queen.java # Queen piece implementation
โ โ โโโ Rook.java # Rook piece implementation
โ โโโ util/
โ โโโ Colors.java # Terminal color constants
โ โโโ Cursor.java # Cursor management
โ โโโ Data.java # Game data structures
โ โโโ Directions.java # Movement directions
โ โโโ Display.java # Display utilities
โ โโโ Key.java # Keyboard input constants
โ โโโ KeyBoardInput.java # Input handling
โ โโโ MovementRecord.java # Move history
โ โโโ Movements.java # Movement validation
โ โโโ Path.java # Path finding for pieces
โ โโโ Players.java # Player management
โ โโโ Point.java # Board coordinates
โ โโโ Text.java # Text utilities
- JLine 3.23.0: Terminal control and input handling
- JNA 5.12.1: Native library access for terminal operations
- Jansi 2.4.0: ANSI escape sequence support
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests if applicable
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Clone your fork
git clone https://github.com/yourusername/AsciiChess.git
cd AsciiChess
# Build and test
mvn clean compile
mvn test
# Run the game
mvn exec:java -Dexec.mainClass="org.ascii.Main"- AI opponent with difficulty levels
- Save/load game functionality
- Network multiplayer support
- Move history and replay
- Chess notation support (PGN)
- Tournament mode
- Customizable themes
- Sound effects
This project is licensed under the MIT License - see the LICENSE file for details.
Hilal - GitHub Profile
- Thanks to the JLine team for excellent terminal control
- Chess piece movement algorithms inspired by classic chess implementations
- ASCII art generated with online tools
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Join the discussion in existing issues
โญ If you enjoyed this project, please give it a star! โญ