Esempio n. 1
0
        /// <summary>
        /// ナナメ段を抜き出してビットボードにします。
        /// </summary>
        /// <param name="yomiSg"></param>
        /// <param name="tai"></param>
        /// <param name="kikiDir"></param>
        /// <param name="ms"></param>
        /// <returns></returns>
        public static Bitboard GetOjhsh(
            TobikikiDirection kikiDir,
            Masu ms
            )
        {
            bool           sakasa_forZHs  = Conv_TobikikiDirection.sakasa_forZHs[(int)kikiDir];
            OjamaBanSyurui ojamaBanSyurui = Conv_TobikikiDirection.ojamaBanSyuruiItiran[(int)kikiDir];

            int[] masuSpans = new int[]
            {
                MasSpanKT,
                MasSpanKY,
                MasSpanKT,
                MasSpanZHa,
                MasSpanZHs,
            };
            int masuSpan = masuSpans[(int)kikiDir];

            int  nanamedanD;
            Masu atama_reverseRotateChikanhyo;
            Masu atama_noRotateMotohyo;
            Masu siri_noRotateMotohyo;
            int  haba;

            FromMasu(kikiDir, masuSpan, sakasa_forZHs, ms,
                     out nanamedanD,
                     out atama_reverseRotateChikanhyo,
                     out atama_noRotateMotohyo,
                     out siri_noRotateMotohyo,
                     out haba
                     );
#if DEBUG
            PureMemory.ssssDbg_sakasa_forZHs  = sakasa_forZHs;
            PureMemory.ssssDbg_ojamaBanSyurui = ojamaBanSyurui;
            PureMemory.ssssDbg_masuSpan       = masuSpan;
            PureMemory.ssssDbg_nanamedanD     = nanamedanD;
            PureMemory.ssssDbg_atama_reverseRotateChikanhyo = atama_reverseRotateChikanhyo;
            PureMemory.ssssDbg_atama_noRotateMotohyo        = atama_noRotateMotohyo;
            PureMemory.ssssDbg_siri_noRotateMotohyo         = siri_noRotateMotohyo;
            PureMemory.ssssDbg_haba = haba;
#endif

            if (ojamaBanSyurui == OjamaBanSyurui.None)
            {
                // 横型と想定
                // 本将棋の場合、9一が再下位ビット
                // [ 0][ 1][ 2][ 3][ 4][ 5][ 6][ 7][ 8]
                // [ 9]...
                Bitboard bb = PureMemory.gky_ky.yomiKy.yomiShogiban.yomiIbashoBan.CloneKomaZenbuBothTai();
#if DEBUG
                PureMemory.ssssDbg_bb_ojamaTai = bb.Clone();
#endif
                return(OjamaBan.YomiOjamaBan.Nukidasi_1(atama_reverseRotateChikanhyo, haba, bb));
            }
            else
            {
                OjamaBan.YomiOjamaBan yomiOjamaBan = PureMemory.gky_ky.yomiKy.yomiShogiban.GetYomiOjamaBan(ojamaBanSyurui);
                return(yomiOjamaBan.Nukidasi(atama_reverseRotateChikanhyo, haba));
            }
        }
Esempio n. 2
0
        public static void Setumei(TobikikiDirection kikiDir, StringBuilder hyoji)
        {
            OjamaBanSyurui ojamaBanSyurui = Conv_TobikikiDirection.ojamaBanSyuruiItiran[(int)kikiDir];

            switch (kikiDir)
            {
            case TobikikiDirection.KT:
            case TobikikiDirection.S:
            {
                OjamaBan.YomiOjamaBan yomiOjamaBan = PureMemory.gky_ky.yomiKy.yomiShogiban.GetYomiOjamaBan(ojamaBanSyurui);
                int dLen = PureSettei.banYokoHaba;

                hyoji.AppendLine("90°回転");
                int iMs = 0;
                for (int d = 0; d < dLen; d++)
                {
                    int haba = Util_Tobikiki.GetNanameDanHaba(d, kikiDir);

                    for (int x = 0; x < haba; x++)
                    {
                        hyoji.Append(yomiOjamaBan.ExistsBB((Masu)iMs) ? "〇" : "・");
                        iMs++;
                    }
                    hyoji.AppendLine();
                }
            }
            break;

            case TobikikiDirection.KY:
            case TobikikiDirection.None:
            {
                // お邪魔盤は無いので、将棋盤から取ってくる
                Bitboard bb_shogi = PureMemory.gky_ky.yomiKy.yomiShogiban.yomiIbashoBan.CloneKomaZenbuBothTai();

                Setumei_yk00("回転なし", bb_shogi, hyoji);
            }
            break;

            case TobikikiDirection.ZHa:
            case TobikikiDirection.ZHs:
            {
                OjamaBan.YomiOjamaBan yomiOjamaBan = PureMemory.gky_ky.yomiKy.yomiShogiban.GetYomiOjamaBan(ojamaBanSyurui);

                hyoji.AppendLine("45°回転");
                ScanAndHyojiHisigata((Masu ms) =>
                    {
                        return(yomiOjamaBan.ExistsBB(ms) ? "〇" : "・");
                    },
                                     kikiDir, hyoji);
            }
            break;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 将棋盤をコンソールへ出力するぜ☆(^▽^)
        /// ログに向いた、シンプルな表示☆
        /// </summary>
        /// <returns></returns>
        public static void Setumei_Kyokumen(int teme, OjamaBanSyurui ojamaBanSyurui, StringBuilder hyoji)
        {
            int banYokoHaba_tmp = PureSettei.banYokoHaba;
            int banTateHaba_tmp = PureSettei.banTateHaba;

            if (ojamaBanSyurui == OjamaBanSyurui.Ht90)
            {
                int tmp = banYokoHaba_tmp;
                banYokoHaba_tmp = banTateHaba_tmp;
                banTateHaba_tmp = tmp;
            }

            Setumei_Hanyo((int dan, Masu ms) =>
            {
                bool exists = PureMemory.gky_ky.yomiKy.yomiShogiban.GetYomiOjamaBan(ojamaBanSyurui).ExistsBB(ms);
                return(exists ? " 〇 " : "    ");
            },
                          banYokoHaba_tmp, banTateHaba_tmp, teme, hyoji);
        }
Esempio n. 4
0
 public OjamaBan.YomiOjamaBan GetYomiOjamaBan(OjamaBanSyurui ojamaBanSyurui)
 {
     return(yomi_ojamaBanItiran_[(int)ojamaBanSyurui]);
 }