From 78817766f96672cd07d1489c46a4c260b7dca614 Mon Sep 17 00:00:00 2001 From: olliehcrook <53153427+olliehcrook@users.noreply.github.com> Date: Sun, 7 Mar 2021 17:44:55 +0000 Subject: [PATCH] Update Board.java Originally uploaded old version that didn't check for draws, just noticed .. my bad --- 89 Tic-Tac-Toe/java/src/Board.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/89 Tic-Tac-Toe/java/src/Board.java b/89 Tic-Tac-Toe/java/src/Board.java index 091f7bb2..834c91ca 100644 --- a/89 Tic-Tac-Toe/java/src/Board.java +++ b/89 Tic-Tac-Toe/java/src/Board.java @@ -75,7 +75,15 @@ public class Board { return false; } - + public boolean checkDraw() { + if(this.checkWin('X') == false && this.checkWin('O') == false) { + if(this.getBoardValue(1) != ' ' && this.getBoardValue(2) != ' ' && this.getBoardValue(3) != ' ' && this.getBoardValue(4) != ' ' && this.getBoardValue(5) != ' ' && this.getBoardValue(6) != ' ' && this.getBoardValue(7) != ' ' && this.getBoardValue(8) != ' ' && this.getBoardValue(9) != ' ' ) { + return true; + } + } + + return false; + } /** * Reset the board */ @@ -85,4 +93,4 @@ public class Board { } } -} \ No newline at end of file +}