Class: RobotsFindKitten::Thing

Inherits:
Object
  • Object
show all
Defined in:
lib/robotsfindkitten/thing.rb

Direct Known Subclasses

Kitten, NKI, Robot

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeThing

Returns a new instance of Thing.



9
10
11
12
13
14
15
# File 'lib/robotsfindkitten/thing.rb', line 9

def initialize
  symbol = '#'
  symbol = ALPHABET.sample while symbol == '#'
  @symbol = symbol
  @x = rand(WIDTH)
  @y = rand(HEIGHT)
end

Instance Attribute Details

#symbolObject (readonly)

Returns the value of attribute symbol.



7
8
9
# File 'lib/robotsfindkitten/thing.rb', line 7

def symbol
  @symbol
end

#xObject (readonly)

Returns the value of attribute x.



7
8
9
# File 'lib/robotsfindkitten/thing.rb', line 7

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



7
8
9
# File 'lib/robotsfindkitten/thing.rb', line 7

def y
  @y
end