示例#1
0
        public bool Load(XmlNode node)
        {
            if (node.Name != "GameStructure")
            {
                return(false);
            }


            XmlNode ChildNode, ChildNode2;
            XmlNode ParentNode = node.FirstChild;


            while (ParentNode != null)
            {
                if (ParentNode.Name == "Levels")
                {
                    ChildNode = ParentNode.FirstChild;
                    while (ChildNode != null)
                    {
                        if ((ChildNode.Name == "Level") && Regex.Match(ChildNode.InnerText, @"^\d+/\d+(\+\d+)?$").Success)
                        {
                            blinds.Add(new BlindInfo(ChildNode.InnerText));
                        }

                        ChildNode = ChildNode.NextSibling;
                    }
                }

                if (ParentNode.Name == "Awards")
                {
                    ChildNode = ParentNode.FirstChild;
                    while (ChildNode != null)
                    {
                        if ((ChildNode.Name == "AwardStruct"))
                        {
                            Award aw = new Award();
                            aw.name        = ChildNode.Attributes["name"].Value;
                            aw.playercount = Convert.ToInt32(ChildNode.Attributes["playercount"].Value);
                            ChildNode2     = ChildNode.FirstChild;
                            while (ChildNode2 != null)
                            {
                                if (ChildNode2.Name == "Award" && Regex.Match(ChildNode2.InnerText, @"^\d+([\.,]\d+)?$").Success)
                                {
                                    String[] muuta = new String[] { ".", "," };
                                    String   text  = ChildNode2.InnerText;
                                    for (int i = 0; i < muuta.Length; i++)
                                    {
                                        text = text.Replace(muuta[i], System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator);
                                    }

                                    aw.wins.Add(Convert.ToDouble(text));
                                }
                                ChildNode2 = ChildNode2.NextSibling;
                            }
                            aw.wins.Sort();
                            aw.wins.Reverse();
                            awards.Add(aw);
                        }

                        ChildNode = ChildNode.NextSibling;
                    }
                }

                ParentNode = ParentNode.NextSibling;
            }



            return(isok());
        }
示例#2
0
文件: Game.cs 项目: stephica/SNGEGT
        public void ICMRanges(BlindInfo blinds, bool nosb, Award award, bool isPush)
        {
            calcRanges ranges = new calcRanges();
            int PLAYERCOUNT = 10;
            int[] playerrange = new int[PLAYERCOUNT];
            int[] stacks = new int[PLAYERCOUNT];
            int allin = -1;

            for (int i = 0; i < PLAYERCOUNT; i++)
                playerrange[i] = 1;

            int found = 0;
            for (int i = 0; i < PLAYERCOUNT; i++)
            {
                if (playersData[i, STACK] != 0)
                    stacks[found++] = (int)playersData[i, STACK];
            }

            // jos ollaan Push -moodissa, niin etsitään oma indeksi pääohjelman vasemmanpuolisimmista radio buttoneista
            if (isPush)
            {
                allin = -1;
                for (int i = 0; i < 10; i++)
                {
                    if (players[i].position.Checked == true)
                    {
                        allin = i;
                        break;
                    }
                }
            }
            // call -moodissa korottaja löytyy all-in radio -buttoneiden avulla
            else
            {
                for (int i = 0; i < 10; i++)
                {
                    if (players[i].allin.Checked == true)
                    {
                        allin = i;
                        break;
                    }
                }
            }

            ranges.calc(found, stacks, allin, blinds.Bigblind, blinds.Ante, nosb, 0.1, award.wins.ToArray(), playerrange);

            Console.Write("playerrange: ");
            for (int i = 0; i < 10; i++)
                Console.Write(playerrange[i] + ", ");
            Console.Write("\n");

            for (int i = 0; i < found; i++)
                setRange(i, playerrange[i],true);
        }
