예제 #1
0
 protected override bool EqualsRDATA(RR rr)
 {
     return(PRIORITY.Equals(((SRV)rr).PRIORITY) &&
            WEIGHT.Equals(((SRV)rr).WEIGHT) &&
            PORT.Equals(((SRV)rr).PORT) &&
            TARGET.Equals(((SRV)rr).TARGET));
 }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        weight = WEIGHT.WT_PLAYER;

        test1 = WEIGHT.WT_PLAYER;
        test2 = WEIGHT.WT_FR_RUINS;
    }
예제 #3
0
    protected void GetBiggerSetForPair(WEIGHT weight, ref List <BigTwoPoker> currentSet, List <BigTwoPoker> currentHand, List <BigTwoPoker> lastSet, BigTwoDeck deck)
    {
        if (2 != lastSet.Count)
        {
            return;
        }
        if (lastSet [0]._pokerFace != lastSet [1]._pokerFace)
        {
            return;
        }
        List <List <BigTwoPoker> > listTargetPair = new List <List <BigTwoPoker> > ();

        for (int i = 0; i < currentHand.Count; i++)
        {
            BigTwoPoker poker1 = currentHand [i];
            for (int j = i + 1; j < currentHand.Count; j++)
            {
                BigTwoPoker poker2 = currentHand [j];
                if (poker1._pokerFace == poker2._pokerFace)
                {
                    List <BigTwoPoker> listPoker = new List <BigTwoPoker> ();
                    listPoker.Add(poker1);
                    listPoker.Add(poker2);
                    // PrintListPoker (listPoker);
                    // PrintListPoker (lastSet);
                    if (BigTwoRule.CompareResult.BIGGER == deck.Rule.IsPairBigger(listPoker, lastSet))
                    {
                        int insertPos = 0;
                        for (int k = listTargetPair.Count - 1; k >= 0; k--)
                        {
                            List <BigTwoPoker> pairInList = listTargetPair [k];
                            if (BigTwoRule.CompareResult.BIGGER == deck.Rule.IsPairBigger(listPoker, pairInList))
                            {
                                insertPos = k + 1;
                                break;
                            }
                        }
                        listTargetPair.Insert(insertPos, listPoker);
                    }
                }
            }
        }
        if (0 == listTargetPair.Count)
        {
            return;
        }
        int weightIndex = Mathf.RoundToInt((int)weight * 1.0f / (int)WEIGHT.THIRTEEN * listTargetPair.Count) - 1;

        weightIndex = Mathf.Clamp(weightIndex, 0, listTargetPair.Count - 1);
        List <BigTwoPoker> targetPair = listTargetPair [weightIndex];

        for (int i = 0; i < targetPair.Count; i++)
        {
            BigTwoPoker poker = targetPair [i];
            currentSet.Add(poker);
        }
    }
예제 #4
0
 public override string ToString(int namePadding)
 {
     // _sip._tcp.example.com. 86400 IN SRV 0 5 5060 sipserver.example.com.
     return(String.Join(" ", new string[] {
         Base.ToString(namePadding),
         PRIORITY.ToString(),
         WEIGHT.ToString(),
         PORT.ToString(),
         TARGET.ToString()
     }));
 }
예제 #5
0
 //比較する関数
 public COM_RESULT Hikaku(WEIGHT one, WEIGHT two)
 {
     //同じ
     if (one == two)
     {
         return(COM_RESULT.CR_EQUAL);
     }
     //引数1が大きい
     else if (one > two)
     {
         return(COM_RESULT.CR_ONE);
     }
     //引数2が大きい
     else
     {
         return(COM_RESULT.CR_TWO);
     }
 }
예제 #6
0
    protected void GetBiggerSetForSingle(WEIGHT weight, ref List <BigTwoPoker> currentSet, List <BigTwoPoker> currentHand, List <BigTwoPoker> lastSet, BigTwoDeck deck)
    {
        if (1 != lastSet.Count)
        {
            return;
        }
        BigTwoPoker        lastPoker       = lastSet [0];
        List <BigTwoPoker> listTargetPoker = new List <BigTwoPoker> ();

        for (int i = 0; i < currentHand.Count; i++)
        {
            BigTwoPoker poker = currentHand [i];
            if (BigTwoRule.CompareResult.BIGGER == deck.Rule.IsPokerBigger(poker, lastPoker))
            {
                int insertPos = 0;
                for (int j = listTargetPoker.Count - 1; j >= 0; j--)
                {
                    BigTwoPoker pokerInList = listTargetPoker [j];
                    if (BigTwoRule.CompareResult.BIGGER == deck.Rule.IsPokerBigger(poker, pokerInList))
                    {
                        insertPos = j + 1;
                        break;
                    }
                }
                listTargetPoker.Insert(insertPos, poker);
            }
        }
        if (0 == listTargetPoker.Count)
        {
            return;
        }
        int weightIndex = Mathf.RoundToInt((int)weight * 1.0f / (int)WEIGHT.THIRTEEN * listTargetPoker.Count) - 1;

        weightIndex = Mathf.Clamp(weightIndex, 0, listTargetPoker.Count - 1);
        BigTwoPoker targetPoker = listTargetPoker [weightIndex];

        currentSet.Add(targetPoker);
    }
