This is the first win condition requirement for players.
In fact, this requires one single check. If the current inserted disc connects other three discs in a vertical line, the current player wins the game:
@Test public void when4VerticalDiscsAreConnectedThenPlayerWins() { for (int row = 0; row < 3; row++) { tested.putDiscInColumn(1); // R tested.putDiscInColumn(2); // G } assertThat(tested.getWinner(), isEmptyString()); tested.putDiscInColumn(1); // R assertThat(tested.getWinner(), is("R")); }
There are a couple of changes to the putDiscInColumn method. Also, a new method called ...