March 2018
Intermediate to advanced
324 pages
8h 30m
English
The last requirement is the last win condition. It is pretty similar to the last two; in this case, in a diagonal direction.
This is a possible implementation for this last requirement. The code is very similar to the other win conditions because the same statement must be fulfilled:
... private void checkWinCondition(int col, int row) { ... // Diagonal checks int startOffset = Math.min(col, row); int column = col - startOffset, auxRow = row - startOffset; stringJoiner = new StringJoiner(""); do { stringJoiner.add(board[column++][auxRow++].toString()); } while (column < COLUMNS && ...Read now
Unlock full access