コード例 #1
0
ファイル: Game.cs プロジェクト: 999eagle/tictactoe
        BasePlayer PlayerTurn(BasePlayer player, BasePlayer opponent, bool printMove, bool printBoard, List <int[]> features)
        {
            int move = player.Move(Board);

            if (printMove)
            {
                Console.WriteLine($"Move of {player}: {move}");
            }
            if (!Board.IsValidMove(move))
            {
                return(opponent);
            }
            Board[move] = player.Id;
            features?.Add(Board.CalculateFeatures());
            if (printBoard)
            {
                Console.WriteLine(Board);
            }
            if (Board.IsWinningState(Board.Score(player)))
            {
                return(player);
            }
            return(null);
        }