Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/clemenscodes/chess

MVC Chess GUI using Java and bitboards
https://github.com/clemenscodes/chess

bitboards chess controlp5 java junit5 mvc-pattern processing

Last synced: 19 days ago
JSON representation

MVC Chess GUI using Java and bitboards

Awesome Lists containing this project

README

        

# Chess MVC

## Overview

This is a fully functioning MVC Chess GUI written in Java.
It leverages the Processing library for the graphical user interface,
ControlP5 for buttons, and
JUnit for testing.

The chess logic is implemented using [bitboards](https://www.chessprogramming.org/Bitboards) with a little endian rank file mapping board representation.
All chess rules are implemented including castling king and queenside, en passant, pawn promotions and draw by 75 move rule.

All the techniques used to implement this chess game are documented in the [chess programming wiki](https://www.chessprogramming.org/Main_Page).

### Architecture

The code is structured as a monorepo with the following projects and dependencies.

![](assets/graph.png)

## Screenshots

![](assets/initial.png)

### New game

![](assets/start.png)

### Highlighted source square

![](assets/highlighted.png)

### Legal moves per piece

![](assets/possiblemoves.png)

### Error feedback

![](assets/error.png)

### Draw offers

![](assets/drawoffer.png)
![](assets/acceptdrawoffer.png)
![](assets/accepteddraw.png)

### Castling

![](assets/kingcastle.png)
![](assets/queencastle.png)

### Pawn promotions

![](assets/queenpromotion.png)
![](assets/rookpromotion.png)
![](assets/rookpromotionresult.png)

### Resignations

![](assets/whiteresign.png)
![](assets/blackresign.png)

### Checkmate

![](assets/checkmate.png)
![](assets/wcheckmate.png)

## Requirements

- jdk 21
- node
- pnpm

## Getting started

### 1. Clone the repository

```sh
git clone https://github.com/clemenscodes/chess.git
cd chess
```

### 2. Install build dependencies

```sh
pnpm install
```

### 3. Start

```sh
pnpm start
```

### Alternative

Using an IDE like IntelliJ will also build and start the project without additional configuration.

## JShell e2e testing

To test the model using the jshell, simply run the jshell script:

```sh
pnpm jshell
```

or manually:

```sh
jshell --class-path dist/api:dist/model --startup e2e/model.jshell
```

## Javadoc

```sh
pnpm run docs
```