Class: ChessEngine::King
Instance Attribute Summary
Attributes inherited from Piece
Instance Method Summary collapse
-
#initialize(color) ⇒ King
constructor
A new instance of King.
- #moves ⇒ Object
Methods inherited from Piece
#beats_diagonally?, #beats_straight?, #inspect
Constructor Details
#initialize(color) ⇒ King
Returns a new instance of King.
42 43 44 45 |
# File 'lib/chess_engine/piece.rb', line 42 def initialize(color) super @symbol = (@color == :black) ? "\u265A" : "\u2654" end |
Instance Method Details
#moves ⇒ Object
47 48 49 50 |
# File 'lib/chess_engine/piece.rb', line 47 def moves [[0, 1], [0, -1], [1, 0], [-1, 0], [1, 1], [1, -1], [-1, 1], [-1, -1]] end |