Class: Checkers::Ruby2D::Piece
- Inherits:
-
Circle
- Object
- Circle
- Checkers::Ruby2D::Piece
- Defined in:
- lib/checkers/ruby2d/piece.rb
Constant Summary collapse
- HUMAN_PIECE_COLOR =
'red'
- HUMAN_KING_COLOR =
'maroon'
- AI_PIECE_COLOR =
'yellow'
- AI_KING_COLOR =
'orange'
Instance Attribute Summary collapse
-
#player ⇒ Object
Returns the value of attribute player.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Piece
constructor
A new instance of Piece.
Constructor Details
#initialize(opts = {}) ⇒ Piece
Returns a new instance of Piece.
13 14 15 16 |
# File 'lib/checkers/ruby2d/piece.rb', line 13 def initialize(opts = {}) @player = HUMAN_PIECES.include?(opts[:piece]) ? :human : :ai super(opts.merge({ color: piece_color(opts[:piece]) })) end |
Instance Attribute Details
#player ⇒ Object
Returns the value of attribute player.
11 12 13 |
# File 'lib/checkers/ruby2d/piece.rb', line 11 def player @player end |