All pastes #267375 Raw Edit

aLFie

public text v1 · immutable
·published 2006-12-04 20:40 UTC
rendered paste body
            // --------------------------------------------------------------------------------
            // abzüglich derer die aussetzen
            // --------------------------------------------------------------------------------
            TotalPlayers = TotalPlayers - SitoutPlayers;


            // --------------------------------------------------------------------------------
            // speichert die positions als stack für LIFO - Pop()
            // --------------------------------------------------------------------------------
            Stack seats;
            seats = getSeats(TotalPlayers);


            // --------------------------------------------------------------------------------
            // speichert seats reihenfolge in array
            // --------------------------------------------------------------------------------
            int i = 0;
            hMatches = Regex.Matches(history, @"Seat\s(\d+):\s(\w+)\s\(\s\$(.+)\s\)");
            int[] playersort = new int[hMatches.Count];
            foreach (Match hMatch in hMatches)
            {
                playersort[i] = Convert.ToInt16(hMatch.Groups[1].ToString());
                i++;
            }


            // --------------------------------------------------------------------------------
            // sortiert array nach den sitzen
            // --------------------------------------------------------------------------------
            Array.Sort(playersort);


            // --------------------------------------------------------------------------------
            // speicher spieler infos Dealer und darauf folgende spieler
            // --------------------------------------------------------------------------------
            i = 0;
            foreach (int seatno in playersort)
            {
                if (seatno == ButtonSeat)
                {
                    players.Add(i, 
                        new Dictionary<string, string>());
                    players[i].Add("PlayerSeatNumber", 
                        seatno.ToString());
                    players[i].Add("PlayerName", 
                        Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[1].ToString());
                    players[i].Add("PlayerStack", 
                        Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[2].ToString());
                    players[i].Add("PlayerSeatTitle",
                        "Button");
                    // line löschen
                    history = Regex.Replace(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\).*?\n", "");
                    i++;

                }
                else if (seatno > ButtonSeat)
                {
                    players.Add(i, 
                        new Dictionary<string, string>());
                    players[i].Add("PlayerSeatNumber", 
                        seatno.ToString());
                    players[i].Add("PlayerName", 
                        Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[1].ToString());
                    players[i].Add("PlayerStack", 
                        Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[2].ToString());
                    players[i].Add("PlayerSeatTitle", 
                        seats.Pop().ToString());
                    // line löschen
                    history = Regex.Replace(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\).*?\n", "");
                    i++;
                }
            }


            // --------------------------------------------------------------------------------
            // speicher spieler infos von denen die vor dem button sitzen
            // --------------------------------------------------------------------------------
            foreach (int seatno in playersort)
            {
                if (seatno < ButtonSeat)
                {
                    players.Add(i, 
                        new Dictionary<string, string>());
                    players[i].Add("PlayerSeatNumber", 
                        seatno.ToString());
                    players[i].Add("PlayerName", 
                        Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[1].ToString());
                    players[i].Add("PlayerStack", 
                        Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[2].ToString());
                    players[i].Add("PlayerSeatTitle", 
                        seats.Pop().ToString());
                    // line löschen
                    history = Regex.Replace(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\).*?\n", "");
                    i++;
                }
            }