Class: Bishop
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 |
# File 'lib/pieces/bishop.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]).abs == (orig[1] - dest[1]).abs end |