Beispiel #1
0
        public void Exec(TalkGeneratorArgs args)
        {
            isSuccess = false;
            talkList  = new Dictionary <string, double>();

            // 日が変わったら宣言していない状態に戻す
            if (args.Agi.Day > latestUpdateDay)
            {
                voteTarget = null;
            }

            // 4人以下の場合は宣言しない
            if (args.Agi.TodayInfo.DayTimeAliveAgent.Count <= 4)
            {
                return;
            }

            Agent newTarget = args.ActionPlan.VoteTarget;

            if (newTarget != null && !newTarget.Equals(voteTarget))
            {
                voteTarget = newTarget;

                latestUpdateDay = args.Agi.Day;
                isSuccess       = true;

                VoteContentBuilder    voteBuilder = new VoteContentBuilder(newTarget);
                RequestContentBuilder reqBuilder  = new RequestContentBuilder(null, new Content(voteBuilder));
                talkList.Add(new Content(reqBuilder).Text, 1.0);
            }
        }
Beispiel #2
0
        public void Exec(TalkGeneratorArgs args)
        {
            isSuccess = false;
            talkList  = new Dictionary <string, double>();

            // 騙り判定を取得できなければ実行失敗にする
            if (!args.Items.ContainsKey("FakeSeerJudge"))
            {
                return;
            }

            // 騙り判定の取得
            List <Judge> judgeList = (List <Judge>)args.Items["FakeSeerJudge"];

            // 全て報告済みなら実行失敗にする
            if (judgeList.Count <= reportCount)
            {
                return;
            }

            Judge reportJudge = judgeList[reportCount];

            DivinedResultContentBuilder builder = new DivinedResultContentBuilder(reportJudge.Target, reportJudge.Result);

            talkList.Add(new Content(builder).Text, 999.0);

            // 報告件数のカウント(必ずこの発話を返す前提)
            reportCount++;

            isSuccess = true;
        }
Beispiel #3
0
        public string Generation(TalkGeneratorArgs args)
        {
            // 戦略が設定されていない場合
            if (ActionStrategy == null)
            {
                return(Content.OVER.Text);
            }

            ActionStrategy.Exec(args);

            if (ActionStrategy.IsSuccess())
            {
                Dictionary <string, double> ret = ActionStrategy.GetTalk();

                string maxScoreText = Content.OVER.Text;
                double maxScore     = double.MinValue;

                foreach (KeyValuePair <string, double> talk in ret)
                {
                    if (talk.Value > maxScore)
                    {
                        maxScore     = talk.Value;
                        maxScoreText = talk.Key;
                    }
                }

                return(maxScoreText);
            }
            else
            {
                // 実行に失敗した場合
                return(Content.OVER.Text);
            }
        }
Beispiel #4
0
        public void Exec(TalkGeneratorArgs args)
        {
            isSuccess = false;
            talkList  = new Dictionary <string, double>();

            // 宣言済みの投票先
            Agent voteTarget = null;

            if (args.Agi.TodayInfo.SaidVote.VoteMap.ContainsKey(args.Agi.Me))
            {
                voteTarget = args.Agi.TodayInfo.SaidVote.VoteMap[args.Agi.Me];
            }

            Agent newTarget = args.ActionPlan.VoteTarget;

            if (newTarget != null && (IsForce || !newTarget.Equals(voteTarget)))
            {
                voteTarget = newTarget;

                isSuccess = true;

                VoteContentBuilder builder = new VoteContentBuilder(newTarget);
                talkList.Add(new Content(builder).Text, 1.0);
            }
        }
Beispiel #5
0
        public override void DoUpdate(TalkGeneratorArgs args)
        {
            isSuccess = false;
            talkList  = new Dictionary <string, double>();

            // 子ノードを実行する
            foreach (ITreeTalkNode node in Child)
            {
                node.Exec(args);

                // 1つでも実行成功したら実行成功として続きのノードも続行
                if (node.IsSuccess())
                {
                    isSuccess = true;

                    // 結果のマージ
                    foreach (KeyValuePair <string, double> talk in node.GetTalk())
                    {
                        if (talkList.ContainsKey(talk.Key))
                        {
                            talkList.Add(talk.Key, talk.Value);
                        }
                        else
                        {
                            talkList[talk.Key] *= talk.Value;
                        }
                    }
                }
            }
        }
