Example #1
0
        /// <summary>
        /// 評価値の計算し直し。
        ///
        /// 多対多の項目の組み合わせを全部加算。
        /// </summary>
        /// <param name="ky"></param>
        /// <returns>手番の視点で返す</returns>
        public void KeisanSinaosi(Kyokumen ky)
        {
            // 駒の位置(評価関数の項目番号)をリストに入れておくぜ☆
            Util_NikomaKankei.MakeKoumokuBangoHairetu_Subete(ky, Util_NikomaKankei.KoumokuBangoHairetu1);

            // 評価値
            int hyokati = 0;

            for (int iGyoIndex = 0; iGyoIndex < Util_NikomaKankei.KoumokuBangoHairetu1.Nagasa; iGyoIndex++)
            {
                for (int iRetuIndex = 0; iRetuIndex < Util_NikomaKankei.KoumokuBangoHairetu1.Nagasa; iRetuIndex++)
                {
                    if (Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iGyoIndex] <= Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iRetuIndex])// 組み合わせを反対から見ただけの同じものを弾くぜ☆(^~^)
                    {
                        continue;
                    }

                    // 差分更新と比較するので、差分更新用☆(^~^)
                    //hyokati += Util_NikomaKankei.GetHyokaNumber_SabunKosinYou(Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iRetuIndex], Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iGyoIndex]);
                    // (^▽^)関数(小さい数字,大きい数字)だぜ☆ そうでなければ逆立ちさせるぜ☆(^▽^)www
                    if (Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iRetuIndex] < Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iGyoIndex])
                    {
                        hyokati += Util_NikomaKankei.GetHyokaNumber_SabunKosinYou(Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iRetuIndex], Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iGyoIndex]);
                    }
                    else if (Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iGyoIndex] < Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iRetuIndex])
                    {
                        // 逆立ち☆(^▽^)www
                        hyokati += Util_NikomaKankei.GetHyokaNumber_SabunKosinYou(Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iGyoIndex], Util_NikomaKankei.KoumokuBangoHairetu1.Hairetu[iRetuIndex]);
                    }
                }
            }

            if (hyokati < Util_NikomaKankei.SAISYO_HYOKATI_SABUNKOSINYOU)
            {
                hyokati = Util_NikomaKankei.SAISYO_HYOKATI_SABUNKOSINYOU;
            }
            else if (Util_NikomaKankei.SAIDAI_HYOKATI_SABUNKOSINYOU < hyokati)
            {
                hyokati = Util_NikomaKankei.SAIDAI_HYOKATI_SABUNKOSINYOU;
            }

            var(exists, phase) = ky.CurrentOptionalPhase.Match;
            if (exists)
            {
                if (phase == Phase.White)
                {
                    hyokati = -hyokati; // 対局者2視点に変えるぜ☆(^▽^)
                }
            }
            Hyokati = (Hyokati)hyokati;
        }
Example #2
0
 /// <summary>
 /// 反映するぜ☆(^▽^)
 /// </summary>
 /// <param name="ky"></param>
 /// <param name="mk"></param>
 /// <param name="ninsyo"></param>
 public void HaneiMotiKoma(Kyokumen ky, MotiKoma mk)
 {
     if (DebugOptions.EvaluationHand)
     {
         // 駒の位置(評価関数の項目番号)☆ 持ち駒が 0 枚で、-1 の場合もあり☆
         int koumokuNo = Util_NikomaKankei.GetKoumokuBango_MotiKoma(ky, mk);
         if (-1 != koumokuNo)
         {
             Util_NikomaKankei.MakeKoumokuBangoHairetu_Subete(ky, Util_NikomaKankei.KoumokuBangoHairetu1);
             Increase(
                 Util_NikomaKankei.Kazoeru_NikomaKankeiHyokati_ItiTaiTa_SabunKosinYou(ky, koumokuNo, Util_NikomaKankei.KoumokuBangoHairetu1
                                                                                      )
                 );
         }
     }
 }
Example #3
0
        /// <summary>
        /// 差分更新は、対局者1 の視点の盤で行えなんだぜ☆(^▽^)
        /// </summary>
        /// <param name="ky"></param>
        /// <param name="km"></param>
        /// <param name="ms"></param>
        /// <param name="fueta"></param>
        public void FuyasuBanjoKoma(Kyokumen ky, Koma km, Masu ms)
        {
            if (DebugOptions.AddPiecesOnBoard)
            {
                var optionalPiece = OptionalPiece.From(km);

                Debug.Assert(Conv_Koma.IsOk(optionalPiece), "");//空白とか禁止☆(^~^)!

                Util_NikomaKankei.MakeKoumokuBangoHairetu_Subete(ky, Util_NikomaKankei.KoumokuBangoHairetu1);

                Increase(
                    Util_NikomaKankei.Kazoeru_NikomaKankeiHyokati_ItiTaiTa_SabunKosinYou(ky,
                                                                                         Util_NikomaKankei.GetKoumokuBango_Banjo(ky, km, ms),// 駒の位置(評価関数の項目番号)をリストに入れておくぜ☆
                                                                                         Util_NikomaKankei.KoumokuBangoHairetu1
                                                                                         ));
            }
        }
Example #4
0
        public void KesuMotiKoma(Kyokumen ky, MotiKoma mk)
        {
            if (DebugOptions.ReduceHand)
            {
                // 駒の位置(評価関数の項目番号)☆ 持ち駒が 0 枚で、-1 の場合もあり☆
                int koumokuNo = Util_NikomaKankei.GetKoumokuBango_MotiKoma(ky, mk);
                // Debug.Assert(koumokuNo != -1, $"mk=[{mk}]");

                // 減点するぜ☆(^▽^)
                if (-1 != koumokuNo)
                {
                    Util_NikomaKankei.MakeKoumokuBangoHairetu_Subete(ky, Util_NikomaKankei.KoumokuBangoHairetu1);

                    Increase((Hyokati)(
                                 -(int)Util_NikomaKankei.Kazoeru_NikomaKankeiHyokati_ItiTaiTa_SabunKosinYou(ky, koumokuNo, Util_NikomaKankei.KoumokuBangoHairetu1)//評価値
                                 ));
                }
            }
        }