Class: JustChess::Rook
- Defined in:
- lib/just_chess/pieces/rook.rb
Overview
Rook
The piece that moves any number of squares orthogonally.
Instance Attribute Summary
Attributes inherited from Piece
Instance Method Summary collapse
-
#destinations(square, game_state) ⇒ SquareSet
All the squares that the piece can move to and/or capture.
Methods inherited from Piece
#as_json, #has_not_moved?, #initialize, #moved
Constructor Details
This class inherits a constructor from JustChess::Piece
Instance Method Details
#destinations(square, game_state) ⇒ SquareSet
All the squares that the piece can move to and/or capture.
19 20 21 |
# File 'lib/just_chess/pieces/rook.rb', line 19 def destinations(square, game_state) game_state.squares.orthogonal(square).unoccupied_or_occupied_by_opponent(player_number).unblocked(square, game_state.squares) end |