예제 #7
0
    protected void GetBiggerSetForStraightFlush(WEIGHT weight, ref List <BigTwoPoker> currentSet, List <BigTwoPoker> currentHand, List <BigTwoPoker> lastSet, BigTwoDeck deck)
    {
        if (5 != lastSet.Count)
        {
            return;
        }
        for (int i = 0; i < lastSet.Count - 1; i++)
        {
            BigTwoPoker poker1 = lastSet [i];
            BigTwoPoker poker2 = lastSet [i + 1];
            if (1 != (poker2._pokerFace - poker1._pokerFace) || poker2._pokerType != poker1._pokerType)
            {
                return;
            }
        }
        List <List <BigTwoPoker> > listTarget = new List <List <BigTwoPoker> > ();

        for (int i = 0; i < currentHand.Count; i++)
        {
            BigTwoPoker poker1 = currentHand [i];
            for (int j = i + 1; j < currentHand.Count; j++)
            {
                BigTwoPoker poker2 = currentHand [j];
                if (1 != (poker2._pokerFace - poker1._pokerFace) || poker2._pokerType != poker1._pokerType)
                {
                    continue;
                }
                for (int k = j + 1; k < currentHand.Count; k++)
                {
                    BigTwoPoker poker3 = currentHand [k];
                    if (1 != (poker3._pokerFace - poker2._pokerFace) || poker3._pokerType != poker2._pokerType)
                    {
                        continue;
                    }
                    for (int l = k + 1; l < currentHand.Count; l++)
                    {
                        BigTwoPoker poker4 = currentHand [l];
                        if (1 != (poker4._pokerFace - poker3._pokerFace) || poker4._pokerType != poker3._pokerType)
                        {
                            continue;
                        }
                        for (int m = l + 1; m < currentHand.Count; m++)
                        {
                            BigTwoPoker poker5 = currentHand [m];
                            if (1 != (poker5._pokerFace - poker4._pokerFace) || poker5._pokerType != poker4._pokerType)
                            {
                                continue;
                            }
                            List <BigTwoPoker> listPoker = new List <BigTwoPoker> ();
                            listPoker.Add(poker1);
                            listPoker.Add(poker2);
                            listPoker.Add(poker3);
                            listPoker.Add(poker4);
                            listPoker.Add(poker5);
                            if (BigTwoRule.CompareResult.BIGGER != deck.Rule.IsStraightFlushBigger(listPoker, lastSet))
                            {
                                continue;
                            }
                            int insertPos = 0;
                            for (int n = listTarget.Count - 1; n >= 0; n--)
                            {
                                List <BigTwoPoker> pairInList = listTarget [n];
                                if (BigTwoRule.CompareResult.BIGGER == deck.Rule.IsStraightFlushBigger(listPoker, pairInList))
                                {
                                    insertPos = n + 1;
                                    break;
                                }
                            }
                            listTarget.Insert(insertPos, listPoker);
                        }
                    }
                }
            }
        }
        if (0 == listTarget.Count)
        {
            return;
        }
        int weightIndex = Mathf.RoundToInt((int)weight * 1.0f / (int)WEIGHT.THIRTEEN * listTarget.Count) - 1;

        weightIndex = Mathf.Clamp(weightIndex, 0, listTarget.Count - 1);
        List <BigTwoPoker> targetPair = listTarget [weightIndex];

        for (int i = 0; i < targetPair.Count; i++)
        {
            BigTwoPoker poker = targetPair [i];
            currentSet.Add(poker);
        }
    }
