server/app/models/node.rb
def connect_to(other)
        if other.row == self.row - 1
            self.northNeighbor = other
            other.southNeighbor = self
        # self.neighbors[:north] = other
        # other.neighbors[:south] = self
        elsif other.row == self.row + 1
            self.southNeighbor = other
            other.northNeighbor = self
        # self.neighbors[:south] = other
        # other.neighbors[:north] = self
        elsif other.col == self.col + 1
            self.eastNeighbor = other
            other.westNeighbor = self
        # self.neighbors[:east] = other
        # other.neighbors[:west] = self
        elsif other.col == self.col - 1
            self.westNeighbor = other
            other.eastNeighbor = self
        # self.neighbors[:west] = other
        # other.neighbors[:east] = self
        end
        self.save
        other.save
        # Josh.lifesaver
    end
# Connect this node to another node. The other node can only fit
# in one of four cardinal directions from this node: North, South,
# East, or West.
Connect this node to another node. The other node can only fit
in one of four cardinal directions from this node: North, South,
East, or West.
Connect this node to another node . The other node can only fit in one of four cardinal directions from this node : North South East or West .
def connect_to(other)
        if other.row == self.row - 1
            self.northNeighbor = other
            other.southNeighbor = self
        elsif other.row == self.row + 1
            self.southNeighbor = other
            other.northNeighbor = self
        elsif other.col == self.col + 1
            self.eastNeighbor = other
            other.westNeighbor = self
        elsif other.col == self.col - 1
            self.westNeighbor = other
            other.eastNeighbor = self
        end
        self.save
        other.save
    end
def connect_to ( other ) if other . row == self . row - 1 self . northNeighbor = other other . southNeighbor = self elsif other . row == self . row + 1 self . southNeighbor = other other . northNeighbor = self elsif other . col == self . col + 1 self . eastNeighbor = other other . westNeighbor = self elsif other . col == self . col - 1 self . westNeighbor = other other . eastNeighbor = self end self . save other . save end
Connect this node to another node.
Connect this node to another node .
# self.neighbors[:north] = other # other.neighbors[:south] = self # self.neighbors[:south] = other # other.neighbors[:north] = self # self.neighbors[:east] = other # other.neighbors[:west] = self # self.neighbors[:west] = other # other.neighbors[:east] = self # Josh.lifesaver
other