public ZhedStep zhedStep; //Zhed Step that created this node public Node(ZhedBoard board, Node parent, ZhedStep zhedStep, int value) { this.board = board; this.parent = parent; this.zhedStep = zhedStep; this.value = value; this.height = 0; while (parent != null) { this.height += 1; parent = parent.parent; } }
public ZhedStep zhedStep; //Zhed Step that created this node public Node(ZhedBoard board, Node parent, ZhedStep zhedStep, int value, int cost) { this.board = board; this.parent = parent; this.zhedStep = zhedStep; this.value = value; if (parent == null) { this.cost = cost; } else { this.cost = parent.cost + cost; } while (parent != null) { this.height += 1; parent = parent.parent; } }