Ejemplo n.º 1
0
    //fonction pour changer l'agent du joueur 1
    public void ChangeAgent2()
    {
        switch (choix2Value)
        {
        case listeChoix.HUMAN:

            textButtonChoix2.text = "RANDOM";
            choix2Value           = listeChoix.RANDOM;
            break;

        case listeChoix.RANDOM:

            textButtonChoix2.text = "RANDOM ROLLOUT";
            choix2Value           = listeChoix.RANDOMROLLOUT;
            break;

        case listeChoix.RANDOMROLLOUT:

            textButtonChoix2.text = "DIJKSTRA";
            choix2Value           = listeChoix.DIJKSTRA;
            break;

        case listeChoix.DIJKSTRA:

            textButtonChoix2.text = "MCTS";
            choix2Value           = listeChoix.MCTS;
            break;

        case listeChoix.MCTS:

            textButtonChoix2.text = "HUMAN";
            choix2Value           = listeChoix.HUMAN;
            break;

        default:

            textButtonChoix2.text = "HUMAN";
            choix1Value           = listeChoix.HUMAN;
            break;
        }
    }
Ejemplo n.º 2
0
    //Fonction pour lancer la partie via l'interface
    public void StartGame(listeChoix choix1, listeChoix choix2)
    {
        //Initialisation des règles
        Rules.Init(ref gs);

        //instanciation des éléments graphiques
        PlayerView1 = Instantiate(PlayerPrefab1).GetComponent <Transform>();
        PlayerView2 = Instantiate(PlayerPrefab2).GetComponent <Transform>();
        frisbeeView = Instantiate(FrisbeePrefab).GetComponent <Transform>();

        //création des agents en fonction des choix effectués sur l'interface
        switch (choix1)
        {
        case listeChoix.HUMAN:

            agentJ1 = new HumanPlayerAgent(0);
            break;

        case listeChoix.RANDOM:

            agentJ1 = new RandomAgent {
                rdm = new Unity.Mathematics.Random((uint)UnityEngine.Random.Range(0, 100))
            };
            break;

        case listeChoix.RANDOMROLLOUT:

            agentJ1 = new RandomRolloutAgent(0);
            break;

        case listeChoix.DIJKSTRA:

            agentJ1 = new AAgentScript(0);
            break;

        case listeChoix.MCTS:

            Debug.Log("Agent pas implémenté");
            break;

        default:

            Debug.Log("Agent pas implémenté");
            break;
        }

        switch (choix2)
        {
        case listeChoix.HUMAN:

            agentJ2 = new HumanPlayerAgent(1);
            break;

        case listeChoix.RANDOM:

            agentJ2 = new RandomAgent
            {
                rdm = new Unity.Mathematics.Random((uint)UnityEngine.Random.Range(0, 100))
            };
            break;

        case listeChoix.RANDOMROLLOUT:

            agentJ2 = new RandomRolloutAgent(1);
            break;

        case listeChoix.DIJKSTRA:

            agentJ2 = new AAgentScript(1);
            break;

        case listeChoix.MCTS:

            Debug.Log("Agent pas implémenté");
            break;

        default:

            Debug.Log("Agent pas implémenté");
            break;
        }

        gameStarted = true;
        StartCoroutine(TimerGame(gs.dureePartie));
    }