Class: ChessEngine::Elephant

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) ⇒ Elephant

Returns a new instance of Elephant.



31
32
33
34
# File 'lib/chess_engine/piece.rb', line 31

def initialize(color)
  super
  @symbol = (@color == :black) ? "\u25B2" : "\u25B3"
end

Instance Method Details

#movesObject



36
37
38
# File 'lib/chess_engine/piece.rb', line 36

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