Class: Chess::Bishop

Inherits:
BoardgameEngine::Piece show all
Defined in:
lib/boardgame_engine/chess.rb

Instance Attribute Summary

Attributes inherited from BoardgameEngine::Piece

#owner, #status

Instance Method Summary collapse

Methods inherited from BoardgameEngine::Piece

#kill, #to_s

Constructor Details

#initialize(owner) ⇒ Bishop

Returns a new instance of Bishop.



182
183
184
# File 'lib/boardgame_engine/chess.rb', line 182

def initialize(owner)
  super(owner, 'B')
end

Instance Method Details

#valid_move?(start_location, end_location, board) ⇒ Boolean

Returns:

  • (Boolean)


186
187
188
189
190
191
# File 'lib/boardgame_engine/chess.rb', line 186

def valid_move?(start_location, end_location, board)
  row, col = start_location
  end_row, end_col = end_location

  board.clear_diag_path?(row, col, end_row, end_col, board)
end