예제 #1
0
        /// <summary>
        /// 合法手レベル1
        /// </summary>
        /// <returns></returns>
        public static SySet <SyElement> Create_01Fu(Playerside pside, SyElement masu_ji)
        {
            //----------------------------------------
            // 歩
            //----------------------------------------
            SySet_Default <SyElement> dst = new SySet_Default <SyElement>("歩の移動先");

            if (Okiba.ShogiBan == Conv_SyElement.ToOkiba(masu_ji))
            {
                //----------------------------------------
                // 将棋盤上の歩の移動先
                //----------------------------------------
                dst.AddSupersets(KomanoKidou.DstIppo_上(pside, masu_ji));
            }
            else if ((Okiba.Sente_Komadai | Okiba.Gote_Komadai).HasFlag(
                         Conv_SyElement.ToOkiba(masu_ji)))
            {
                //----------------------------------------
                // 駒台上の歩の移動先
                //----------------------------------------
                dst.AddSupersets(KomanoKidou.Dst_歩打面(pside));
            }

            return(dst);
        }
예제 #2
0
        /// <summary>
        /// 合法手レベル1
        /// </summary>
        /// <returns></returns>
        public static SySet <SyElement> Create_02Kyo(Playerside pside, SyElement masu_ji)
        {
            SySet_Default <SyElement> dst = new SySet_Default <SyElement>("香の移動先");

            if (Okiba.ShogiBan == Util_Masu.Masu_ToOkiba(masu_ji))
            {
                dst.AddSupersets(KomanoKidou.DstKantu_上(pside, masu_ji));
            }
            else if ((Okiba.Sente_Komadai | Okiba.Gote_Komadai).HasFlag(
                         Util_Masu.Masu_ToOkiba(masu_ji)))
            {
                dst.AddSupersets(KomanoKidou.Dst_歩打面(pside));//香も同じ
            }

            return(dst);
        }
