Class: Rook
Class Method Summary collapse
Methods inherited from Piece
capturable?, destination_occupied?, obstructed?
Class Method Details
.move_is_valid?(orig, dest, board) ⇒ Boolean
6 7 8 9 10 11 12 13 14 |
# File 'lib/pieces/rook.rb', line 6 def self.move_is_valid?(orig, dest, board) not_obstructed = !obstructed?(orig, dest, board) not_obstructed && (!destination_occupied?(dest, board) || capturable?(orig, dest, board)) && ( orig[0] == dest[0] || orig[1] == dest[1] ) end |