MCPcopy Create free account
hub / github.com/MolinDeng/Princeton-algs4 / solution

Method solution

04Lab-8Puzzle/Solver.java:77–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75
76 // sequence of boards in a shortest solution; null if unsolvable
77 public Iterable<Board> solution() {
78 if (!solvable) return null;
79 Stack<Board> p = new Stack<>();
80 Node node = goal;
81 while (node != null) {
82 p.push(node.board);
83 node = node.prev;
84 }
85 return p;
86 }
87
88 public static void main(String[] args) {
89 // create initial board from file

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected