import 'package:awale/models/game/game.dart'; class RobotPlayer { static pickCell(Game currentGame) { List<int> allowedMoves = []; for (int cellIndex = 0; cellIndex < currentGame.board.cells.length; cellIndex++) { if (currentGame.isCurrentPlayerHouse(cellIndex) && currentGame.isMoveAllowed(cellIndex)) { allowedMoves.add(cellIndex); } } allowedMoves.shuffle(); final int pickedCellIndex = allowedMoves[0]; return pickedCellIndex; } }