diff --git a/app/src/main/java/com/acme/tictactoe/viewmodel/TicTacToeViewModel.java b/app/src/main/java/com/acme/tictactoe/viewmodel/TicTacToeViewModel.java index d37b334..aa1ff5e 100644 --- a/app/src/main/java/com/acme/tictactoe/viewmodel/TicTacToeViewModel.java +++ b/app/src/main/java/com/acme/tictactoe/viewmodel/TicTacToeViewModel.java @@ -44,9 +44,12 @@ public void onResetSelected() { } public void onClickedCellAt(int row, int col) { - Player playerThatMoved = model.mark(row, col); - cells.put("" + row + col, playerThatMoved == null ? null : playerThatMoved.toString()); - winner.set(model.getWinner() == null ? null : model.getWinner().toString()); + if (!cells.containsKey("" + row + col)) { + Player playerThatMoved = model.mark(row, col); + cells.put("" + row + col, playerThatMoved == null ? null : playerThatMoved.toString()); + winner.set(model.getWinner() == null ? null : model.getWinner().toString()); + } + } }