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

Method toString

04Lab-8Puzzle/Board.java:53–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51
52 // string representation of this board
53 public String toString() {
54 StringBuilder s = new StringBuilder();
55 s.append(n + "\n");
56 for (int i = 0; i < n; i++) {
57 for (int j = 0; j < n; j++) {
58 s.append(String.format("%2d ", tiles[i][j]));
59 }
60 s.append("\n");
61 }
62 return s.toString();
63 }
64
65 // board dimension n
66 public int dimension() {

Callers 1

dfsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected