Class: Astar::Node
- Inherits:
-
Object
- Object
- Astar::Node
- Defined in:
- lib/astar/node.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#tile ⇒ Object
readonly
Returns the value of attribute tile.
Instance Method Summary collapse
-
#initialize(tile, destination, parent = nil) ⇒ Node
constructor
A new instance of Node.
- #walkable_neighbours ⇒ Object
- #x ⇒ Object
- #y ⇒ Object
Constructor Details
#initialize(tile, destination, parent = nil) ⇒ Node
Returns a new instance of Node.
4 5 6 7 8 |
# File 'lib/astar/node.rb', line 4 def initialize(tile, destination, parent=nil) @tile = tile @parent = parent @destination = destination end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
3 4 5 |
# File 'lib/astar/node.rb', line 3 def destination @destination end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
3 4 5 |
# File 'lib/astar/node.rb', line 3 def parent @parent end |
#tile ⇒ Object (readonly)
Returns the value of attribute tile.
3 4 5 |
# File 'lib/astar/node.rb', line 3 def tile @tile end |
Instance Method Details
#walkable_neighbours ⇒ Object
10 11 12 |
# File 'lib/astar/node.rb', line 10 def walkable_neighbours @tile.walkable_neighbours end |
#x ⇒ Object
14 15 16 |
# File 'lib/astar/node.rb', line 14 def x @tile.x end |
#y ⇒ Object
18 19 20 |
# File 'lib/astar/node.rb', line 18 def y @tile.y end |