Beispiel #1
0
        public void Update(GuessStrategyArgs args)
        {
            // 実行結果のクリア
            isSuccess = false;
            guessList.Clear();

            // 初日は実行失敗
            if (args.Agi.Day <= 1)
            {
                return;
            }

            DayInfo dayInfo = args.Agi.DayInfo[1];

            foreach (ExtTalk talk in dayInfo.TalkList)
            {
                if (talk.Content.Operator == Operator.NOP && talk.Content.Topic == Topic.ESTIMATE && talk.Content.Role == Role.WEREWOLF)
                {
                    BitCondition con = new BitCondition();
                    con.AddWerewolf(talk.Agent);
                    con.AddWerewolf(talk.Content.Target);

                    guessList.Add(new PartGuess()
                    {
                        Condition   = con,
                        Correlation = 0.95,
                    });
                }
            }

            // 実行成功にする
            isSuccess = true;
        }
Beispiel #2
0
        public void Update(GuessStrategyArgs args)
        {
            // 実行結果のクリア
            guessList.Clear();

            foreach (DayInfo dayInfo in args.Agi.DayInfo.Values)
            {
                // その日の投票の取得
                VoteAnalyzer voteAnalyzer = null;
                if (dayInfo.VoteList.Count > 0)
                {
                    // 実際の投票(1回目の投票のみ)
                    voteAnalyzer = new VoteAnalyzer(dayInfo.VoteList[0]);
                }
                else if (dayInfo.Equals(args.Agi.TodayInfo))
                {
                    // 投票宣言
                    voteAnalyzer = new VoteAnalyzer(dayInfo.LatestAliveAgentList, dayInfo.TalkList, Topic.VOTE);
                }

                if (voteAnalyzer != null)
                {
                    foreach (KeyValuePair <Agent, Agent> vote in voteAnalyzer.VoteMap)
                    {
                        if (vote.Value != null)
                        {
                            BitCondition con = new BitCondition();
                            con.AddWerewolf(vote.Key);
                            con.AddWerewolf(vote.Value);
                            guessList.Add(new PartGuess()
                            {
                                Condition   = con,
                                Correlation = 0.7,
                            });

                            con = new BitCondition();
                            con.AddNotWerewolf(vote.Key);
                            con.AddNotWerewolf(vote.Value);
                            guessList.Add(new PartGuess()
                            {
                                Condition   = con,
                                Correlation = 0.95,
                            });
                        }
                    }
                }
            }

            // 実行成功にする
            isSuccess = true;
        }
Beispiel #3
0
        public void bit条件_複数エージェント狼()
        {
            for (int i = 0; i < loop; i++)
            {
                Viewpoint viewpoint = new Viewpoint(gameSetting15, gameInfo15);

                BitCondition con = new BitCondition();
                con.AddWerewolf(Agent.GetAgent(1));
                con.AddWerewolf(Agent.GetAgent(2));
                viewpoint.RemoveMatchPattern(con);

                Assert.AreEqual(viewpoint.MonsterSidePattern.Count, 5304);
            }
        }
Beispiel #4
0
        public void IsWolf_False()
        {
            BitCondition con = new BitCondition();

            con.AddWerewolf(Agent.GetAgent(3));

            Assert.AreEqual(con.IsMatch(pattern), false);
        }
Beispiel #5
0
        public void IsWolf_True2()
        {
            BitCondition con = new BitCondition();

            con.AddWerewolf(Agent.GetAgent(8));

            Assert.AreEqual(con.IsMatch(pattern), true);
        }
Beispiel #6
0
        public void SpeedCheck1()
        {
            BitCondition con = new BitCondition();

            con.AddWerewolf(Agent.GetAgent(15));

            for (int i = 0; i < loop; i++)
            {
                bool a = con.IsMatch(pattern);
            }
        }
Beispiel #7
0
        public void bit条件_単一エージェント狼狂_2()
        {
            Viewpoint viewpoint = new Viewpoint(gameSetting15, gameInfo15);

            BitCondition con = new BitCondition();

            con.AddWerewolf(Agent.GetAgent(1));
            con.AddPossessed(Agent.GetAgent(1));
            viewpoint.RemoveMatchPattern(con);

            Assert.AreEqual(viewpoint.MonsterSidePattern.Count, 5460);
        }