예제 #3
0
        public static SySet <SyElement> CreateKin_static(Playerside pside, SyElement masu_ji)
        {
            SySet_Default <SyElement> dst = new SySet_Default <SyElement>("カナゴマの移動先");

            if (Okiba.ShogiBan == Util_Masu.Masu_ToOkiba(masu_ji))
            {
                dst.AddSupersets(KomanoKidou.DstIppo_上(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstIppo_昇(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstIppo_射(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstIppo_引(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstIppo_滑(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstIppo_浮(pside, masu_ji));
            }

            return(dst);
        }
예제 #4
0
        /// <summary>
        /// 合法手レベル1
        /// </summary>
        /// <returns></returns>
        public static SySet <SyElement> Create_05Kin(Playerside pside, SyElement masu_ji)
        {
            SySet <SyElement> dst = new SySet_Default <SyElement>("金の移動先");

            if (Okiba.ShogiBan == Util_Masu.Masu_ToOkiba(masu_ji))
            {
                dst = Rule01_PotentialMove_15Array.CreateKin_static(pside, masu_ji);
            }
            else if ((Okiba.Sente_Komadai | Okiba.Gote_Komadai).HasFlag(
                         Util_Masu.Masu_ToOkiba(masu_ji)))
            {
                dst.AddSupersets(KomanoKidou.Dst_全打面(pside));
            }

            return(dst);
        }
예제 #5
0
        /// <summary>
        /// 合法手レベル1
        /// </summary>
        /// <returns></returns>
        public static SySet <SyElement> Create_03Kei(Playerside pside, SyElement masu_ji)
        {
            SySet_Default <SyElement> dst = new SySet_Default <SyElement>("桂の移動先");

            if (Okiba.ShogiBan == Util_Masu.Masu_ToOkiba(masu_ji))
            {
                dst.AddSupersets(KomanoKidou.DstKeimatobi_駆(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstKeimatobi_跳(pside, masu_ji));
            }
            else if ((Okiba.Sente_Komadai | Okiba.Gote_Komadai).HasFlag(
                         Util_Masu.Masu_ToOkiba(masu_ji)))
            {
                dst.AddSupersets(KomanoKidou.Dst_桂打面(pside));
            }

            return(dst);
        }
예제 #6
0
        /// <summary>
        /// 合法手レベル1
        /// </summary>
        /// <returns></returns>
        public static SySet <SyElement> Create_08Kaku(Playerside pside, SyElement masu_ji)
        {
            SySet_Default <SyElement> dst = new SySet_Default <SyElement>("角の移動先");

            if (Okiba.ShogiBan == Conv_SyElement.ToOkiba(masu_ji))
            {
                dst.AddSupersets(KomanoKidou.DstKantu_昇(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstKantu_沈(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstKantu_降(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstKantu_浮(pside, masu_ji));
            }
            else if ((Okiba.Sente_Komadai | Okiba.Gote_Komadai).HasFlag(
                         Conv_SyElement.ToOkiba(masu_ji)))
            {
                dst.AddSupersets(KomanoKidou.Dst_全打面(pside));
            }

            return(dst);
        }
예제 #7
0
        /// <summary>
        /// 合法手レベル1
        /// </summary>
        /// <returns></returns>
        public static SySet <SyElement> Create_04Gin(Playerside pside, SyElement masu_ji)
        {
            SySet_Default <SyElement> dst = new SySet_Default <SyElement>("銀の移動先");

            if (Okiba.ShogiBan == Util_Masu.Masu_ToOkiba(masu_ji))
            {
                dst.AddSupersets(KomanoKidou.DstIppo_上(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstIppo_昇(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstIppo_沈(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstIppo_降(pside, masu_ji));
                dst.AddSupersets(KomanoKidou.DstIppo_浮(pside, masu_ji));
            }
            else if ((Okiba.Sente_Komadai | Okiba.Gote_Komadai).HasFlag(
                         Util_Masu.Masu_ToOkiba(masu_ji)))
            {
                dst.AddSupersets(KomanoKidou.Dst_全打面(pside));
            }

            return(dst);
        }
예제 #8
0
        /// <summary>
        /// インポート
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImport_Click(object sender, EventArgs e)
        {
            string input = this.txtImport.Text;

            string[] definitions = input.Split(';');

            foreach (string definition in definitions)
            {
                if (-1 != definition.IndexOf('∈'))
                {
                    string[] operands = definition.Split('∈');

                    string[] elements;
                    if (-1 != operands[0].IndexOf(','))
                    {
                        elements = operands[0].Split(',');
                    }
                    else
                    {
                        elements = new string[] { operands[0] };
                    }

                    SySet <SyElement> sySet = this.syDictionary.GetWord(operands[1]);
                    if (null == sySet)
                    {
                        sySet = new SySet_Default <SyElement>(operands[1]);
                    }

                    foreach (string element in elements)
                    {
                        sySet.AddElement(new SyElement_Default(element));
                    }

                    this.syDictionary.AddWord(operands[1], sySet);
                }
                else if (-1 != definition.IndexOf('⊂'))
                {
                    string[] operands = definition.Split('⊂');

                    string[] subsets;
                    if (-1 != operands[0].IndexOf(','))
                    {
                        subsets = operands[0].Split(',');
                    }
                    else
                    {
                        subsets = new string[] { operands[0] };
                    }

                    SySet <SyElement> sySet_super = this.syDictionary.GetWord(operands[1]);
                    if (null == sySet_super)
                    {
                        sySet_super = new SySet_Default <SyElement>(operands[1]);
                        this.syDictionary.AddWord(operands[1], sySet_super);
                    }

                    foreach (string subset in subsets)
                    {
                        SySet <SyElement> sySet_subset = this.syDictionary.GetWord(subset);
                        if (null == sySet_subset)
                        {
                            sySet_subset = new SySet_Default <SyElement>(subset);
                            this.syDictionary.AddWord(subset, sySet_subset);
                        }

                        sySet_subset.AddSupersets(sySet_super);
                    }

                    this.syDictionary.AddWord(operands[1], sySet_super);
                }
                else
                {
                }
            }

            //this.txtImport.Text = "";
        }
예제 #9
0
        /// <summary>
        /// ************************************************************************************************************************
        /// 将棋盤の描画はここに書きます。
        /// ************************************************************************************************************************
        /// </summary>
        /// <param name="g"></param>
        public void Paint(Graphics g)
        {
            if (!this.Visible)
            {
                goto gt_EndMethod;
            }

            //----------
            // 筋の数字
            //----------
            for (int i = 0; i < 9; i++)
            {
                g.DrawString(ConverterKnSh.Int_ToArabiaSuji(i + 1), new Font("MS ゴシック", 25.0f), Brushes.Black, new Point((8 - i) * this.MasuWidth + this.Bounds.X - 8, -1 * this.MasuHeight + this.Bounds.Y));
            }

            //----------
            // 段の数字
            //----------
            for (int i = 0; i < 9; i++)
            {
                g.DrawString(ConverterKnSh.Int_ToKanSuji(i + 1), new Font("MS ゴシック", 23.0f), Brushes.Black, new Point(9 * this.MasuWidth + this.Bounds.X, i * this.MasuHeight + this.Bounds.Y));
                g.DrawString(Converter04.Int_ToAlphabet(i + 1), new Font("MS ゴシック", 11.0f), Brushes.Black, new Point(9 * this.MasuWidth + this.Bounds.X, i * this.MasuHeight + this.Bounds.Y));
            }


            //----------
            // 水平線
            //----------
            for (int i = 0; i < 10; i++)
            {
                g.DrawLine(Pens.Black,
                           0 * this.MasuWidth + this.Bounds.X,
                           i * this.MasuHeight + this.Bounds.Y,
                           9 * this.MasuHeight + this.Bounds.X,
                           i * this.MasuHeight + this.Bounds.Y
                           );
            }

            //----------
            // 垂直線
            //----------
            for (int i = 0; i < 10; i++)
            {
                g.DrawLine(Pens.Black,
                           i * this.MasuWidth + this.Bounds.X,
                           0 * this.MasuHeight + this.Bounds.Y,
                           i * this.MasuHeight + this.Bounds.X,
                           9 * this.MasuHeight + this.Bounds.Y
                           );
            }


            //----------
            // 升目
            //----------
            foreach (UserWidget widget in this.Owner.Widgets.Values)
            {
                if ("Masu" == widget.Type && Okiba.ShogiBan == widget.Okiba)
                {
                    Shape_BtnMasuImpl cell   = (Shape_BtnMasuImpl)widget.Object;
                    SySet <SyElement> masus2 = new SySet_Default <SyElement>("何かの升");
                    masus2.AddElement(Masu_Honshogi.Items_All[widget.MasuHandle]);

                    cell.Kiki   = this.KikiBan.ContainsAll(masus2);
                    cell.KikiSu = this.HMasu_KikiKomaList[widget.MasuHandle].Count;
                    cell.Paint(g);
                }
            }

gt_EndMethod:
            ;
        }