Class: Chess::Rook
- Inherits:
-
BoardgameEngine::Piece
- Object
- BoardgameEngine::Piece
- Chess::Rook
- Defined in:
- lib/boardgame_engine/chess.rb
Instance Attribute Summary
Attributes inherited from BoardgameEngine::Piece
Instance Method Summary collapse
-
#initialize(owner) ⇒ Rook
constructor
A new instance of Rook.
- #valid_move?(start_location, end_location, board) ⇒ Boolean
Methods inherited from BoardgameEngine::Piece
Constructor Details
#initialize(owner) ⇒ Rook
Returns a new instance of Rook.
168 169 170 |
# File 'lib/boardgame_engine/chess.rb', line 168 def initialize(owner) super(owner, 'R') end |
Instance Method Details
#valid_move?(start_location, end_location, board) ⇒ Boolean
172 173 174 175 176 177 178 |
# File 'lib/boardgame_engine/chess.rb', line 172 def valid_move?(start_location, end_location, board) row, col = start_location end_row, end_col = end_location board.clear_horz_path?(row, col, end_row, end_col, board) \ || board.clear_vert_path?(row, col, end_row, end_col, board) end |