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! ⭐