()
| 56 | } |
| 57 | |
| 58 | public boolean playRandom() { |
| 59 | Board board = Game.getInstance().getBoard(); |
| 60 | shuffle(); |
| 61 | lastPlayer = lastPlayer == players[0] ? players[1] : players[0]; |
| 62 | String color = lastPlayer.getColor().toString(); |
| 63 | for (int i = 0; i < remainingMoves.size(); i++) { |
| 64 | Location loc = remainingMoves.get(i); |
| 65 | boolean success = lastPlayer.playPiece(loc.getRow(), loc.getColumn()); |
| 66 | |
| 67 | if (success) { |
| 68 | System.out.println("Success: " + color + " move at (" + loc.getRow() + ", " + loc.getColumn() + ")"); |
| 69 | board.printBoard(); |
| 70 | printScores(); |
| 71 | return true; |
| 72 | } |
| 73 | } |
| 74 | System.out.println("Game over. No moves found for " + color); |
| 75 | return false; |
| 76 | } |
| 77 | |
| 78 | public boolean isOver() { |
| 79 | if (players[0].getScore() == 0 || players[1].getScore() == 0) { |
no test coverage detected