class EmptySpace

Attributes

color[R]

Public Class Methods

new(x,y) click to toggle source
# File lib/space.rb, line 4
def initialize(x,y)
  @x, @y = x, y
  @color = :none
end

Public Instance Methods

empty?() click to toggle source
# File lib/space.rb, line 17
def empty?
  color == :none 
end
enemy_of?(piece) click to toggle source
# File lib/space.rb, line 21
def enemy_of?(piece)
  false
end
friend_of?(piece) click to toggle source
# File lib/space.rb, line 25
def friend_of?(piece)
  false
end
place_on(board) click to toggle source
# File lib/space.rb, line 9
def place_on(board)
  board.board[@y][@x] = self
end
remove_from(board) click to toggle source
# File lib/space.rb, line 13
def remove_from(board)
  board.board[@y][@x] = EmptySpace.new(@x, @y)
end
to_coord() click to toggle source
# File lib/space.rb, line 29
def to_coord
  [@x, @y]
end
to_s() click to toggle source
# File lib/space.rb, line 33
def to_s
  (@x + @y) % 2 == 0 ? "__" : "##"
end