Beispiel #8
0
        /// <summary>
        /// 判定から村騙りが無い場合の内訳を絞り込む
        /// </summary>
        /// <param name="judge"></param>
        private void RemovePatternFromJudge(Judge judge)
        {
            BitCondition con = new BitCondition();

            con.AddNotWerewolfTeam(judge.Agent);
            if (judge.Result == Species.HUMAN)
            {
                con.AddWerewolf(judge.Target);
            }
            else
            {
                con.AddNotWerewolf(judge.Target);
            }

            AllViewTrustInfo.RemoveMatchPattern(con);
        }
Beispiel #9
0
        public void Update(GuessStrategyArgs args)
        {
            // 実行結果のクリア
            isSuccess = false;
            guessList.Clear();

            // 初日は行わない
            if (args.Agi.Day < 1)
            {
                return;
            }

            // 1日目0発言では行わない
            if (args.Agi.Day == 1 && args.Agi.TodayInfo.TalkList.Count == 0)
            {
                return;
            }

            // 初手黒は狂人寄り
            if (args.Agi.GameSetting.PlayerNum == 15)
            {
                foreach (Wepwawet.Lib.Judge judge in args.Agi.SeerJudge.Where(judge => judge.JudgeTalk.Day == 1 && judge.Result == Species.WEREWOLF))
                {
                    guessList.Add(new PartGuess()
                    {
                        Condition   = RoleCondition.GetCondition(judge.Agent, Role.POSSESSED),
                        Correlation = 1.25
                    });
                }
            }

            // 身内切り・誤爆を薄く見る
            foreach (Wepwawet.Lib.Judge judge in args.Agi.SeerJudge)
            {
                BitCondition con = new BitCondition();
                con.AddWerewolf(judge.Agent);
                con.AddWerewolf(judge.Target);
                guessList.Add(new PartGuess()
                {
                    Condition   = con,
                    Correlation = 0.6
                });

                con = new BitCondition();
                con.AddPossessed(judge.Agent);
                con.AddWerewolf(judge.Target);
                guessList.Add(new PartGuess()
                {
                    Condition   = con,
                    Correlation = 0.8
                });
            }

            // ●打ち先が占霊CO、占COに●打ち
            List <Agent> seerList = args.Agi.GetComingOutAgent(Role.SEER);

            foreach (Wepwawet.Lib.Judge judge in args.Agi.SeerJudge)
            {
                if (judge.Result == Species.WEREWOLF)
                {
                    foreach (ComingOut co in args.Agi.ComingOut)
                    {
                        if (judge.Target.Equals(co.Agent) && (co.Role == Role.SEER || co.Role == Role.MEDIUM))
                        {
                            if (judge.JudgeTalk.Day * 10000 + judge.JudgeTalk.Turn < co.ComingOutTalk.Day * 10000 + co.ComingOutTalk.Turn)
                            {
                                guessList.Add(new PartGuess()
                                {
                                    Condition   = RoleCondition.GetCondition(judge.Target, Role.WEREWOLF),
                                    Correlation = 1.5
                                });
                            }

                            if (judge.JudgeTalk.Day == 1 && seerList.Count == 2 &&
                                judge.JudgeTalk.Day * 10000 + judge.JudgeTalk.Turn > co.ComingOutTalk.Day * 10000 + co.ComingOutTalk.Turn)
                            {
                                guessList.Add(new PartGuess()
                                {
                                    Condition   = TeamCondition.GetCondition(judge.Agent, Team.WEREWOLF),
                                    Correlation = 1.1
                                });
                            }
                        }
                    }
                }
            }


            // 噛まれた占いの結果を真で見る
            List <Agent> attackedSeer = new List <Agent>();

            foreach (DayInfo dayInfo in args.Agi.DayInfo.Values)
            {
                if (dayInfo.AttackDeadAgent != null && dayInfo.AttackDeadAgent.Count >= 1)
                {
                    if (seerList.Contains(dayInfo.AttackDeadAgent[0]))
                    {
                        attackedSeer.Add(dayInfo.AttackDeadAgent[0]);
                    }
                }
            }
            foreach (KeyValuePair <int, Agent> kv in args.Agi.MyGuardHistory)
            {
                if (args.Agi.DayInfo[kv.Key].AttackDeadAgent != null && args.Agi.DayInfo[kv.Key].AttackDeadAgent.Count <= 0)
                {
                    attackedSeer.Add(kv.Value);
                }
            }
            foreach (Wepwawet.Lib.Judge judge in args.Agi.SeerJudge)
            {
                if (attackedSeer.Contains(judge.Agent))
                {
                    guessList.Add(new PartGuess()
                    {
                        Condition   = RoleCondition.GetCondition(judge.Target, Role.WEREWOLF),
                        Correlation = (judge.Result == Species.WEREWOLF) ? 2.0 : 0.5
                    });
                }
            }

            // 判定数が合わない人を偽で見る(暫定対応で多い場合のみ)
            foreach (Agent agent in seerList)
            {
                int count = args.Agi.SeerJudge.Where(judge => judge.Agent.Equals(agent)).Count();
                if (count > args.Agi.Day)
                {
                    guessList.Add(new PartGuess()
                    {
                        Condition   = TeamCondition.GetCondition(agent, Team.WEREWOLF),
                        Correlation = 4.0
                    });
                }
            }
            List <Agent> mediumList = args.Agi.GetComingOutAgent(Role.MEDIUM);

            foreach (Agent agent in mediumList)
            {
                int count = args.Agi.MediumJudge.Where(judge => judge.Agent.Equals(agent)).Count();
                if (count > args.Agi.Day)
                {
                    guessList.Add(new PartGuess()
                    {
                        Condition   = TeamCondition.GetCondition(agent, Team.WEREWOLF),
                        Correlation = 4.0
                    });
                }
            }


            // 実行成功にする
            isSuccess = true;
        }
