Chess is a Ruby program played on the command line. It's a two player game where players have the option to start a new game or continue a saved previous match.
These instructions will get you a copy of the project up and running on your local machine.
To work with ruby programs you will need to install Ruby.
- On GitHub, click on the clone or download button and copy the URL.
- Open your command prompt /terminal.
- Change your current working directory to the location you want to save your project in.
- Type git clone and paster the URL you copied earlier:
$ git clone https://github.com/tfb34/battleship.git
- Press Enter. You should now have a copy of the project on your computer.
To start the game, you must run the program in terminal :
$ ruby main.rb
Two players are needed to play. The program will ask users to enter 1 or 2 if they wish to start a new game(1) or continue game(2).To move a chess piece, player must find the column letter and row number of chess piece.
Example:
Let's say Jin wants to move his pawn at d2 to d4. He must type 'd2 d4' and then hit enter. The move is valid, therefore the next player can go.
Otherwise, the player will be prompted for another move
End Game- checkmate
- player resigns
- save
- draw; if there's a draw, flip a coin for now
Two-Move Checkmate
For player to resign, player must type resign , at his/her turn.
To save game, a player must type save , at his/her turn. A player may start from a loaded game, by entering (e.g. steins) when prompted, but has the option of overwriting current loaded game or saving a new file.
Rook(a1) : moves horizontally and vertically any number of unoccupied squares. *
Knight(b1) : moves in an L shape in any direction. From b1, the knight has only 2 locations it can move to, a3 or c3.
Bishop(c1) : moves diagonally any number of unoccupied squares in any direction. *
Queen(d1) : moves horizontally, vertically, and diagonally for any number of unoccupied squares in any direction.*
King(e1) : moves to an adjacent square in any direction. At the moment, castling is not an option. *
row 2
Pawn(c2) : moves forward 1 square at a time. May move diagonally 1 square, only if it's capturing an enemy. Cannot capture an opponent directly in front of it. Only on its initial move, may pawn move forward 2 squares.
If a particular move exposes the king, or would put the king in check, then the program will prompt you for another move.
If a pawn makes it to the very opposite end of the board(row1 or row8), it will be promoted. The program will prompt user to enter queen, rook, bishop, or knight. The pawn on the board is then replaced with the player's choice.
For more information on chess visit wikipedia page
If you do not see the chess pieces as they appear in the pictures above, you may need to go to command prompt settings and change the font. On Windows, change the font to DejaVu Sans Mono.