Beispiel #6
0
        public void Exec(TalkGeneratorArgs args)
        {
            isSuccess = false;
            talkList  = new Dictionary <string, double>();

            // 全て報告済みなら実行失敗にする
            if (args.Agi.MySeerJudge.Count <= reportCount)
            {
                return;
            }

            List <Agent> seerList = args.Agi.GetComingOutAgent(Role.SEER);

            Judge reportJudge = args.Agi.MySeerJudge[reportCount];

            // 初回占い結果が人間かつ対抗でない場合、次点占い先候補に人狼判定を出す
            if (args.Agi.Day == 1 && reportJudge.Result == Species.HUMAN && !seerList.Contains(reportJudge.Target) && new System.Random().NextDouble() < 0.9)
            {
                reportJudge = new Judge(0, args.Agi.Me, args.ActionPlan.DevineTarget, Species.WEREWOLF);
            }

            DivinedResultContentBuilder builder = new DivinedResultContentBuilder(reportJudge.Target, reportJudge.Result);

            talkList.Add(new Content(builder).Text, 999.0);

            // 報告件数のカウント(必ずこの発話を返す前提)
            reportCount++;

            isSuccess = true;
        }
Beispiel #7
0
        /// <summary>
        /// 発話生成を実行する
        /// </summary>
        /// <param name="args">発話引数</param>
        public void Exec(TalkGeneratorArgs args)
        {
            // 条件を1つでも満たさなければ実行失敗
            foreach (Predicate <TalkGeneratorArgs> condition in Condition)
            {
                if (!condition.Invoke(args))
                {
                    isSuccess = false;
                    return;
                }
            }

            // 発話生成を実行する(各クラス固有の内部動作)
            DoUpdate(args);
        }
Beispiel #8
0
        public void Exec(TalkGeneratorArgs args)
        {
            // 役職が不正な場合
            if (Role == Role.UNC)
            {
                isSuccess = false;
                return;
            }

            isSuccess = true;
            talkList  = new Dictionary <string, double>();

            ComingoutContentBuilder builder = new ComingoutContentBuilder(args.Agi.Me, Role);

            talkList.Add(new Content(builder).Text, 1.0);
        }
Beispiel #9
0
        public void Exec(TalkGeneratorArgs args)
        {
            double judgeValue = ExtRandom.Instance.Rnd.NextDouble();

            if (judgeValue < SuccessProbability)
            {
                Child.Exec(args);
                isSuccess = Child.IsSuccess();
                talkList  = Child.GetTalk();
            }
            else
            {
                isSuccess = false;
                talkList  = new Dictionary <string, double>();
            }
        }
Beispiel #10
0
        public override void DoUpdate(TalkGeneratorArgs args)
        {
            isSuccess = false;

            // 子ノードを実行する
            foreach (ITreeTalkNode node in Child)
            {
                node.Exec(args);

                // 1つでも実行成功したら実行成功として終了
                if (node.IsSuccess())
                {
                    isSuccess = true;
                    talkList  = node.GetTalk();
                    return;
                }
            }
        }
Beispiel #11
0
        public virtual string Talk()
        {
            try
            {
                TalkGeneratorArgs args = new TalkGeneratorArgs {
                    Agi = Agi
                };
                return(TalkGenerator.Generation(args));
            }
            catch (Exception)
            {
                if (!isIgnoreError)
                {
                    throw;
                }

                return(Content.OVER.Text);
            }
        }
Beispiel #12
0
        public override string Talk()
        {
            try
            {
                TalkGeneratorArgs args = new TalkGeneratorArgs {
                    Agi = Agi, GuessResult = LatestGuess, ActionPlan = LatestPlan
                };
                args.Items.Add("FakeSeerJudge", fakeSeerJudge);
                args.Items.Add("AgentStatistics", statistics);

                return(TalkGenerator.Generation(args));
            }
            catch (Exception)
            {
                if (!isIgnoreError)
                {
                    throw;
                }

                return(Content.OVER.Text);
            }
        }
Beispiel #13
0
        public void Exec(TalkGeneratorArgs args)
        {
            isSuccess = false;
            talkList  = new Dictionary <string, double>();

            // 全て報告済みなら実行失敗にする
            if (args.Agi.MyMediumJudge.Count <= reportCount)
            {
                return;
            }

            Judge reportJudge = args.Agi.MyMediumJudge[reportCount];

            IdentContentBuilder builder = new IdentContentBuilder(reportJudge.Target, reportJudge.Result);

            talkList.Add(new Content(builder).Text, 999.0);

            // 報告件数のカウント(必ずこの発話を返す前提)
            reportCount++;

            isSuccess = true;
        }
Beispiel #14
0
 public void Exec(TalkGeneratorArgs args)
 {
     // do nothing
 }
Beispiel #15
0
 /// <summary>
 /// 発話生成を実行する(各クラス固有の内部動作)
 /// </summary>
 /// <returns>発話候補の内容とスコア</returns>
 public abstract void DoUpdate(TalkGeneratorArgs args);