示例#1
0
        /// <summary>
        /// FIXME: 使ってない?
        ///
        /// 変換「自駒が動ける升」→「自駒が動ける手」
        /// </summary>
        /// <param name="kmDic_Self"></param>
        /// <returns></returns>
        public static Maps_OneAndMulti <Finger, IMove> ToKomabetuMove(
            Maps_OneAndOne <Finger, SySet <SyElement> > kmDic_Self,
            Node <IMove, KyokumenWrapper> siteiNode_genzai
            )
        {
            Maps_OneAndMulti <Finger, IMove> komaTe = new Maps_OneAndMulti <Finger, IMove>();

            //
            //
            kmDic_Self.Foreach_Entry((Finger key, SySet <SyElement> value, ref bool toBreak) =>
            {
                foreach (SyElement masuHandle in value.Elements)
                {
                    RO_Star koma = Util_Starlightable.AsKoma(siteiNode_genzai.Value.KyokumenConst.StarlightIndexOf(key).Now);


                    IMove move = new RO_Starbeam(
                        //key,
                        // 元
                        koma,
                        // 先
                        new RO_Star(
                            koma.Pside,
                            Masu_Honshogi.Masus_All[Conv_SyElement.ToMasuNumber(masuHandle)],
                            koma.Haiyaku    //TODO:成るとか考えたい
                            ),

                        PieceType.None    //取った駒不明
                        );
                    //sbSfen.Append(sbSfen.ToString());

                    if (komaTe.ContainsKey(key))
                    {
                        // すでに登録されている駒
                        komaTe.AddExists(key, move);
                    }
                    else
                    {
                        // まだ登録されていない駒
                        komaTe.AddNew(key, move);
                    }
                }
            });

            return(komaTe);
        }
示例#2
0
        public Maps_OneAndMulti <T1, T2> ToClone()
        {
            Maps_OneAndMulti <T1, T2> map2 = new Maps_OneAndMulti <T1, T2>();

            foreach (KeyValuePair <T1, List <T2> > entry1 in this.Items)
            {
                T1        key1    = entry1.Key;
                List <T2> values1 = entry1.Value;

                foreach (T2 value1 in values1)
                {
                    if (map2.ContainsKey(key1))
                    {
                        map2.AddExists(key1, value1);
                    }
                    else
                    {
                        map2.AddNew(key1, value1);
                    }
                }
            }

            return(map2);
        }