Beispiel #10
0
        /// <summary>
        /// 日付変更時(昼の開始時)の処理
        /// </summary>
        private void DayStart(GameInfo gameInfo)
        {
            // 昨日の情報を更新
            YesterdayInfo = TodayInfo;
            if (YesterdayInfo != null && YesterdayInfo.Day != 0 && YesterdayInfo.Day + 1 == gameInfo.Day)
            {
                TodayInfo.UpdateFromTomorrow(gameInfo);
            }

            // 日の情報を作成
            TodayInfo = new DayInfo(gameInfo);
            DayInfo.Add(gameInfo.Day, TodayInfo);

            // 死体で発見されたエージェントが人狼のパターンを削除する
            foreach (Agent agent in gameInfo.LastDeadAgentList)
            {
                ICondition condition = RoleCondition.GetCondition(agent, Role.WEREWOLF);
                AllViewSystemInfo.RemoveMatchPattern(condition);
            }

            //TODO 飽和が早い配役対応 (15人村→4日目から)(5人村→1狼のため必要無し)
            // 人狼生存人数がおかしいパターンを削除する
            int maxWolfNum = (gameInfo.AliveAgentList.Count - 1) / 2;

            maxWolfNum = Math.Min(maxWolfNum, GameSetting.RoleNumMap[Role.WEREWOLF]);
            if (gameInfo.Day > GameSetting.RoleNumMap[Role.WEREWOLF])
            {
                BitMatchNumCondition condition = new BitMatchNumCondition()
                {
                    MinNum = 1, MaxNum = maxWolfNum,
                };
                foreach (Agent agent in gameInfo.AliveAgentList)
                {
                    condition.AddWerewolf(agent);
                }
                AllViewSystemInfo.RemoveNotMatchPattern(condition);
            }

            // 自分の占い判定の追加
            if (gameInfo.DivineResult != null)
            {
                MySeerJudge.Add(gameInfo.DivineResult);
            }

            // 自分の霊媒判定の追加
            if (gameInfo.MediumResult != null)
            {
                MyMediumJudge.Add(gameInfo.MediumResult);
            }

            // 自分の護衛履歴の追加
            if (gameInfo.GuardedAgent != null)
            {
                MyGuardHistory.Add(gameInfo.Day - 1, gameInfo.GuardedAgent);
            }

            // 護衛成功からのパターン削除
            if (gameInfo.GuardedAgent != null && gameInfo.LastDeadAgentList.Count <= 0)
            {
                BitCondition condition = new BitCondition();
                condition.AddWerewolf(gameInfo.GuardedAgent);

                AllViewSystemInfo.RemoveMatchPattern(condition);
            }


            talkOffset = 0;

            // debug

            /*
             * Console.Write(gameInfo.Day + "日目 : ");
             * Console.Write(SelfViewSystemInfo.MonsterSidePattern.Count);
             * Console.Write(" / ");
             * Console.Write(AllViewSystemInfo.MonsterSidePattern.Count);
             * Console.WriteLine("");
             */
        }
