Beispiel #1
0
    //_______________________Xml___________________________________________________

    public void Save()
    {
        XmlWriter         writer  = null;
        XmlWriterSettings setting = new XmlWriterSettings();

        setting.Indent   = true;
        setting.Encoding = Encoding.UTF8;

        for (int i = MIN_CCN; i <= MAX_CCN; ++i)
        {
            using (writer = XmlWriter.Create(CountingFilePath.filePath(i), setting))
            {
                writer.WriteStartElement("Counting");

                SaveBurstInfo(writer, i);

                SaveInsuranceHand(writer, i);

                SaveNotInsuranceHand(writer, i);

                writer.WriteEndElement();

                writer.Close();
            }
        }
    }
Beispiel #2
0
    void SetFirstAllFile()
    {
        XmlWriter         writer  = null;
        XmlWriterSettings setting = new XmlWriterSettings();

        setting.Indent   = true;
        setting.Encoding = Encoding.UTF8;

        for (int i = MIN_CCN; i <= MAX_CCN; ++i)
        {
            using (writer = XmlWriter.Create(CountingFilePath.filePath(i), setting))
            {
                writer.WriteStartElement("Counting"); //루트노드

                writer.WriteStartElement("Burst");    // 버스트 관련
                for (int j = 12; j <= 20; ++j)
                {
                    writer.WriteStartElement("Card" + j.ToString());
                    writer.WriteString("0/0");
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                for (int j = 0; j < 10; ++j)
                {
                    writer.WriteStartElement("Dealer_Hand");
                    writer.WriteAttributeString("_id", (j + 1).ToString()); // RemoveAfterComplete
                    for (int k = 0; k < 34; ++k)
                    {
                        writer.WriteStartElement("Player_Hand");
                        writer.WriteAttributeString("_id", ((SITUATION_KIND)k).ToString()); // RemoveAfterComplete

                        writer.WriteStartElement("Hit");
                        writer.WriteString("0/0");
                        writer.WriteEndElement();
                        writer.WriteStartElement("Stand");
                        writer.WriteString("0/0");
                        writer.WriteEndElement();
                        writer.WriteStartElement("DoubleDown");
                        writer.WriteString("0/0");
                        writer.WriteEndElement();
                        writer.WriteStartElement("Split");
                        writer.WriteString("0/0");
                        writer.WriteEndElement();
                        writer.WriteStartElement("Insurance");
                        writer.WriteString("0/0");
                        writer.WriteEndElement();

                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                }

                writer.WriteEndElement();

                writer.Close();
            }
        }
    }
Beispiel #3
0
    public void Load()
    {
        XmlDocument doc = new XmlDocument();

        // check if data files are created already
        if (!System.IO.File.Exists(CountingFilePath.filePath(0)))
        {
            SetFirstAllFile();
        }

        for (int i = MIN_CCN; i <= MAX_CCN; ++i)
        {
            doc.Load(CountingFilePath.filePath(i));

            XmlNodeList xnList = doc.SelectNodes("/Counting/Burst");
            LoadBurstInfo(i, xnList);

            xnList = doc.SelectNodes("/Counting/Dealer_Hand/Player_Hand");
            int playerHand = 0;

            //________________________________________인슈어런스________________________________
            for (int j = 0; j < 24; ++j)//
            {
                SetSingle(i, 0, playerHand,
                          new Situation_Info(
                              xnList[j]["Hit"].InnerText,
                              xnList[j]["Stand"].InnerText,
                              xnList[j]["DoubleDown"].InnerText,
                              "-1/-1",
                              xnList[j]["Insurance"].InnerText,
                              false,
                              true));

                ++playerHand;
            }
            for (int j = 24; j < 34; ++j) // 스플릿
            {
                SetSingle(i, 0, playerHand,
                          new Situation_Info(
                              xnList[j]["Hit"].InnerText,
                              xnList[j]["Stand"].InnerText,
                              xnList[j]["DoubleDown"].InnerText,
                              xnList[j]["Split"].InnerText,
                              xnList[j]["Insurance"].InnerText,
                              true,
                              true));

                ++playerHand;
            }
            playerHand = 0;
            for (int k = 1; k < 10; ++k)
            {
                for (int j = 0; j < 24; ++j)//
                {
                    int idx = j + k * 34;

                    SetSingle(i, k, playerHand,
                              new Situation_Info(
                                  xnList[idx]["Hit"].InnerText,
                                  xnList[idx]["Stand"].InnerText,
                                  xnList[idx]["DoubleDown"].InnerText,
                                  "-1/-1",
                                  "-1/-1",
                                  false,
                                  false));

                    ++playerHand;
                }
                for (int j = 24; j < 34; ++j) // 스플릿
                {
                    int idx = j + k * 34;

                    SetSingle(i, k, playerHand,
                              new Situation_Info(
                                  xnList[idx]["Hit"].InnerText,
                                  xnList[idx]["Stand"].InnerText,
                                  xnList[idx]["DoubleDown"].InnerText,
                                  xnList[idx]["Split"].InnerText,
                                  "-1/-1",
                                  true,
                                  false));

                    ++playerHand;
                }// nodeList

                playerHand = 0;
            }
        }// counting
    }