Exemplo n.º 1
0
        public void Run()
        {
            _register.LoadPolicyFiles();

            _output.PrintLine("Players:");
            foreach (var player in _register.AvailablePlayers())
            {
                _output.PrintLine($"  {player}");
            }

            _output.PrintLine("");
            _output.PrintLine("Learning agents:");
            foreach (var agent in _agentRegister.AvailableAgents())
            {
                _output.PrintLine($"  {agent}");
            }
        }
Exemplo n.º 2
0
        public void Run(string agentName, string opponentName, int?numGamesLimit = null)
        {
            var agent = _agentRegister.GetAgentByName(agentName, BoardTile.X);

            _playerRegister.LoadPolicyFiles();

            if (!_playerRegister.TryFindPlayer(opponentName, BoardTile.O, out var opponent))
            {
                _userOutput.PrintLine($"Invalid opponent '{opponentName}'");
                return;
            }

            agent.Train(opponent !, numGamesLimit);
            agent.SaveTrainedValues(agentName, $"{agentName}.agent.json");

            _userOutput.PrintLine($"Trained agent '{agentName}' against '{opponentName}'");
        }
Exemplo n.º 3
0
        public void Run(string player1Name, string player2Name, int numGames = 1)
        {
            _register.LoadPolicyFiles();

            if (!TryFindPlayer(player1Name, BoardTile.X, out var player1))
            {
                _userOutput.PrintLine($"Invalid player '{player1Name}'");
                return;
            }
            if (!TryFindPlayer(player2Name, BoardTile.O, out var player2))
            {
                _userOutput.PrintLine($"Invalid player '{player2Name}'");
                return;
            }

            if (numGames <= 5)
            {
                RunInteractiveGames(numGames, player1 !, player2 !);
            }
            else
            {
                RunHeadless(numGames, player1 !, player2 !);
            }
        }