Class: BlackPiece

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

Instance Attribute Summary

Attributes inherited from EmptySpace

#color

Instance Method Summary collapse

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

Returns:

  • (Boolean)


50
51
52
# File 'lib/piece.rb', line 50

def enemy_of?(piece)
  piece.color == :white
end

#friend_of?(piece) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/piece.rb', line 54

def friend_of?(piece)
  piece.color == color
end