private String getBoardAsString() { StringBuilder builder = new StringBuilder(); for (int row = 0; row < size; row++) { for (int column = 0; column < size; column++) { builder.append(board.isAlive(new Coordinate(column, row)) ? "X" : "."); } if (row < size - 1) { builder.append(NL); } } return builder.toString(); }
@Then("no cell is alive") public void thenNoCellIsAlive() { Assert.assertEquals(0, board.liveCellsCount()); }
@Then("there is $nbOfAliveCells living cells") @Alias("there is $nbOfAliveCells cells alive") public void thenThereIsCellsAlive(int nbOfAliveCells) { Assert.assertEquals(nbOfAliveCells, board.liveCellsCount()); }
@When("we play the first round") public void whenPlayARound() { this.board = new Board(this.size, getInitialStatesAsArray()); board.update(); }