MCPcopy Create free account
hub / github.com/careercup/ctci / main

Method main

java/Chapter 17/Question17_2/QuestionB.java:207–228  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

205 }
206
207 public static void main(String[] args) {
208 for (int k = 0; k < 100; k++) {
209 int N = 3;
210 int[][] board_t = AssortedMethods.randomMatrix(N, N, 0, 2);
211 Piece[][] board = new Piece[N][N];
212 for (int i = 0; i < N; i++) {
213 for (int j = 0; j < N; j++) {
214 board[i][j] = convertIntToPiece(board_t[i][j]);
215 }
216 }
217 //AssortedMethods.printMatrix(board_t);
218 Piece p1 = hasWon1(board);
219 Piece p2 = hasWon2(board);
220 Piece p3 = hasWon3(board);
221 Piece p4 = hasWon4(board);
222 //System.out.println(p + " " + p2);
223 if (p1 != p2 || p2 != p3 || p3 != p4) {
224 System.out.println(p1 + " " + p2 + " " + p3 + " " + p4);
225 AssortedMethods.printMatrix(board_t);
226 }
227 }
228 }
229
230}

Callers

nothing calls this directly

Calls 7

randomMatrixMethod · 0.95
convertIntToPieceMethod · 0.95
hasWon1Method · 0.95
hasWon2Method · 0.95
hasWon3Method · 0.95
hasWon4Method · 0.95
printMatrixMethod · 0.95

Tested by

no test coverage detected