Class: Swint::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/swint/field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s, pos, weight = nil) ⇒ Field

Returns a new instance of Field.



15
16
17
18
# File 'lib/swint/field.rb', line 15

def initialize(s, pos, weight=nil)
	@pos, @state, @weight = pos, s, weight
	@robot = false
end

Instance Attribute Details

#posObject (readonly)

Returns the value of attribute pos.



13
14
15
# File 'lib/swint/field.rb', line 13

def pos
  @pos
end

#robotObject

Returns the value of attribute robot.



12
13
14
# File 'lib/swint/field.rb', line 12

def robot
  @robot
end

#weightObject

Returns the value of attribute weight.



12
13
14
# File 'lib/swint/field.rb', line 12

def weight
  @weight
end

Instance Method Details

#stateObject



20
21
22
# File 'lib/swint/field.rb', line 20

def state
	@robot ? :robot : (@weight ? :object : @state)
end