コード例 #1
0
            public void SetBest(MainPhaseAction.MainAction action, ClientCard card, int index = -1, int desc = -1)
            {
                Executor.SetCard((ExecutorType)(int)action, card, index);
                string actionString = BuildActionString(action, card);
                double weight       = Executor.ActionWeight(actionString);

                if (action == MainPhaseAction.MainAction.Repos)
                {
                    //weight -= 1;//set default to not repos
                    weight = Executor.ShouldRepos() ? 1 : -1;
                }

                if (weight >= BestWeight)
                {
                    //record previous action as not activate
                    //RecordAction(BestAction, BestCard, ActivateDesc, -0.1);
                    // update to be the better one
                    BestWeight   = weight;
                    BestAction   = action;
                    BestCard     = card;
                    BestIndex    = index;
                    ActivateDesc = desc;
                    Dialogs.SendMessage($"Setting Best Action as {action.ToString()} {card?.Name} {weight}");
                    Logger.WriteLine($"Setting Best Action as {action.ToString()} {card?.Name} {weight}");
                }
                else //if (weight < 0)
                {
                    Logger.WriteLine($"Did not {action.ToString()} {card?.Name} {weight} as the better choice is {BestAction.ToString()} {BestCard?.Name} {BestWeight}");
                    Dialogs.SendMessage($"Did not {action.ToString()} {card?.Name} {weight} as the better choice is {BestAction.ToString()} {BestCard?.Name} {BestWeight}");
                    //if (weight < 0)
                    //    RecordAction(action,card,desc, -0.1);
                }
            }