Skip to content

SlaynAndKorpil/Chess

Repository files navigation

Chess

Scala CI

This project is mostly for experimental and testing purpose as it is my first project on github. Don't take it too seriously. (Though it works pretty well, and I appreciate any support)

Components

  1. A backend.
  2. An GUI implementation of the backend.
  3. A CLI to the backend.

A Framework used to simulate a chess game and capable of storing and computing positions, moves, loading and saving. When using scala, you can interact with it through framework.ChessIO trait as a pipe for in&output or JChessIO for use with Java. The main game logic is located in framework.ChessBoard. It currently features:

  1. Recognition and execution of correct moves
  2. Promotions
  3. Any types of draws (insufficient material, stalemate, ...) and mates
  4. Saving and loading your games
  5. Currently no AI opponent but I might be adding Stockfish or Lila when I feel like it
  6. A full java interface

When you start the .jar the game will open. Use a path to a saved game as parameter to open that game.

Right now there are neither animations nor sounds because I normally turn these off in chess apps. I might add these in on demand.

 

Example

example

Use 'console' argument to start in console mode:

java -jar Chess.jar console

Use a path to a saved game as additional parameter to open that game.

java -jar Chess.jar console saves/mySavedGame.save

 

Example

version 0.3
Welcome to my gorgeous CLI chess game! Type "help" and then press 'ENTER' to get a list of available commands.

    a   b   c   d   e   f   g   h
  +---+---+---+---+---+---+---+---+
8 | R | N | B | Q | K | B | N | R |
  +---+---+---+---+---+---+---+---+
7 | P | P | P | P | P | P | P | P |
  +---+---+---+---+---+---+---+---+
6 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
5 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
4 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
3 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
2 | p | p | p | p | p | p | p | p |
  +---+---+---+---+---+---+---+---+
1 | r | n | b | q | k | b | n | r |
  +---+---+---+---+---+---+---+---+

> d2d4
    a   b   c   d   e   f   g   h
  +---+---+---+---+---+---+---+---+
8 | R | N | B | Q | K | B | N | R |
  +---+---+---+---+---+---+---+---+
7 | P | P | P | P | P | P | P | P |
  +---+---+---+---+---+---+---+---+
6 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
5 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
4 |   |   |   | p |   |   |   |   |
  +---+---+---+---+---+---+---+---+
3 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
2 | p | p | p |   | p | p | p | p |
  +---+---+---+---+---+---+---+---+
1 | r | n | b | q | k | b | n | r |
  +---+---+---+---+---+---+---+---+

> save testfile

Successfully saved!

> h7h5
    a   b   c   d   e   f   g   h
  +---+---+---+---+---+---+---+---+
8 | R | N | B | Q | K | B | N | R |
  +---+---+---+---+---+---+---+---+
7 | P | P | P | P | P | P | P |   |
  +---+---+---+---+---+---+---+---+
6 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
5 |   |   |   |   |   |   |   | P |
  +---+---+---+---+---+---+---+---+
4 |   |   |   | p |   |   |   |   |
  +---+---+---+---+---+---+---+---+
3 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
2 | p | p | p |   | p | p | p | p |
  +---+---+---+---+---+---+---+---+
1 | r | n | b | q | k | b | n | r |
  +---+---+---+---+---+---+---+---+

> help

===================<HELP>===================
 - SAVE | S | WRITE | W <file path> : Save this game.
 - RESIGN  : Resign the game.
 - MOVE | MV | M <letter><digit><letter><digit> : Move a piece from one square to another.
 - TAKEBACK | T  : Take the last move back.
 - DRAW  : Propose a draw.
 - HELP | H | ? | MAN | MANUAL [command name] : Get help.
 - EXIT | HALT | STOP | DIE | END | SHUTDOWN | QUIT | KILL  : Stop this BS.
 - RESTART  : Restart the game.
 - LOAD <file path> : Load a saved game.
============================================

> load testfile
    a   b   c   d   e   f   g   h
  +---+---+---+---+---+---+---+---+
8 | R | N | B | Q | K | B | N | R |
  +---+---+---+---+---+---+---+---+
7 | P | P | P | P | P | P | P | P |
  +---+---+---+---+---+---+---+---+
6 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
5 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
4 |   |   |   | p |   |   |   |   |
  +---+---+---+---+---+---+---+---+
3 |   |   |   |   |   |   |   |   |
  +---+---+---+---+---+---+---+---+
2 | p | p | p |   | p | p | p | p |
  +---+---+---+---+---+---+---+---+
1 | r | n | b | q | k | b | n | r |
  +---+---+---+---+---+---+---+---+


Successfully loaded!

> exit
CYA...