Class: ChessEngine::Pawn
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
Attributes inherited from Piece
Instance Method Summary collapse
-
#initialize(color) ⇒ Pawn
constructor
A new instance of Pawn.
Methods inherited from Piece
#beats_diagonally?, #beats_straight?, #inspect
Constructor Details
#initialize(color) ⇒ Pawn
Returns a new instance of Pawn.
68 69 70 71 72 |
# File 'lib/chess_engine/piece.rb', line 68 def initialize(color) super @symbol = (@color == :black) ? "\u265F" : "\u2659" @direction = (@color == :white) ? 1 : -1 end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
66 67 68 |
# File 'lib/chess_engine/piece.rb', line 66 def direction @direction end |