Beispiel #11
0
        public void Update(GuessStrategyArgs args)
        {
            // 実行結果のクリア
            guessList.Clear();

            // 自分の判定は100%信じる
            foreach (AIWolf.Lib.Judge judge in args.Agi.MySeerJudge)
            {
                guessList.Add(new PartGuess()
                {
                    Condition   = RoleCondition.GetCondition(judge.Target, Role.WEREWOLF),
                    Correlation = (judge.Result == Species.WEREWOLF) ? 10.0 : 0.0,
                });
            }

            // 役職CO者を取得
            List <Agent> seerList = args.Agi.GetComingOutAgent(Role.SEER);

            // 判定騙りをするエージェントを取得(推測)
            AgentStatistics statistics   = (AgentStatistics)args.Items["AgentStatistics"];
            List <Agent>    liarSeerList = new List <Agent>();

            foreach (Agent agent in seerList)
            {
                int roleEveCnt  = statistics.statistics[agent].eventCount[Role.SEER].GetOrDefault("1d_DevineWhite", 0);
                int roleEveCnt2 = statistics.statistics[agent].eventCount[Role.SEER].GetOrDefault("1d_DevineBlack", 0);

                if (roleEveCnt + roleEveCnt2 >= 5 && roleEveCnt2 > roleEveCnt)
                {
                    liarSeerList.Add(agent);
                }
            }

            foreach (Wepwawet.Lib.Judge judge in args.Agi.SeerJudge)
            {
                double fakeBlaskJudgeRate = 0.1;
                if (liarSeerList.Contains(judge.Agent))
                {
                    fakeBlaskJudgeRate = 3.0 / 4.0 * 2.0 / 3.0;
                }

                // 村陣営が人間に人狼判定
                if (judge.Result == Species.WEREWOLF)
                {
                    BitCondition con = new BitCondition();
                    con.AddNotWerewolfTeam(judge.Agent);
                    con.AddNotWerewolf(judge.Target);
                    guessList.Add(new PartGuess()
                    {
                        Condition   = con,
                        Correlation = fakeBlaskJudgeRate,
                    });
                }

                // 村陣営が人狼に人間判定
                if (judge.Result == Species.HUMAN)
                {
                    BitCondition con = new BitCondition();
                    con.AddNotWerewolfTeam(judge.Agent);
                    con.AddWerewolf(judge.Target);
                    guessList.Add(new PartGuess()
                    {
                        Condition   = con,
                        Correlation = 0.1,
                    });
                }
            }

            // COから村騙りが無い場合の内訳を絞り込む
            List <Agent> coAgent = args.Agi.GetComingOutAgent(Role.SEER);

            if (coAgent.Count >= 2)
            {
                BitMatchNumCondition con = new BitMatchNumCondition()
                {
                    MinNum = 0,
                    MaxNum = coAgent.Count - 2
                };
                foreach (Agent agent in coAgent)
                {
                    con.AddWerewolfTeam(agent);
                }
                guessList.Add(new PartGuess()
                {
                    Condition   = con,
                    Correlation = 0.1,
                });
            }

            // 実行成功にする
            isSuccess = true;
        }