示例#3
0
文件: Blinds.cs 项目: grondman/SNGEGT
        private void buttonSaveStructure_Click(object sender, EventArgs e)
        {
            changed = true;
            TreeNode node = treeView1.SelectedNode;

            dataGridViewBlinds.Sort(dataGridViewBlinds.Columns[0], ListSortDirection.Ascending);


            if (dataGridViewBlinds.RowCount == 0)
            {
                MessageBox.Show("Please fill win structure");
                return;
            }



            if (textBoxPlayerCount.Text == "" || Convert.ToInt32(textBoxPlayerCount.Text) == 0)
            {
                MessageBox.Show("Please fill how many players participates to tournament.");
                textBoxPlayerCount.Focus();
                return;
            }
            double cumprice = 0;
            int    found    = 0;

            //Lasketaan palkintojen summa, breakataan tyhjään
            for (int i = 0; i < dataGridViewWin.Rows.Count; i++)
            {
                if (Convert.ToString(dataGridViewWin.Rows[i].Cells[1].Value) != "")
                {
                    cumprice += Convert.ToDouble(dataGridViewWin.Rows[i].Cells[1].Value);
                    found++;
                }
            }


            //Yhtään palkintoa ei merkattu
            if (cumprice != 100)
            {
                MessageBox.Show("Please check award list");

                return;
            }


            Award aw = (Award)treeView1.SelectedNode.Tag;

            aw.wins.Clear();


            //Laitetaan palkintojen arvot saveriin
            for (int i = 0; i < dataGridViewWin.Rows.Count; i++)
            {
                if ((Convert.ToString(dataGridViewWin.Rows[i].Cells[1].Value)) == "")
                {
                    break;
                }
                aw.wins.Add(Convert.ToDouble(dataGridViewWin.Rows[i].Cells[1].Value));
            }
            aw.playercount = Convert.ToInt32(textBoxPlayerCount.Text);

            MessageBox.Show("Structure updated");
        }
示例#4
0
文件: Game.cs 项目: grondman/SNGEGT
        public void ICMRanges(BlindInfo blinds, bool nosb, Award award, bool isPush)
        {
            calcRanges ranges      = new calcRanges();
            int        PLAYERCOUNT = 10;

            int[] playerrange = new int[PLAYERCOUNT];
            int[] stacks      = new int[PLAYERCOUNT];
            int   allin       = -1;

            for (int i = 0; i < PLAYERCOUNT; i++)
            {
                playerrange[i] = 1;
            }

            int found = 0;

            for (int i = 0; i < PLAYERCOUNT; i++)
            {
                if (playersData[i, STACK] != 0)
                {
                    stacks[found++] = (int)playersData[i, STACK];
                }
            }

            // jos ollaan Push -moodissa, niin etsitään oma indeksi pääohjelman vasemmanpuolisimmista radio buttoneista
            if (isPush)
            {
                allin = -1;
                for (int i = 0; i < 10; i++)
                {
                    if (players[i].position.Checked == true)
                    {
                        allin = i;
                        break;
                    }
                }
            }
            // call -moodissa korottaja löytyy all-in radio -buttoneiden avulla
            else
            {
                for (int i = 0; i < 10; i++)
                {
                    if (players[i].allin.Checked == true)
                    {
                        allin = i;
                        break;
                    }
                }
            }

            ranges.calc(found, stacks, allin, blinds.Bigblind, blinds.Ante, nosb, 0.1, award.wins.ToArray(), playerrange);

            Console.Write("playerrange: ");
            for (int i = 0; i < 10; i++)
            {
                Console.Write(playerrange[i] + ", ");
            }
            Console.Write("\n");

            for (int i = 0; i < found; i++)
            {
                setRange(i, playerrange[i], true);
            }
        }
示例#5
0
        public bool Load(XmlNode node)
        {
            if (node.Name != "GameStructure")
                return false;

            XmlNode ChildNode, ChildNode2;
            XmlNode ParentNode = node.FirstChild;

            while (ParentNode != null)
            {
                if (ParentNode.Name == "Levels")
                {
                    ChildNode = ParentNode.FirstChild;
                    while (ChildNode != null)
                    {

                        if ((ChildNode.Name == "Level") && Regex.Match(ChildNode.InnerText, @"^\d+/\d+(\+\d+)?$").Success)
                            blinds.Add(new BlindInfo(ChildNode.InnerText));

                        ChildNode = ChildNode.NextSibling;

                    }
                }

                if (ParentNode.Name == "Awards")
                {
                    ChildNode = ParentNode.FirstChild;
                    while(ChildNode != null)
                    {
                        if ((ChildNode.Name == "AwardStruct"))
                        {
                            Award aw = new Award();
                            aw.name = ChildNode.Attributes["name"].Value;
                            aw.playercount = Convert.ToInt32(ChildNode.Attributes["playercount"].Value);
                            ChildNode2 = ChildNode.FirstChild;
                            while (ChildNode2 != null)
                            {
                                if (ChildNode2.Name == "Award" && Regex.Match(ChildNode2.InnerText, @"^\d+([\.,]\d+)?$").Success)
                                {
                                    String[] muuta = new String[] { ".", "," };
                                    String text = ChildNode2.InnerText;
                                    for (int i = 0; i < muuta.Length; i++)
                                        text = text.Replace(muuta[i], System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator);

                                    aw.wins.Add(Convert.ToDouble(text));
                                }
                                ChildNode2 = ChildNode2.NextSibling;
                            }
                            aw.wins.Sort();
                            aw.wins.Reverse();
                            awards.Add(aw);

                        }

                        ChildNode = ChildNode.NextSibling;
                    }
                }

                ParentNode = ParentNode.NextSibling;
            }

            return isok();
        }