Exemplo n.º 1
0
  @Test
  public void testFillSudokuGame() throws Exception {
    Random random = new Random();
    moveThroughGame(game, (i, j) -> Int.fromInteger(random.nextInt(SIZE * SIZE) + 1));

    assertThat(game.isFill(), is(true));
  }
Exemplo n.º 2
0
  @Test
  public void testFindPossibleRowToResolve() throws Exception {
    moveThroughGame(game, (i, j) -> Int.fromInteger((i * SIZE + i / SIZE + j) % (SIZE * SIZE) + 1));
    game.set(8, 1, Int.ZERO);
    game.set(9, 1, Int.ZERO);

    assertThat(game.possibleRowsToResolve(), containsInAnyOrder(8, 9));
  }
Exemplo n.º 3
0
  @Test
  public void testResolveCellBySquare() throws Exception {
    moveThroughGame(game, (i, j) -> Int.fromInteger((i * SIZE + i / SIZE + j) % (SIZE * SIZE) + 1));
    game.set(9, 1, Int.ZERO);
    game.resolveBySquare(3, 1);

    assertThat(game.get(9, 1), is(Int.NINE));
  }