Example #1
0
        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);
        }