class Node

Represents a node in the grid.

Attributes

walkable[R]

Gets whether the node is walkable.

x[R]

Gets the x coordinate in the grid.

y[R]

Gets the y coordinate in the grid.

Public Class Methods

new(x, y, walkable = true) click to toggle source

Creates a node.

# File lib/pathfinding/core/node.rb, line 25
def initialize(x, y, walkable = true)
  @x = x
  @y = y
  @walkable = walkable
end

Public Instance Methods

to_s() click to toggle source

Makes the string format of a node.

# File lib/pathfinding/core/node.rb, line 34
def to_s
  "(#{@x}, #{@y})"
end