Beispiel #1
0
        public void startHand()
        {
            //Initialize gamewindow
            gamewindow = currentgame.getGameWindow();
            //Shuffle the deck on starthand
            getDeck().shuffleDeck();
            //Pick two cards from the top of the deck and give them to the players
            currentgame.getPlayer().addToHand(getDeck().getTopCard());
            currentgame.getPlayer().addToHand(getDeck().getTopCard());
            currentgame.getAiPlayer().addToHand(getDeck().getTopCard());
            currentgame.getAiPlayer().addToHand(getDeck().getTopCard());
            //Get the two cards from the starthand of the player
            Card playercard1 = currentgame.getPlayer().getHand()[0];
            Card playercard2 = currentgame.getPlayer().getHand()[1];

            Console.WriteLine("Human player cards:");
            Console.WriteLine(playercard1.getValue() + playercard1.getSuit());
            Console.WriteLine(playercard2.getValue() + playercard2.getSuit());
            Card aiplayercard1 = currentgame.getAiPlayer().getHand()[0];
            Card aiplayercard2 = currentgame.getAiPlayer().getHand()[1];

            Console.WriteLine("AI player cards: ");
            Console.WriteLine(aiplayercard1.getValue() + aiplayercard1.getSuit());
            Console.WriteLine(aiplayercard2.getValue() + aiplayercard2.getSuit());

            //Add filepath of each card
            string file_playercard1   = playercard1.getValue() + "of" + playercard1.getSuit() + ".png";
            string file_playercard2   = playercard2.getValue() + "of" + playercard2.getSuit() + ".png";
            string path_playercard1   = Path.Combine(path, file_playercard1);
            string path_playercard2   = Path.Combine(path, file_playercard2);
            string file_aiplayercard1 = aiplayercard1.getValue() + "of" + aiplayercard1.getSuit() + ".png";
            string file_aiplayercard2 = aiplayercard2.getValue() + "of" + aiplayercard2.getSuit() + ".png";
            string path_aiplayercard1 = Path.Combine(path, file_aiplayercard1);
            string path_aiplayercard2 = Path.Combine(path, file_aiplayercard2);

            gamewindow.changePictureBox(gamewindow.player_card1, path_playercard1);
            gamewindow.changePictureBox(gamewindow.player_card2, path_playercard2);
            gamewindow.changePictureBox(gamewindow.ai_card1, path_aiplayercard1);
            gamewindow.changePictureBox(gamewindow.ai_card2, path_aiplayercard2);
            currentgame.playSession("player");
        }
Beispiel #2
0
        public void resetCards()
        {
            Console.WriteLine("Reset");
            getPlayer().getHand().Clear();
            getAiPlayer().getHand().Clear();
            string backcard      = "BackofCard.png";
            string path_backcard = Path.Combine(path, backcard);

            gamewindow.changePictureBox(gamewindow.player_card1, path_backcard);
            gamewindow.changePictureBox(gamewindow.player_card2, path_backcard);
            gamewindow.changePictureBox(gamewindow.ai_card1, path_backcard);
            gamewindow.changePictureBox(gamewindow.ai_card2, path_backcard);
            gamewindow.changePictureBox(gamewindow.flop_1, path_backcard);
            gamewindow.changePictureBox(gamewindow.flop_2, path_backcard);
            gamewindow.changePictureBox(gamewindow.flop_3, path_backcard);
            gamewindow.changePictureBox(gamewindow.turn, path_backcard);
            gamewindow.changePictureBox(gamewindow.river, path_backcard);
        }