예제 #1
0
        public void SetupNeuralTraining()
        {
            databaseCache.InitialiseRAMDatabase();

            neuralTrainingOutputFields.AddRange(new List <Control> {
                aiSuggestion, aiData,
                raiseToCallAmount, raiseToStealAmount, currentPlayerId
            });

            neuralPlayerActionLog.AddRange(new List <Control> {
                player1NoLog, player2NoLog, player3NoLog, player4NoLog,
                player5NoLog, player6NoLog, player7NoLog, player8NoLog, player9NoLog
            });


            //Create the AISelection[]
            List <AISelection> aiSelection = new List <AISelection>();

            for (int i = 0; i < 9; i++)
            {
                aiSelection.Add(new AISelection(AIGeneration.NeuralV4, "FixedNeuralPlayers\\neuralV4_Marc.eNN"));
            }

            long[]   newPlayerIds        = PokerHelper.CreateOpponentPlayers(aiSelection.ToArray(), false, 1);
            string[] selectedPlayerNames = new string[newPlayerIds.Length];
            for (int i = 0; i < newPlayerIds.Length; i++)
            {
                selectedPlayerNames[i] = databaseQueries.convertToPlayerNameFromId(newPlayerIds[i]);
            }

            neuralPlayerNames.AddRange(selectedPlayerNames);
        }
예제 #2
0
        private void playPoker_Click(object sender, EventArgs e)
        {
            if (playPoker.Text == "Play Poker")
            {
                PokerClients client             = PokerClients.HumanVsBots;
                int          actionPauseTime    = int.Parse(this.actionPause.Text);
                byte         minNumTablePlayers = 2;

                AISelection[] selectedPlayers = this.aiSelectionControl1.AISelection();

                //Select the playerId's for all of the bot players
                if (selectedPlayers.Length > 10)
                {
                    throw new Exception("A maximum of 10 players is allowed.");
                }

                databaseCache.InitialiseRAMDatabase();

                long[]   newPlayerIds        = PokerHelper.CreateOpponentPlayers(selectedPlayers, obfuscateBots.Checked, (short)client);
                string[] selectedPlayerNames = new string[newPlayerIds.Length];
                for (int i = 0; i < newPlayerIds.Length; i++)
                {
                    selectedPlayerNames[i] = databaseQueries.convertToPlayerNameFromId(newPlayerIds[i]);
                }

                //Shuffle the player list so we have absolutly no idea who is who.
                selectedPlayerNames = shuffleList(selectedPlayerNames.ToList()).ToArray();
                clientCache         = new databaseCacheClient((short)client, this.gameName.Text, decimal.Parse(this.littleBlind.Text), decimal.Parse(this.bigBlind.Text), decimal.Parse(this.startingStack.Text), 10, HandDataSource.PlayingTest);
                CacheMonitor.CacheMonitor cacheMonitor = new PokerBot.CacheMonitor.CacheMonitor(clientCache, !showAllCards.Checked);

                pokerGame = new BotVsHumanPokerGame(PokerGameType.BotVsHuman, clientCache, minNumTablePlayers, selectedPlayerNames, Decimal.Parse(startingStack.Text), 0, Int16.Parse(actionPause.Text), cacheMonitor);
                pokerGame.startGameTask();
                pokerGame.ShutdownAIOnFinish();

                cacheMonitor.Show();
                playPoker.Text = "End Game";
            }
            else
            {
                playPoker.Text    = "Ending Game";
                playPoker.Enabled = false;

                pokerGame.ShutdownAIOnFinish();
                pokerGame.EndGame = true;

                playPoker.Text    = "Play Poker";
                playPoker.Enabled = true;
            }
        }