예제 #8
0
    protected void Button_find_diamonds_Click(object sender, EventArgs e)
    {
        List <string> list_shapes   = new List <string>();
        List <string> list_clarity  = new List <string>();
        List <string> list_color    = new List <string>();
        List <string> list_cut      = new List <string>();
        List <string> list_polish   = new List <string>();
        List <string> list_symmetry = new List <string>();
        List <string> list_lab      = new List <string>();
        double        weightMin;
        double        weightMax;
        double        priceMin;
        double        priceMax;
        string        name;


        #region SHAPE
        List <string> list_shapes_ = s.readfromyDS("Shape");
        foreach (var S in list_shapes_)
        {
            var chk_SHAPE = (HtmlInputCheckBox)SAHPE.FindControl("ShapeCB_" + S.ToString());


            if (chk_SHAPE.Checked == true)
            {
                list_shapes.Add(S.ToString());
            }
        }


        #endregion

        #region Weight

        HtmlInputGenericControl weightMin_control = (HtmlInputGenericControl)WEIGHT.FindControl("weightMin");
        if (weightMin_control.Value == "".ToString())
        {
            weightMin_control.Value = "0.1";
        }
        weightMin = Convert.ToDouble(weightMin_control.Value);

        HtmlInputGenericControl weightMax_control = (HtmlInputGenericControl)WEIGHT.FindControl("weightMax");
        if (weightMax_control.Value == "".ToString())
        {
            weightMax_control.Value = "0.1";
        }
        weightMax = Convert.ToDouble(weightMax_control.Value);

        #endregion

        #region Price

        HtmlInputGenericControl priceMin_control = (HtmlInputGenericControl)WEIGHT.FindControl("priceMin");
        if (priceMin_control.Value == "".ToString())
        {
            priceMin_control.Value = "1";
        }
        priceMin = Convert.ToDouble(priceMin_control.Value.ToString());

        HtmlInputGenericControl priceMax_control = (HtmlInputGenericControl)WEIGHT.FindControl("priceMax");
        if (priceMax_control.Value == "".ToString())
        {
            priceMax_control.Value = "1";
        }
        priceMax = Convert.ToDouble(priceMax_control.Value.ToString());

        #endregion

        #region CLARITY
        List <string> list_clarity_ = s.readfromyDS("Clarity");
        foreach (var C in list_clarity_)
        {
            CheckBox chk_CLARITY = (CheckBox)CLARITY.FindControl("ClarityCB_" + C.ToString());
            if (chk_CLARITY.Checked == true)
            {
                list_clarity.Add(C.ToString());
            }
        }

        #endregion

        #region COLOR
        List <string> list_color_ = s.readfromyDS("Color");
        foreach (var CR in list_color_)
        {
            CheckBox chk_COLOR = (CheckBox)COLOR.FindControl("ColorCB_" + CR.ToString());
            if (chk_COLOR.Checked == true)
            {
                list_color.Add(CR.ToString());
            }
        }

        #endregion

        #region CUT
        List <string> list_cut_ = s.readfromyDS("Cut");
        foreach (var CU_ in list_cut_)
        {
            CheckBox chk_CUT = (CheckBox)CUT.FindControl("CutCB_" + CU_.ToString());
            if (chk_CUT.Checked == true)
            {
                list_cut.Add(CU_.ToString());
            }
        }
        #endregion

        #region POLISH
        List <string> list_polish_ = s.readfromyDS("Polish");
        foreach (var P in list_polish_)
        {
            CheckBox chk_P = (CheckBox)POLISH.FindControl("PolishCB_" + P.ToString());
            if (chk_P.Checked == true)
            {
                list_polish.Add(P.ToString());
            }
        }
        #endregion

        #region SYMMETRY
        List <string> list_symmetry_ = s.readfromyDS("Symmetry");
        foreach (var SYM in list_symmetry_)
        {
            CheckBox chk_SYM = (CheckBox)SYMMETRY.FindControl("SymmetryCB_" + SYM.ToString());
            if (chk_SYM.Checked == true)
            {
                list_symmetry.Add(SYM.ToString());
            }
        }

        #endregion

        #region LAB
        List <string> list_lab_ = s.readfromyDS("Lab");
        foreach (var LAB_ in list_lab_)
        {
            CheckBox chk_LAB = (CheckBox)LAB.FindControl("LabCB_" + LAB_.ToString());
            if (chk_LAB.Checked == true)
            {
                list_lab.Add(LAB_.ToString());
            }
        }

        #endregion

        #region Name

        HtmlInputText txt_name = (HtmlInputText)NAME.FindControl("Search_By_ID".ToString());
        name = txt_name.Value;

        #endregion

        addproducts_after_filter(list_shapes,
                                 list_clarity,
                                 list_color,
                                 list_cut,
                                 list_polish,
                                 list_symmetry,
                                 list_lab,
                                 weightMin,
                                 weightMax,
                                 priceMin,
                                 priceMax,
                                 name);
    }