/// <summary>
        /// Initalisierung der Variablen
        /// </summary>
        public void init()
        {
            //Deck initalisieren
            deck = new Deck();

            //Die 6 möglichen Hände initalisieren
            hand1 = new Hand();
            hand2 = new Hand();
            hand3 = new Hand();
            hand4 = new Hand();
            hand5 = new Hand();
            hand6 = new Hand();

            //Spieler initalisieren
            player1 = new Player("", 10000, false, 1);
            player2 = new Player("", 10000, false, 2);
            player3 = new Player("", 10000, false, 3);
            player4 = new Player("", 10000, false, 1);
            player5 = new Player("", 10000, false, 2);
            player6 = new Player("", 10000, false, 4);

            player1.PlayerID = 0;
            player2.PlayerID = 1;
            player3.PlayerID = 2;
            player4.PlayerID = 3;
            player5.PlayerID = 4;
            player6.PlayerID = 5;

            player1.setTagID(1);
            player2.setTagID(2);
            player3.setTagID(3);

            activePlayers = new List<Player>();         //Aktive Spieler am Tisch
            activeHands = new List<Hand>();             //Händer der Aktiven Spieler am Tisch
            activeRoundPlayers = new List<Player>();    //Aktive Spieler einer Runde
            chipsOnTable = new List<Canvas>();          //Alle Chips die sich auf dem Tisch befinden

            table = new Table();                        //Tisch init
            blind = new Blind();                        //Blind init
        }
        public void checkWinner()
        {
            int highestHandValue = 0;
            Player winner = activeRoundPlayers[0];
            List<Player> winPlayerCheck = new List<Player>();

            //Auslesen der höchsten hand
            foreach (Player player in activeRoundPlayers)
            {
                if (player.CardValueHelper >= winner.CardValueHelper)
                {
                    winner = player;
                    highestHandValue = winner.CardValueHelper;

                }
            }

            //ermittele eventuelle duplicated Hand values
            foreach (Player player in activeRoundPlayers)
            {
                if (player.CardValueHelper == highestHandValue)
                {
                    winPlayerCheck.Add(player);
                }
            }

            int maxvalue = 0;
            foreach (Player player in winPlayerCheck)
            {
                maxvalue = player.getHand().getHandValue() + table.getTableValue();

                Console.WriteLine(player.getPlayername() + "   " + maxvalue);
            }

            foreach (Player player in winPlayerCheck)
            {
                if (player.CardValueHelper == maxvalue)
                {
                    winner = player;
                }
            }

            Console.WriteLine("Gewinner ist: " + winner.ToString());

            GewinnerOverlay.Visibility = Visibility.Visible;                            //GewinnerOverlay auf Sichtbar setzen
            Storyboard GewinnerStoryBoard = (Storyboard)FindResource("Gewinner");       //Storyboard für das Gewinner Overlay
            GewinnerStoryBoard.Begin(this);                                             //Gewinner Storyboard starten

            soundmanager.playSoundViele1();

            gewinnerTxt.Text = "" + activeRoundPlayers.ElementAt(0).getPlayername();    //Gewinner auf dem Storyboard ausgeben

            t1.Visibility = Visibility.Hidden;
            t2.Visibility = Visibility.Hidden;
            t3.Visibility = Visibility.Hidden;
            t4.Visibility = Visibility.Hidden;
            t5.Visibility = Visibility.Hidden;

            floppingBlindFoldHelper = false;

            //Pot dem Spieler berechnen
            winner.setBudget(activeRoundPlayers.ElementAt(0).getBudget() + pot);

            deck = new Deck();                      //Deck neu verteilen
            dealHands();                            //Hände neu geben
            setPlayerHands(activePlayers.Count);    //den Aktiven spielern die Hände geben
            table = new Table();                    //Tisch neue Karten geben
            dealTable();                            //Tisch neu dealen

            pot = 0;                                //Pot wieder auf 0 inialisieren

            soundmanager.playSoundViele1();

            flopping = false;
            turning = false;
            rivering = false;

            activeRoundPlayers.Clear();     //activeRound liste leeren diese wird gleich neu gesetzt da wieder mehrer Spieler aktiv in der Runde sind

            playRound = 0;

            blind.setPlayer(activePlayers);

            blind.switchBlindsAndDealer();  //Blinds weiter switchen

            foreach (Player player in activePlayers)
            {
                activeRoundPlayers.Add(player);

                player.setCurrentPlayer(false);
                if (player.PlayerBlindDealState == Player.BlindDealState.small)
                    player.setCurrentPlayer(true);
            }

            //Die activeRoundPlayers wieder mit den Spielern setzen die sich noch in der ActivePlayers liste befinden
            //also die Spieler die deren Budget noch > 0 ist
            foreach (Player player in activePlayers)
                activeRoundPlayers.Add(player);

            //nach der Runde raisen
            blind.raiseBlind(20);

            //Die States der Spieler auf unbekannt zurücksetzen
            foreach (Player player in activeRoundPlayers)
                player.PlayerState = Player.State.unknow;

            //Die Chips vom Tisch entfernen (POT Chips)
            foreach (Canvas chip in chipsOnTable)
                grid.Children.Remove(chip);

            //User Interface updaten
            updateUI();
        }
        /// <summary>
        /// GameLoop beeinhaltet die Pokerlogik
        /// </summary>
        public void gameLoop_Update(object sender, TimeSpan elapsed)
        {
            //Console.WriteLine(playRound);

            if (blind.nextWettRound(activeRoundPlayers) && flop == false && flopping == false && playRound > 0 && (blind.getbigBlindPlayer().PlayerState != Player.State.unknow))
            {
                flop = true;

                if (!flopping)
                {
                    //Rundenzähler für gesetzt zurück setzen
                    foreach (Player player in activeRoundPlayers)
                    {
                        player.GesetztRunde = 0;
                        // blind.setRaiseValue(player, -1);
                    }
                }

                flopping = true;
                floppingHelper = true;
                floppingBlindFoldHelper = true;

            }

            // Console.WriteLine(activeRoundPlayers[0].GesetztRunde);

            if (blind.nextWettRoundTwo(activeRoundPlayers) && turnCard == false && turning == false && flopping)
            {
                turnCard = true;

                if (!turning)
                {
                    //Rundenzähler für gesetzt zurück setzen
                    foreach (Player player in activeRoundPlayers)
                    {
                        player.GesetztRunde = 0;
                        // blind.setRaiseValue(player, -1);
                    }
                }

                turning = true;
                turningHelper = true;

            }

            if (blind.nextWettRoundTwo(activeRoundPlayers) && riverCard == false && rivering == false && turning)
            {
                riverCard = true;

                if (!rivering)
                {
                    //Rundenzähler für gesetzt zurück setzen
                    foreach (Player player in activeRoundPlayers)
                    {
                        player.GesetztRunde = 0;
                        // blind.setRaiseValue(player, -1);
                    }
                }

                rivering = true;
                riveringHelper = true;

            }

            //Flop Karten auf dem Tisch anzeigen
            if (flop)
            {

                //currentPlayerCounter = blind.getSmallPlayerPosition() - 1;

                t1.Visibility = Visibility.Visible;
                t2.Visibility = Visibility.Visible;
                t3.Visibility = Visibility.Visible;

                if (alternativeDeck)
                {
                    t1.Source = new BitmapImage(new Uri("pack://siteoforigin:,,,/Cards/k" + table.getCard(0) + ".png"));
                    t2.Source = new BitmapImage(new Uri("pack://siteoforigin:,,,/Cards/k" + table.getCard(1) + ".png"));
                    t3.Source = new BitmapImage(new Uri("pack://siteoforigin:,,,/Cards/k" + table.getCard(2) + ".png"));
                }
                else
                {
                    t1.Source = new BitmapImage(new Uri("pack://siteoforigin:,,,/Cards/" + table.getCard(0) + ".png"));
                    t2.Source = new BitmapImage(new Uri("pack://siteoforigin:,,,/Cards/" + table.getCard(1) + ".png"));
                    t3.Source = new BitmapImage(new Uri("pack://siteoforigin:,,,/Cards/" + table.getCard(2) + ".png"));
                }

                //flop = false;
                flopping = true;
            }

            //Turn Karte auf dem Tisch anzeigen
            if (turnCard)
            {
                // currentPlayerCounter = blind.getSmallPlayerPosition() - 1;

                t4.Visibility = Visibility.Visible;

                if (alternativeDeck)
                {
                    t4.Source = new BitmapImage(new Uri("pack://siteoforigin:,,,/Cards/k" + table.getCard(3) + ".png"));
                }
                else {
                    t4.Source = new BitmapImage(new Uri("pack://siteoforigin:,,,/Cards/" + table.getCard(3) + ".png"));
                }

                //turnCard = false;
                turning = true;
            }

            //River Karte auf dem Tisch anzeigen
            if (riverCard)
            {
                //currentPlayerCounter = blind.getSmallPlayerPosition() - 1;
                t5.Visibility = Visibility.Visible;

                if (alternativeDeck)
                {
                    t5.Source = new BitmapImage(new Uri("pack://siteoforigin:,,,/Cards/k" + table.getCard(4) + ".png"));
                }
                else {
                    t5.Source = new BitmapImage(new Uri("pack://siteoforigin:,,,/Cards/" + table.getCard(4) + ".png"));
                }

                rivering = true;
            }

            flop = false;
            turnCard = false;
            riverCard = false;

            //Wenn die Runde rum ist dann prüfen welcher Spieler Gewonnen hat
            //Hande checken
            //Gewinner ermitteln
            //Und die gameloop stopen
            if (rivering == true && blind.nextWettRoundTwo(activeRoundPlayers))
            {

                checkHands();
                checkWinner();
                // gameLoop.Stop();

            }

            //Wenn der aktuelle Spieler > als die Anzahl der gesamt spieler
            //(die Runde hat wieder ihren Anfang gefunden bzw ist am Ende)
            if (currentPlayerCounter > activeRoundPlayers.Count - 1)
            {
                //dann setzte den Player Counter wieder auf 0 weil die Runde wieder bei
                //Spieler index 0 anfängt und raise die blinds um 10
                currentPlayerCounter = 0;

                blind.raiseBlind(10);
            }

            //Der Aktive Spieler ist wieder der mit dem index -> currentplayercounter
            //activeRoundPlayers.ElementAt(currentPlayerCounter).setCurrentPlayer(true);
            updateUI();

            //Informationen an die Tags weiter geben
            //ob spieler small big bzw dealer
            foreach (Player player in activeRoundPlayers)
            {
                if (player.PlayerBlindDealState == Player.BlindDealState.small)
                {
                    if (player.PlayerID == 0)
                        glow1.setTagInfo("small");
                    if (player.PlayerID == 1)
                        glow2.setTagInfo("small");
                    if (player.PlayerID == 2)
                        glow3.setTagInfo("small");
                    if (player.PlayerID == 3)
                        glow4.setTagInfo("small");
                    if (player.PlayerID == 4)
                        glow5.setTagInfo("small");
                    if (player.PlayerID == 5)
                        glow6.setTagInfo("small");
                }

                if (player.PlayerBlindDealState == Player.BlindDealState.big)
                {
                    if (player.PlayerID == 0)
                        glow1.setTagInfo("big");
                    if (player.PlayerID == 1)
                        glow2.setTagInfo("big");
                    if (player.PlayerID == 2)
                        glow3.setTagInfo("big");
                    if (player.PlayerID == 3)
                        glow4.setTagInfo("big");
                    if (player.PlayerID == 4)
                        glow5.setTagInfo("big");
                    if (player.PlayerID == 5)
                        glow6.setTagInfo("big");
                }

                if (player.PlayerBlindDealState == Player.BlindDealState.unknow)
                {
                    if (player.PlayerID == 0)
                        glow1.setTagInfo("");
                    if (player.PlayerID == 1)
                        glow2.setTagInfo("");
                    if (player.PlayerID == 2)
                        glow3.setTagInfo("");
                    if (player.PlayerID == 3)
                        glow4.setTagInfo("");
                    if (player.PlayerID == 4)
                        glow5.setTagInfo("");
                    if (player.PlayerID == 5)
                        glow6.setTagInfo("");
                }

                if (player.PlayerBlindDealState == Player.BlindDealState.dealer)
                {
                    if (player.PlayerID == 0)
                        glow1.setTagInfo("dealer");
                    if (player.PlayerID == 1)
                        glow2.setTagInfo("dealer");
                    if (player.PlayerID == 2)
                        glow3.setTagInfo("dealer");
                    if (player.PlayerID == 3)
                        glow4.setTagInfo("dealer");
                    if (player.PlayerID == 4)
                        glow5.setTagInfo("dealer");
                    if (player.PlayerID == 5)
                        glow6.setTagInfo("dealer");
                }

            }

            //Wenn nur noch ein aktiver RundenSpieler im aktuellen Spiel runde ist ==> Runde zu Ende Pot geht an einen Gewinner
            //und nächste runde beginnt
            if (activeRoundPlayers.Count == 1)
            {
                //Pot dem Spieler berechnen
                activeRoundPlayers.ElementAt(0).setBudget(activeRoundPlayers.ElementAt(0).getBudget() + pot);

                deck = new Deck();                      //Deck neu verteilen
                dealHands();                            //Hände neu geben
                setPlayerHands(activePlayers.Count);    //den Aktiven spielern die Hände geben
                table = new Table();                    //Tisch neue Karten geben
                dealTable();                            //Tisch neu dealen

                pot = 0;                                //Pot wieder auf 0 inialisieren

                GewinnerOverlay.Visibility = Visibility.Visible;                            //GewinnerOverlay auf Sichtbar setzen
                Storyboard GewinnerStoryBoard = (Storyboard)FindResource("Gewinner");       //Storyboard für das Gewinner Overlay
                GewinnerStoryBoard.Begin(this);                                             //Gewinner Storyboard starten

                soundmanager.playSoundViele1();

                gewinnerTxt.Text = "" + activeRoundPlayers.ElementAt(0).getPlayername();    //Gewinner auf dem Storyboard ausgeben

                activeRoundPlayers.Clear();     //activeRound liste leeren diese wird gleich neu gesetzt da wieder mehrer Spieler aktiv in der Runde sind

                blind.setPlayer(activePlayers);

                blind.switchBlindsAndDealer();  //Blinds weiter switchen

                foreach (Player player in activePlayers)
                {
                    player.setCurrentPlayer(false);
                    if (player.PlayerBlindDealState == Player.BlindDealState.small)
                        player.setCurrentPlayer(true);
                }

                //Die activeRoundPlayers wieder mit den Spielern setzen die sich noch in der ActivePlayers liste befinden
                //also die Spieler die deren Budget noch > 0 ist
                foreach (Player player in activePlayers)
                    activeRoundPlayers.Add(player);

                //nach der Runde raisen
                blind.raiseBlind(10);

                //Die States der Spieler auf unbekannt zurücksetzen
                foreach (Player player in activeRoundPlayers)
                    player.PlayerState = Player.State.unknow;

                //Die Chips vom Tisch entfernen (POT Chips)
                foreach (Canvas chip in chipsOnTable)
                    grid.Children.Remove(chip);

                //User Interface updaten
                updateUI();
            }
            else
            {
                foreach (Player player in activeRoundPlayers)   //Alle Spieler die noch aktiv in der Runde sind
                {
                    //Console.WriteLine(player.getPlayername() + "  " + player.getIsCurrentPlayer() + "    " + player.PlayerBlindDealState);
                    //Console.WriteLine("--- ---- ___  " + player.getPlayername() + "  " + player.getIsCurrentPlayer() + "    " + player.PlayerBlindDealState + "     " + blind.minBetValue(player, playRound) + "     ");

                    //Console.WriteLine("Current Player Index:    " + currentPlayerCounter);

                    Console.WriteLine(player.PlayerID + "  " + player.PlayerBlindDealState);

                    if (player.getIsCurrentPlayer() == true)            //Wenn Spieler aktueller Spieler prüf ob sich sein State verändert hat
                    {

                        //Prüfen ob Spielder gefoldet hat dann deaktivieren
                        if (player.PlayerState == Player.State.fold)
                        {
                            if (currentPlayerCounter > activeRoundPlayers.Count - 1)        //Wenn Letzter Spieler +1 erreicht nächste Runde also wieder bei 0 Anfangen
                                currentPlayerCounter = 0;

                            player.setCurrentPlayer(false);         //Aktiver Spieler ist jetzt nichtmehr der currentPlayer
                            player.Fold = true;                     //Spieler hat gefolded
                            updateUI();                             //User Interface updaten
                            activeRoundPlayers.Remove(player);      //Spieler ist nicht mehr aktiv in dieser Runde daher aus Liste entfernen

                            //blind.setPlayer(activeRoundPlayers);    //Liste der Spieler für die Blinds neu setzen

                            if (currentPlayerCounter > activeRoundPlayers.Count - 1)
                            {
                                activeRoundPlayers.ElementAt(0).setCurrentPlayer(true);
                            }//Nächsten Spieler aktiv setzen
                            else
                                activeRoundPlayers.ElementAt(currentPlayerCounter).setCurrentPlayer(true);  //Nächsten Spieler aktiv setzen

                            playRoundPlayerCounter++;

                            if (playRoundPlayerCounter > activeRoundPlayers.Count - 1)
                                playRound++;

                            break;
                        }

                        if (alInTag)
                        {

                            player.Gesetzt = (int)player.getBudget();

                            pot += (int)player.getBudget();

                            player.GesetztRunde += (int)player.getBudget();
                            player.setBudget(0);

                            //gesetzt auf 0 zurück setzen
                            player.PlayerState = Player.State.unknow;                       //Spiele state ist wieder unbekannt
                            player.setCurrentPlayer(false);                                 //Spieler ist kein Aktiver Spieler mehr

                            blind.setRaiseValue(player, playRound);

                            currentPlayerCounter++;                                         //Nach einer Aktion den aktiven Spieler counter um eins erhöhen
                            if (currentPlayerCounter > activeRoundPlayers.Count - 1)
                            {
                                currentPlayerCounter = 0;                                   //Wenn Letzter Spieler +1 erreicht nächste Runde also wieder bei 0 Anfangen                                             //Spielrunde erhöhen wichtig um karten auf tisch zu legen
                            }

                            playRoundPlayerCounter++;
                            if (playRoundPlayerCounter > activeRoundPlayers.Count - 1)
                            {
                                playRound++;
                                playRoundPlayerCounter = 0;

                            }

                            p2c1.showCard();

                            soundmanager.playSoundEinsatz2();

                            player.Gesetzt = 0;

                            activeRoundPlayers.ElementAt(currentPlayerCounter).setCurrentPlayer(true);  //Nächsten Spieler aktiv setzen

                            alInTag = false;
                            break;

                        }

                        if (player.PlayerState == Player.State.check)
                        {

                            player.setCurrentPlayer(false);         //Aktiver Spieler ist jetzt nichtmehr der currentPlayer
                            // player.Fold = true;                     //Spieler hat gefolded
                            updateUI();                             //User Interface updaten
                            player.PlayerState = Player.State.unknow;

                            //blind.setPlayer(activeRoundPlayers);    //Liste der Spieler für die Blinds neu setzen

                            player.Gesetzt = 0;

                            blind.clearRaises();

                            if (floppingHelper)
                            {
                                activeRoundPlayers.ElementAt(blind.getSmallPlayerPosition()).setCurrentPlayer(true);
                                currentPlayerCounter = blind.getSmallPlayerPosition();
                                floppingHelper = false;
                            }
                            else if (turningHelper)
                            {
                                activeRoundPlayers.ElementAt(blind.getBigPlayerPosition()).setCurrentPlayer(true);
                                currentPlayerCounter = blind.getBigPlayerPosition();
                                turningHelper = false;
                            }
                            else if (riveringHelper)
                            {
                                activeRoundPlayers.ElementAt(blind.getAfterBigPlayerPosition()).setCurrentPlayer(true);
                                currentPlayerCounter = blind.getAfterBigPlayerPosition();
                                riveringHelper = false;
                            }
                            else
                            {
                                currentPlayerCounter++;
                                if (currentPlayerCounter > activeRoundPlayers.Count - 1)
                                {
                                    currentPlayerCounter = 0;
                                }

                                activeRoundPlayers.ElementAt(currentPlayerCounter).setCurrentPlayer(true);  //Nächsten Spieler aktiv setzen
                            }

                            playRoundPlayerCounter++;
                            if (playRoundPlayerCounter > activeRoundPlayers.Count - 1)
                            {
                                playRound++;
                                playRoundPlayerCounter = 0;

                            }

                            break;

                        }

                        //Bet
                        if (player.PlayerState == Player.State.bet)
                        {

                            pot += player.Gesetzt;                                          //Das vom Spieler gesetzte in den Pot
                            player.GesetztRunde += player.Gesetzt;
                            player.setBudget(player.getBudget() - player.Gesetzt);          //Budget des Spieler mit dem gesetzen veringern
                            updateUI();                                                     //User Interface updaten um pot un budget zu aktualisieren
                            //gesetzt auf 0 zurück setzen
                            player.PlayerState = Player.State.unknow;                       //Spiele state ist wieder unbekannt
                            player.setCurrentPlayer(false);                                 //Spieler ist kein Aktiver Spieler mehr

                            blind.setRaiseValue(player, playRound);

                            if (floppingHelper)
                            {
                                activeRoundPlayers.ElementAt(blind.getSmallPlayerPosition()).setCurrentPlayer(true);
                                currentPlayerCounter = blind.getSmallPlayerPosition();
                                floppingHelper = false;
                            }
                            else if (turningHelper)
                            {
                                activeRoundPlayers.ElementAt(blind.getBigPlayerPosition()).setCurrentPlayer(true);
                                currentPlayerCounter = blind.getBigPlayerPosition();
                                turningHelper = false;
                            }
                            else if (riveringHelper)
                            {
                                activeRoundPlayers.ElementAt(blind.getAfterBigPlayerPosition()).setCurrentPlayer(true);
                                currentPlayerCounter = blind.getAfterBigPlayerPosition();
                                riveringHelper = false;
                            }
                            else
                            {
                                currentPlayerCounter++;
                                if (currentPlayerCounter > activeRoundPlayers.Count - 1)
                                {
                                    currentPlayerCounter = 0;
                                }

                                activeRoundPlayers.ElementAt(currentPlayerCounter).setCurrentPlayer(true);  //Nächsten Spieler aktiv setzen
                            }

                            playRoundPlayerCounter++;
                            if (playRoundPlayerCounter > activeRoundPlayers.Count - 1)
                            {
                                playRound++;
                                playRoundPlayerCounter = 0;

                            }

                            soundmanager.playSoundEinsatz2();

                            player.Gesetzt = 0;

                            break;
                        }

                    }
                }

            }
        }
