Class: ChessEngine::Rook

Inherits:
Piece
  • Object
show all
Defined in:
lib/chess_engine/piece.rb

Instance Attribute Summary

Attributes inherited from Piece

#color, #moves_count, #symbol

Instance Method Summary collapse

Methods inherited from Piece

#beats_diagonally?, #beats_straight?, #inspect

Constructor Details

#initialize(color) ⇒ Rook

Returns a new instance of Rook.



88
89
90
91
# File 'lib/chess_engine/piece.rb', line 88

def initialize(color)
  super
  @symbol = (@color == :black) ? "\u265C" : "\u2656"
end

Instance Method Details

#movesObject



93
94
95
# File 'lib/chess_engine/piece.rb', line 93

def moves
  [[1, 0], [0, 1], [-1, 0], [0, -1]]
end