Class: Chess::Queen

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) ⇒ Queen

Returns a new instance of Queen.



156
157
158
# File 'lib/boardgame_engine/chess.rb', line 156

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

Instance Method Details

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

Returns:

  • (Boolean)


160
161
162
163
164
# File 'lib/boardgame_engine/chess.rb', line 160

def valid_move?(start_location, end_location, board)
  board.clear_diag_path?(start_location, end_location) \
  || board.clear_horz_path?(start_location, end_location) \
  || board.clear_vert_path?(start_location, end_location)
end