Exemple #4
0
        /// <summary>
        /// starts a new game and set back all relevant attributes
        /// </summary>
        public Player newGame()
        {
            
            log.Debug("new Game() - Begin");
            bigBlind = blindStructur[blindLevel];
            smallBlind = blindStructur[blindLevel] / 2;
            log.Debug("Blindlevel: " + smallBlind + "/" + bigBlind);
            deck = new Deck();
            round = 0;
            board = new List<Card>();
            pot.amountPerPlayer = bigBlind;
            nonActives = players.FindAll(x =>  (x.stack == 0)).Count;
            int j = 0;
            players.Sort((x, y) => x.ingamePosition.CompareTo(y.ingamePosition));
            bool firstplayer = !boolCancel;
            if (players.Count - nonActives == 1)
            {
                log.Debug("EndGameException");
                throw new EndGameException("End of Game - Only one player left");
            }
            Logger.action(this, dealer, Action.playerAction.newgame, 0, board);
            for (int k = 0; k < players.Count; k++)
            {
                if (players[k].stack > 0)
                {

                    players[k].isActive = true;
                    players[k].isAllin = false;
                    players[k].hasChecked = false;
                    Logger.action(this, players[k], Action.playerAction.ingame, 0, board);
                }
                else
                {
                    players[k].isActive = false;
                    players[k].isAllin = false;
                    
                }
                players[k].totalInPot = 0;
            }
            for (int i = 0; i < players.Count; i++)
            {
                players[i].inPot = 0;
                players[i].totalInPot = 0;
                if (players[i].stack > 0)
                {
                    if (firstplayer)
                    {
                        players[i].ingamePosition = players.Count - nonActives;
                        firstplayer = false;
                        Logger.action(this, players[i], Action.playerAction.bigblind, bigBlind, board);
                        if(players[i].stack >= bigBlind){
                            pot.raisePot(players[i], bigBlind);
                            players[i].action(bigBlind);
                        }
                        else
                        {
                            pot.raisePot(players[i], smallBlind);
                            players[i].action(smallBlind);
                        }
                    }
                    else
                    {
                        if (!boolCancel)
                        {
                            players[i].ingamePosition = i - j;
                            if (players[i].ingamePosition == players.Count - nonActives - 1)
                            {
                                Logger.action(this, players[i], Action.playerAction.smallblind, smallBlind, board);
                                pot.amountPerPlayer = smallBlind;
                                pot.raisePot(players[i], smallBlind);
                                players[i].action(smallBlind);
                            }
                        }
                        else
                        {
                            if (players[i].ingamePosition == players.Count - nonActives - 1)
                            {
                                Logger.action(this, players[i], Action.playerAction.smallblind, smallBlind, board);
                                pot.amountPerPlayer = smallBlind;
                                pot.raisePot(players[i], smallBlind);
                                players[i].action(smallBlind);
                            }
                            if (players[i].ingamePosition == players.Count - nonActives)
                            {
                                Logger.action(this, players[i], Action.playerAction.bigblind, bigBlind, board);
                                pot.amountPerPlayer = bigBlind;
                                pot.raisePot(players[i], bigBlind);
                                players[i].action(bigBlind);
                                boolCancel = false;
                            }
                        }

                    }
                    players[i].cards = new List<Card>();
                    players[i].setOneCard(deck.DealNext());
                    players[i].setOneCard(deck.DealNext());
                    
                }
                else
                {
                    players[i].cards = new List<Card>();
                    j++;
                    players[i].ingamePosition = 0;
                }
            }
            if (pot.sidePot != null)
            {
                if (pot.sidePot.amountPerPlayer < bigBlind)
                {
                    pot.amountPerPlayer = smallBlind;
                }
            }
            else
            {
                pot.amountPerPlayer = bigBlind;
            }
            pot.raiseSize = bigBlind;

            Logger.calculateWinChance(this);

            foreach (Player p in players)
            {
                Logger.action(this, p, Action.playerAction.nothing, 0, new List<Card>());
                log.Debug("Name: " + p.name + ", Position: " + p.ingamePosition + ", Stack: " + p.stack);
            }
            activePlayer = null;
            nextActivePlayer = null;
            if ((players.Count - nonActives) >= 3)
            {
                log.Debug("new Game() - End");
                return players.Find(x => x.ingamePosition == (players.Count - nonActives - 2));
            }
            else
            {
                log.Debug("new Game() - End");
                return players.Find(x => x.ingamePosition == (players.Count - nonActives));
            }
        }