Class: Chess::Pieces::Rook
- Includes:
- RookMoves
- Defined in:
- lib/chess/pieces/rook.rb
Overview
Rook
Instance Attribute Summary
Attributes inherited from Piece
Instance Method Summary collapse
-
#possible_moves(board) ⇒ Array
all possible_moves of Rook.
Methods included from RookMoves
#east_moves, #north_moves, #south_moves, #west_moves
Methods inherited from Piece
Constructor Details
This class inherits a constructor from Chess::Pieces::Piece
Instance Method Details
#possible_moves(board) ⇒ Array
all possible_moves of Rook
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/chess/pieces/rook.rb', line 66 def possible_moves(board) file = @pos[0] rank = @pos[1] moves = [] moves += north_moves(board, file, rank) moves += south_moves(board, file, rank) moves += west_moves(board, file, rank) moves += east_moves(board, file, rank) moves end |