Skip to content

ASmolyar/Chess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Chess Game

A Java implementation of the classic game of chess with GUI. This project provides a complete chess playing experience with standard rules and move validation.

## Features

- Complete chess rules implementation
- Graphical user interface with an interactive board
- Move history displayed in algebraic notation
- Standard chess features:
  - Castling (kingside and queenside)
  - En passant captures
  - Pawn promotion to queen
  - Check and checkmate detection
- Game state tracking:
  - 50-move rule
  - Threefold repetition
  - Stalemate detection
  - Insufficient material draws

## How to Run

1. Compile the Java files:
```bash
javac -d bin src/main/java/org/cis1200/*.java src/main/java/org/cis1200/pieces/*.java src/main/java/org/cis1200/util/*.java
```

2. Run the game:
```bash
java -cp bin org.cis1200.Game
```

## Code Structure

- `org.cis1200`
  - `RunChess.java` - Main UI coordinator and entry point
  - `ChessBoard.java` - Visual representation and user interaction
  - `Board.java` - Core game logic and state management

- `org.cis1200.pieces`
  - `King.java`, `Queen.java`, `Rook.java`, etc. - Piece-specific implementations

- `org.cis1200.util`
  - `Piece.java` - Abstract base class for all chess pieces

## How to Play

1. The game starts with White's turn
2. Click on a piece to select it
3. Legal moves will be highlighted on the board
4. Click on a highlighted square to move the selected piece
5. The move history will be displayed on the right panel
6. Use the Reset button to start a new game

## Implementation Notes

- The game uses Forsyth-Edwards Notation (FEN) internally for board representation
- Move validation includes checking for pins and discovered checks
- The UI separates game logic from presentation using the MVC pattern
- Test suite included for validating game rules and edge cases

## Future Improvements

- Save and load games
- Time controls
- Computer opponent
- More customization options (piece sets, board colors)

## License

This project is available for educational purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors