##Chess This is a version of Chess playable in the terminal that was initially developed in conjunction with my partner Jordan Minatogawa. Features that we implemented together include a smart AI that prioritizes higher-value targets and an undo function.
Features that I updated include a choice of 1-player or 2-player, instructions, pawn promotion, castling, en passant, and highlighting of existing possible moves.
###Video Demonstration (Click video picture to be redirected to Youtube video)
####Code for deep duping that allows for the undo function
def deep_dup
new_grid = []
@grid.each do |row|
add = []
row.each do |square|
if square == nil
add.push(nil)
else
add.push(square.dup)
end
end
new_grid.push(add)
end
new_board = Board.new(new_grid, @last_board)
new_grid.each_with_index do |row, ridx|
row.each do |square, cidx|
square.set_board(new_board) unless square == nil
end
end
new_board
end
###Instructions to play
- Download the latest version of Ruby
- Download the repository and change into its directory
- In your terminal, run the following commands:
gem install bundler
bundle install
ruby lib/game.rb
- To see instructions, press 'i'
- To quit, press 'q'
###Technical Details
- Uses the colorize gem to color the board
- Uses the cursorable library to recognize keypresses
- Uses Ruby