Class: Swint::Field
- Inherits:
-
Object
- Object
- Swint::Field
- Defined in:
- lib/swint/field.rb
Instance Attribute Summary collapse
-
#pos ⇒ Object
readonly
Returns the value of attribute pos.
-
#robot ⇒ Object
Returns the value of attribute robot.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(s, pos, weight = nil) ⇒ Field
constructor
A new instance of Field.
- #state ⇒ Object
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
#pos ⇒ Object (readonly)
Returns the value of attribute pos.
13 14 15 |
# File 'lib/swint/field.rb', line 13 def pos @pos end |
#robot ⇒ Object
Returns the value of attribute robot.
12 13 14 |
# File 'lib/swint/field.rb', line 12 def robot @robot end |
#weight ⇒ Object
Returns the value of attribute weight.
12 13 14 |
# File 'lib/swint/field.rb', line 12 def weight @weight end |
Instance Method Details
#state ⇒ Object
20 21 22 |
# File 'lib/swint/field.rb', line 20 def state @robot ? :robot : (@weight ? :object : @state) end |