private void AILogic(Game game) { int bestRow = 0; int bestColumn = 0; int bestScore = 0; for (int row = 0; row < 8; row++) { for (int column = 0; column < 8; column++) { if (game.rulesEngine.isMoveLegal(row, column, _color)) { int tempScore = game.rulesEngine.aiTileTurningCounter(row, column, _color); if (tempScore > bestScore) { bestScore = tempScore; bestRow = row; bestColumn = column; } } } } if (bestScore > 1) { game.initateMove(bestRow, bestColumn); } else { game.rulesEngine.forfeitRound(); } }
public async override void doThings(Game game) { await Task.Delay(260); if (_tilesRemaining > 0) { AILogic(game); } }
public MainWindow() { InitializeComponent(); rulesEngine = new RulesEngine(); game = new Game(rulesEngine); rulesEngine._board.onBoardChange += onBoardChange; rulesEngine.onRoundFinished += game.changeCurrentPlayer; rulesEngine.onMoveFinished += game.allowMovesAgain; rulesEngine.onMoveFeedback += textChange; restartButton.Click += new RoutedEventHandler(restartGame); game.playerChange += textChange; rulesEngine.onWin += textChange; rulesEngine.onWinState += game.setWinState; rulesEngine.linq.onXMLChanged += onBoardChange; choosePlayers(); }
public abstract void doThings(Game game);
public override void doThings(Game game) { }