Class: ChessEngine::Queen

Inherits:
Piece
  • Object
show all
Defined in:
lib/chess_engine/piece.rb

Instance Attribute Summary

Attributes inherited from Piece

#color, #moves_count, #symbol

Instance Method Summary collapse

Methods inherited from Piece

#beats_diagonally?, #beats_straight?, #inspect

Constructor Details

#initialize(color) ⇒ Queen

Returns a new instance of Queen.



76
77
78
79
# File 'lib/chess_engine/piece.rb', line 76

def initialize(color)
  super
  @symbol = (@color == :black) ? "\u265B" : "\u2655"
end

Instance Method Details

#movesObject



81
82
83
84
# File 'lib/chess_engine/piece.rb', line 81

def moves
  [[0, 1], [0, -1], [1, 0], [-1, 0],
  [1, 1], [1, -1], [-1, 1], [-1, -1]]
end