I’ll assume you’re looking for a for an 8×8 network — likely a grid network (like a torus, mesh, or crossbar) used in telecom, compute fabrics, or routing.
path = [] x, y = src tx, ty = dst
# move in Y direction step_y = 1 if ty > y else -1 while y != ty: y += step_y if self.nodes[(x, y)] != "up": return None, f"Node (x,y) is down — path blocked" path.append((x, y)) 8x8 network utility
def route_packet(self, src, dst): """Simple dimension-order routing (X then Y)""" if src not in self.nodes or dst not in self.nodes: return None, "Source or destination out of range" if self.nodes[src] != "up" or self.nodes[dst] != "up": return None, "Source or destination down"
return path, "Success"
> down 4,0 Node (4,0) is now down
def set_node_state(self, node, state): if node in self.nodes and state in ["up", "down"]: self.nodes[node] = state return True return False I’ll assume you’re looking for a for an
> send 0,0 7,7 Path: (0,0) -> (1,0) -> (2,0) -> (3,0) -> (4,0) -> (5,0) -> (6,0) -> (7,0) -> (7,1) -> (7,2) -> (7,3) -> (7,4) -> (7,5) -> (7,6) -> (7,7) Status: Success