Giter VIP home page Giter VIP logo

chess's Introduction

Chess

Chess simulation. Click on the piece to move, and the location to move it to. If the action is legal, it will be taken. The game is done once a King enters checkmate, or once there is a draw.

Setup

  • The Java version for this project is Java 11, which can be downloaded here
  • Then, you can download the Chess.jar file and run it to start playing chess

Pieces

There are six different pieces:

  • Pawn
  • Bishop
  • Rook
  • Knight
  • Queen
  • King

Pawn

The pawn may move one square forward, or two squares forward on its first action, given that it does not move over any other pieces. The pawn may capture by moving one square diagonally forward.

Bishop

The bishop may move or capture in any amount of squares diagonally, given that it does not move over any other pieces.

Rook

The rook may move or capture in any amount of squares horizontally or vertically, given that it does not move over any other pieces.

Knight

The knight may move one square vertically and two squares horizontally, or vice-versa. The knight may move over other pieces.

Queen

The queen may move or capture in any amount of squares horizontally or vertically or diagonally, given that it does not move over any other pieces.

King

The king may move to any square which is adjacent to it, given that it does not move into check.

Special Actions

There are three special actions:

  • Pawn Promotion
  • Castling
  • En Passant

Pawn Promotion

If a pawn reaches the other end of the board, the user may pick whether to promote it to a queen, rook, knight, or bishop.

Castling

If the rook and king have not yet moved, and there are no pieces between them, the king may move two squares towards the rook, and the rook may move to the adjacent square in which the king moved from, given that the king was not in check, will not move into check, and the path between where the king moved from and is moving to does not have any squares which are in check.

En Passant

Immediately after a pawn moves two squares, a pawn may capture it as if it had only moved one square.

Special States

There are three special states:

  • Check
  • Checkmate
  • Draw

Check

The king is said to be in check when the next move by the opponent would capture it.

Checkmate

A checkmate occurs when the king is in check, and any action taken results in the king still being in check.

Draw

There are four ways for a draw to occur:

  1. Stalemate: occurs when the king is not in check, but any action taken results in the king being in check.
  2. 50 move rule: 50 moves from both white and black occur without any pawns moving or any pieces being captured.
  3. Threefold repetition: the same board repeats three times in a row, meaning the pieces are on the same squares, and the castling and en passant opportunities are the same.
  4. Insufficient mating material: not enough pieces to cause a checkmate, which can occur from a lone king against lone king, or king and knight, or king and bishop, or king and two knights.

Screenshots

Start Of Game Middle Of Game Legal Moves

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.