Class: JustChess::Rook
Overview
Rook
The piece that moves any number of squares orthogonally.
Instance Attribute Summary
Attributes inherited from Piece
#has_moved, #id, #player_number
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, #can_move?, #capture_squares, #has_not_moved?, #initialize, #move_squares, #moved, #opponent, #potential_capture_squares, #type
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 |