Пример #1
0
 //Initialize structures in a thread
 private void Initialize()
 {
     createStructures();
     while (!initializationFinished())
     {
         ;
     }
     internalPhonemePlaybackCallback  = new FinishedPlayingPhonemeCallback(CallbackHandlerPhoneme);
     internalSentencePlaybackCallback = new FinishedPlayingSentenceCallback(CallbackHandlerSentence);
     sentencePlayer = new SentencePlayer();
     sequencePlayer = new PhonemeSequencePlayer();
     matrixPlayer   = new MatrixPlayer();
     Initialized    = true;
 }
Пример #2
0
        public void AddPlayer(Config playerConfig, int playerNumber)
        {
            switch (playerConfig.type)
            {
            case "Human":
                if (playerNumber == 1)
                {
                    Player1 = new HumanPlayer.HumanPlayer(playerNumber, Size, playerConfig);
                }
                else
                {
                    Player2 = new HumanPlayer.HumanPlayer(playerNumber, Size, playerConfig);
                }

                break;

            case "Dozer AI":
                if (playerNumber == 1)
                {
                    Player1 = new DozerPlayer.DozerPlayer(playerNumber, Size, playerConfig);
                }
                else
                {
                    Player2 = new DozerPlayer.DozerPlayer(playerNumber, Size, playerConfig);
                }

                break;

            case "Minimax Matrix AI":
                if (playerNumber == 1)
                {
                    Player1 = new MatrixPlayer(playerNumber, Size, playerConfig);
                }
                else
                {
                    Player2 = new MatrixPlayer(playerNumber, Size, playerConfig);
                }

                break;

            case "Minimax List AI":
                if (playerNumber == 1)
                {
                    Player1 = new ListPlayer(playerNumber, Size, playerConfig);
                }
                else
                {
                    Player2 = new ListPlayer(playerNumber, Size, playerConfig);
                }

                break;

            case "Replay AI":
                if (playerNumber == 1)
                {
                    Player1 = new Playback(playerNumber, Size, playerConfig);
                }
                else
                {
                    Player2 = new Playback(playerNumber, Size, playerConfig);
                }

                break;

            case "Negamax AI":
                if (playerNumber == 1)
                {
                    Player1 = new Negamax(playerNumber, Size, playerConfig);
                }
                else
                {
                    Player2 = new Negamax(playerNumber, Size, playerConfig);
                }

                break;

            case "MonteCarlo":
                if (playerNumber == 1)
                {
                    Player1 = new MonteCarlo(playerNumber, Size, playerConfig);
                }
                else
                {
                    Player2 = new MonteCarlo(playerNumber, Size, playerConfig);
                }

                break;

            default:
                if (playerNumber == 1)
                {
                    Player1 = new RandomPlayer.RandomPlayer(playerNumber, Size, null);
                }
                else
                {
                    Player2 = new RandomPlayer.RandomPlayer(playerNumber, Size, null);
                }
                break;
            }
        }