示例#1
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;
            }
        }
示例#2
0
        /// <summary>
        /// Starts the neural training game
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void startNeuralTraining_Click(object sender, EventArgs e)
        {
            if (startNeuralTraining.Text == "Start Game")
            {
                SetupNeuralTraining();

                clientCache = new databaseCacheClient(short.Parse(clientId.Text), this.gameName.Text, decimal.Parse(this.littleBlind.Text), decimal.Parse(this.bigBlind.Text), decimal.Parse(this.startingStack.Text), 9, HandDataSource.NeuralTraining);
                pokerGame   = new ManualNeuralTrainingPokerGame(PokerGameType.ManualNeuralTraining, clientCache, 0, neuralPlayerNames.ToArray(), Decimal.Parse(startingStack.Text), 0, 0, neuralTrainingOutputFields, neuralPlayerActionLog);
                pokerGame.startGameTask();

                viewNerualTrainingTable.Enabled = true;
                startNeuralTraining.Text        = "End Game";
            }
            else
            {
                startNeuralTraining.Text    = "Ending Game";
                startNeuralTraining.Enabled = false;

                pokerGame.EndGame = true;

                startNeuralTraining.Text    = "Start Game";
                startNeuralTraining.Enabled = true;
            }
        }
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(PokerGameBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_GetPokerHand, serviceImpl.GetPokerHand).Build());
 }
 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the  service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, PokerGameBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_GetPokerHand, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GrpcServer.RequestHandModel, global::GrpcServer.HandResponseModel>(serviceImpl.GetPokerHand));
 }