Ejemplo n.º 1
0
        public Heads_Up_Trainer()
        {
            game = new Game();
            data = new GameData();

            InitializeComponent();
            buttonFold.Hide();
            buttonAllIn.Hide();

            playerMe.Stack = "";
            playerMe.Bets = 0;
            playerMe.Dealer = false;
            playerOpp.Stack = "";
            playerOpp.Bets = 0;
            playerOpp.Dealer = false;
            playerMe.card1 = myCard1;
            playerMe.card2 = myCard2;
            playerOpp.card1 = oppCard1;
            playerOpp.card2 = oppCard2;
            playerMe.showCards(false);
            playerOpp.showCards(false);

            pictureBoxBoard1.Hide();
            pictureBoxBoard2.Hide();
            pictureBoxBoard3.Hide();
            pictureBoxBoard4.Hide();
            pictureBoxBoard5.Hide();

            labelWinner.Hide();
            timerStart.Enabled = true;
        }
Ejemplo n.º 2
0
        // näiden korttien perusteella määritellään ensimmäisen pelin button
        public void getNewGame(GameData data)
        {
            shuffle();
            data.reset();

            int[] stacks = { 0, 0 };
            if (button % 2 == ME)
            {
                stacks[0] = oppStack;
                stacks[1] = myStack;
                data.myPos = 1; // SB
            }
            else
            {
                stacks[0] = myStack;
                stacks[1] = oppStack;
                data.myPos = 0; // BB
            }
            data.BBsize = BBarray[(gameNum - 1) / 10];
            data.gameNumber = gameNum;

            if (stacks[0] > data.BBsize && stacks[1] > data.BBsize)
            {
                calcranges.calc(stacks, data.BBsize, 10);
                data.requiresAction = true;
            }
            else
                data.requiresAction = false;

            data.myHand[0] = deck[0];
            data.myHand[1] = deck[1];
            data.oppHand[0] = deck[2];
            data.oppHand[1] = deck[3];
            for (int i = 0; i < 5; i++)
                data.board[i] = deck[4 + i];

            // selvitetään voittaja
            int myHandValue  = recognize.handValue(data.myHand,  data.board, 5, data.myHandResult);
            int oppHandValue = recognize.handValue(data.oppHand, data.board, 5, data.oppHandResult);
            if (myHandValue > oppHandValue)
                data.winner = ME;
            else if (oppHandValue > myHandValue)
                data.winner = OPP;
            else
                data.winner = 2;    // tasapeli
            Console.WriteLine("myHandValue: " + myHandValue + " oppHandValue" + oppHandValue + " winner: " + data.winner);

            data.myFinalHandStr  = finalHandToStr(data.myHandResult);
            data.oppFinalHandStr = finalHandToStr(data.oppHandResult);

            data.myHandStr  = icm.handToStr(data.myHand);
            data.oppHandStr = icm.handToStr(data.oppHand);

            data.myHandSklanskyValue = icm.handToValue(data.myHand);
            data.oppHandSklanskyValue = icm.handToValue(data.oppHand);

            // voiko tietokonevastustaja mennä alliin (joko push tai call)
            if (button % 2 == ME && data.oppHandSklanskyValue <= calcranges.callerRange)
                data.oppPush = true;    // tietokonevastustaja maksaa allin
            else if (button % 2 == OPP && data.oppHandSklanskyValue <= calcranges.raiserRange)
                data.oppPush = true;    // tietokonevastustaja tekee itse buttonista allin
            else if (stacks[0] <= data.BBsize || stacks[1] <= data.BBsize)
                data.oppPush = true;    // jompi kumpi stäkki < BB, joten allissa pakosti
            else
                data.oppPush = false;   // kaikissa muissa tapauksissa tietokone foldaa

            data.oppStack = oppStack;
            data.myStack = myStack;

            Console.WriteLine("calcranges.raiserRange: " + calcranges.raiserRange + " calcranges.callerRange: " + calcranges.callerRange);
            Console.WriteLine("data.myHandStr: " + data.myHandStr + " SklanskyValue: " + data.myHandSklanskyValue);
            Console.WriteLine("data.oppHandStr: " + data.oppHandStr + " SklanskyValue: " + data.oppHandSklanskyValue);

            button++;
            gameNum++;
        }
Ejemplo n.º 3
0
        // näiden korttien perusteella määritellään ensimmäisen pelin button
        public void getNewGame(GameData data)
        {
            shuffle();
            data.reset();

            int[] stacks = { 0, 0 };
            if (button % 2 == ME)
            {
                stacks[0]  = oppStack;
                stacks[1]  = myStack;
                data.myPos = 1; // SB
            }
            else
            {
                stacks[0]  = myStack;
                stacks[1]  = oppStack;
                data.myPos = 0; // BB
            }
            data.BBsize     = BBarray[(gameNum - 1) / 10];
            data.gameNumber = gameNum;

            if (stacks[0] > data.BBsize && stacks[1] > data.BBsize)
            {
                calcranges.calc(stacks, data.BBsize, 10);
                data.requiresAction = true;
            }
            else
            {
                data.requiresAction = false;
            }

            data.myHand[0]  = deck[0];
            data.myHand[1]  = deck[1];
            data.oppHand[0] = deck[2];
            data.oppHand[1] = deck[3];
            for (int i = 0; i < 5; i++)
            {
                data.board[i] = deck[4 + i];
            }

            // selvitetään voittaja
            int myHandValue  = recognize.handValue(data.myHand, data.board, 5, data.myHandResult);
            int oppHandValue = recognize.handValue(data.oppHand, data.board, 5, data.oppHandResult);

            if (myHandValue > oppHandValue)
            {
                data.winner = ME;
            }
            else if (oppHandValue > myHandValue)
            {
                data.winner = OPP;
            }
            else
            {
                data.winner = 2;    // tasapeli
            }
            Console.WriteLine("myHandValue: " + myHandValue + " oppHandValue" + oppHandValue + " winner: " + data.winner);

            data.myFinalHandStr  = finalHandToStr(data.myHandResult);
            data.oppFinalHandStr = finalHandToStr(data.oppHandResult);

            data.myHandStr  = icm.handToStr(data.myHand);
            data.oppHandStr = icm.handToStr(data.oppHand);

            data.myHandSklanskyValue  = icm.handToValue(data.myHand);
            data.oppHandSklanskyValue = icm.handToValue(data.oppHand);

            // voiko tietokonevastustaja mennä alliin (joko push tai call)
            if (button % 2 == ME && data.oppHandSklanskyValue <= calcranges.callerRange)
            {
                data.oppPush = true;    // tietokonevastustaja maksaa allin
            }
            else if (button % 2 == OPP && data.oppHandSklanskyValue <= calcranges.raiserRange)
            {
                data.oppPush = true;    // tietokonevastustaja tekee itse buttonista allin
            }
            else if (stacks[0] <= data.BBsize || stacks[1] <= data.BBsize)
            {
                data.oppPush = true;    // jompi kumpi stäkki < BB, joten allissa pakosti
            }
            else
            {
                data.oppPush = false;   // kaikissa muissa tapauksissa tietokone foldaa
            }
            data.oppStack = oppStack;
            data.myStack  = myStack;

            Console.WriteLine("calcranges.raiserRange: " + calcranges.raiserRange + " calcranges.callerRange: " + calcranges.callerRange);
            Console.WriteLine("data.myHandStr: " + data.myHandStr + " SklanskyValue: " + data.myHandSklanskyValue);
            Console.WriteLine("data.oppHandStr: " + data.oppHandStr + " SklanskyValue: " + data.oppHandSklanskyValue);

            button++;
            gameNum++;
        }