package main import "fmt" type coords struct { X int Y int } func newCoords(x, y int) coords { return coords{X: x, Y: y} } // node represents a single point on the graph type node struct { cost int distance int directionX int directionY int coords index int } func newNode(cost, distance, directionX, directionY, x, y int) *node { c := newCoords(x, y) return &node{cost: cost, distance: distance, directionX: directionX, directionY: directionY, coords: c} } // String implements the fmt.Stringer interface func (n node) String() string { return fmt.Sprintf("%d%d%d%v", n.distance, n.directionX, n.directionY, n.coords) }