Class: BlackPiece
- Inherits:
-
Piece
- Object
- EmptySpace
- Piece
- BlackPiece
- Defined in:
- lib/piece.rb
Direct Known Subclasses
BlackBishop, BlackKing, BlackKnight, BlackPawn, BlackQueen, BlackRook
Instance Attribute Summary
Attributes inherited from EmptySpace
Instance Method Summary collapse
- #enemy_of?(piece) ⇒ Boolean
- #friend_of?(piece) ⇒ Boolean
-
#initialize(x, y) ⇒ BlackPiece
constructor
A new instance of BlackPiece.
Methods inherited from EmptySpace
#empty?, #place_on, #remove_from, #to_coord, #to_s
Constructor Details
#initialize(x, y) ⇒ BlackPiece
Returns a new instance of BlackPiece.
45 46 47 48 |
# File 'lib/piece.rb', line 45 def initialize(x,y) super @color = :black end |
Instance Method Details
#enemy_of?(piece) ⇒ Boolean
50 51 52 |
# File 'lib/piece.rb', line 50 def enemy_of?(piece) piece.color == :white end |
#friend_of?(piece) ⇒ Boolean
54 55 56 |
# File 'lib/piece.rb', line 54 def friend_of?(piece) piece.color == color end |