示例#1
0
        private IChoice GetUserChoise(string userInput)
        {
            char    userChar   = Convert.ToChar(userInput);
            IChoice userChoice = RPSRepository.GetChoiceFromChar(userChar);

            return(userChoice);
        }
 public void Setup()
 {
     _choice = new Choice1236();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.VT_TotalPoints;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
        public void Load(IChoice choice)
        {
            if (choice == null)
            {
                throw new ArgumentNullException("choice");
            }

            this.choice  = choice;
            this.payment = null;

            this.choiceViewModel = new ChoiceItemViewModel(this.Dispatcher, choice);
            this.isValid         = false;
            this.isCancelled     = false;
            this.statusText.Text = string.Empty;

            choiceContainer.DataContext         = choiceViewModel;
            choiceChildrenContainer.ItemsSource = choiceViewModel.Children;


            var questionViewModel = choiceViewModel.Children.FirstOrDefault();

            if (questionViewModel == null)
            {
                return;
            }

            if (!HasMultipleDescendants(questionViewModel))
            {
                ChooseRequiredAnswers(questionViewModel);
            }
        }
 public void Setup()
 {
     _choice = new Choice_22006();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.PlayTechCasino;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#5
0
        public void Initailize(IPresentation presentation, IChoice choice)
        {
            this.presentation = presentation;
            this.choice       = choice;

            UpdateDisplay();
        }
 public void Setup()
 {
     _choice = new Choice156();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Set_X_Total_Games;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice1307();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.MatchTotalGames3Way;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice30();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.FirstCorrectScore;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice26();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Both_One_Neither;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#10
0
 public void Setup()
 {
     _choice = new Choice10();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Outright;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice129();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.FirstHalft_Exact_Goal;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#12
0
 public void ExecuteVsComputer()
 {
     users = new Users("You", "Computer");
     score = new Score(users);
     while (true)
     {
         Console.WriteLine("\nRock [r] Paper [p] Scissors [s] Quit [q]");
         string userInput = Console.ReadLine();
         try
         {
             var userChoice = GetUserChoise(userInput);
             if (userChoice.Name.Equals("Quit"))
             {
                 break;
             }
             if (userChoice.Name.Equals("Invalid"))
             {
                 continue;
             }
             IChoice randomChoice          = RPSRepository.GetRandomChoice();
             RPSRepository.Outcome outcome = RPSRepository.GetOutcome(userChoice, randomChoice, users);
             GiveScore(outcome, score);
         }
         catch (Exception ex)
         {
             throw new RPSException("Invalid input" + ex);
         }
     }
 }
示例#13
0
 public void Setup()
 {
     _choice = new Choice15();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.FirstHalf_1X2;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#14
0
        public void Initailize(IPresentation presentation, IChoice choice, char CorrectLetter)
        {
            this.presentation = presentation;
            Choice            = choice;

            UpdateEditor(CorrectLetter);
        }
 public void Setup()
 {
     _choice = new Choice136();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.First_Home_Team_OddEven;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice1318();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.SetXTotalGamesOddEven;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice1328();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.SetXGameYTotalPointsExact;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#18
0
 public void Setup()
 {
     _choice = new Choice27();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.To_Win_To_Nill;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#19
0
 public void Setup()
 {
     _choice = new Choice72();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.P2P_Games;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#20
0
        public static void Run()
        {
            IChoice ic  = null;
            var     cxt = new Context();

            while (true)
            {
                Console.WriteLine("\nEnter ur choice(1 or 2)");
                var c = Console.ReadLine();
                if (c.Equals("exit"))
                {
                    break;
                }
                if (c.Equals("1"))
                {
                    ic = new FirstChoice();
                }
                else if (c.Equals("2"))
                {
                    ic = new SecondChoice();
                }
                cxt.SetChoice(ic);
                cxt.ShowChoice();
            }
            Console.ReadLine();
        }
示例#21
0
 public void Setup()
 {
     _choice = new Choice28();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes._3_Way_Handicap;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#22
0
        private IUpdateEvent ChoiceHandler(ref EventArgs ea, IDictionary <string, object> globals)
        {
            IChoice ic  = (IChoice)ea;
            var     idx = ic.GetChoiceIndex();

            ea = null;

            if (idx < 0 || idx >= scheduler.prompt.Options().Count)
            {
                // bad index, so reprompt for now
                ChatRuntime.Info("Invalid index " + idx + ", reprompting\n");
                //scheduler.prompt.Resolve(globals); // re-resolve
                return(new UpdateEvent(scheduler.prompt.Resolve(globals)));
            }
            else
            {
                Opt opt = scheduler.prompt.Selected(idx);


                if (opt.action != Command.NOP)
                {
                    // We've gotten a response with a branch, so finish & take it
                    scheduler.Completed(false);
                    opt.action.Resolve(globals);
                    runtime.FindAsync((Find)opt.action); // find next
                }
                else
                {
                    scheduler.chat = scheduler.prompt.parent; // just continue
                }
                return(null);
            }
        }
 public void Setup()
 {
     _choice = new Choice1316();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.SetXGameHandicap;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#24
0
 /// <summary>
 /// Set chosen choice by index
 /// </summary>
 /// <param name="num"></param>
 public void SetChoice(int num)
 {
     if (num >= 0 && num < _choices.Count)
     {
         _chosen = _choices[num];
     }
 }
 public void Setup()
 {
     _choice = new Choice159();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes._3rdExactTotalGoals;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#26
0
 public void Setup()
 {
     _choice = new Choice20();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Money_Line;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice407();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.ExactHomeTeamGoals;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice123();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Draw_NoDraw;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
        private void AddChoice(IChoice choice = null)
        {
            if (choice == null)
            {
                choice = Factory.CreateChoice();
                choice.ChoiceLetter = lastChoiceLetter++;

                quastionSlide.Choices.Add(choice);
            }

            IChoiceEditor choiceEditor = choice.OnEditorGUI();

            choiceEditor.Initailize(Presentation, choice, quastionSlide.CorrectChoice);
            choiceEditor.SetChoiceStyle(Resource.GetChoiceColors()[row]);

            ChoiceEditors.Add(choiceEditor);

            choiceEditor.OnChoiceSelected += ChoiceEditor_OnChoiceSelected;

            var choiceEditorControl = (Control)choiceEditor;

            choiceEditorControl.Margin = new Thickness(0, 0, 0, 25);

            //Add To grid
            SlideChoiceGrid.Children.Add(choiceEditorControl);
            Grid.SetRow(choiceEditorControl, row);
            row++;

            SlideUpdated?.Invoke(this, EventArgs.Empty);
        }
示例#30
0
 public void Setup()
 {
     _choice = new Choice31();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Win;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#31
0
 public void Setup()
 {
     _choice = new Choice24();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Double_Change;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void SetUp()
 {
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes._3rd1stHalfDoubleChance;
     _ticketHelper = Substitute.For<ITicketHelper>();
     _choice = new Choice151();
 }
 public void Setup()
 {
     _choice = new Choice23002();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.CasinoPending;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice122();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Away_No_Bet;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#35
0
 private void EvaluateAnsweringPerformance(IChoice choice)
 {
     if (choice.Correct)
     {
         _currentProcessData.resultingReward += ConverterController.Evaluation.GetCorrectChoiceReward();
     }
 }
示例#36
0
 public void Setup()
 {
     _choice = new Choice6();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Total_Goal;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice1103();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Sicbo;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#38
0
 public void Setup()
 {
     _choice = new Choice13();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Clean_Sheet;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice154();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.Set_X_Winner;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 public void Setup()
 {
     _choice = new Choice1314();
     _ticket = Substitute.For<ITicket>();
     _ticket.BetTypeId = BetTypes.SetXWillThereBeATiebreak;
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
示例#41
0
        private static void HandleChoice(IChoice choice)
        {
            WriteLine("\r\nChoice: {0}\r\n", choice.Text);

            HandleQuestion(choice.Question);

            //if (choice is IChooseFirstPlayer)
            //{
            //    ChooseFirstPlayer(choice as IChooseFirstPlayer);
            //}
            //else if (choice is IChooseToKeepStartingHand)
            //{
            //    ChooseToKeepStartingHand(choice as IChooseToKeepStartingHand);
            //}
            //else if (choice is IChoosePlayerAction)
            //{
            //    ChoosePlayerAction(choice as IChoosePlayerAction);
            //}
            //else if (choice is IChooseAttachmentHost)
            //{
            //    ChooseAttachmentHost(choice as IChooseAttachmentHost);
            //}
            //else if (choice is IChooseCardInHand)
            //{
            //    ChooseCardInHand(choice as IChooseCardInHand);
            //}
            //else if (choice is IChooseGandalfEffect)
            //{
            //    ChooseGandalfEffect(choice as IChooseGandalfEffect);
            //}
            //else if (choice is IChooseGaladhrimsGreetingEffect)
            //{
            //    ChooseGaladhrimsGreetingEffect(choice as IChooseGaladhrimsGreetingEffect);
            //}
        }
示例#42
0
 public void OfferChoice(IEffect effect, IChoice choice)
 {
     foreach (var callback in offerChoiceCallbacks)
     {
         callback(effect, choice);
     }
 }
示例#43
0
文件: IdlePort.cs 项目: 20chan/tart
 bool IGame.TryChoice(IChoice <IGame> choice)
 {
     if (choice is Choice ch)
     {
         return(TryUpgrade(ch));
     }
     return(false);
 }
示例#44
0
 public Choice(IChoice baseChoice)
 {
     Text         = baseChoice.Text;
     Conditions   = baseChoice.Conditions;
     Consequences = baseChoice.Consequences;
     Triggers     = baseChoice.Triggers;
     ParentAct    = baseChoice.ParentAct;
 }
示例#45
0
 private void ProcessChoice(IChoice choice)
 {
     if (choice.Worth == 0)
     {
         return;
     }
     _spendMoneyChannel.RaiseEvent(ConverterController.Evaluation.GetChoiceCost(choice.Worth));
 }
示例#46
0
 public bool?WinsFrom(IChoice otherChoice)
 {
     return(otherChoice.Name switch
     {
         "Rock" => false,
         "Paper" => true,
         "Scissors" => null,
         _ => null
     });
示例#47
0
        public void Add(IQuestion q, IChoice c)
        {
            var rec = new AnswerRecord()
            {
                Question = q, Choice = c
            };

            _questionsAnswers.Add(rec);
            NewRecord(rec);
        }
示例#48
0
 public Choice(IChoice data)
 {
     SelectableOptions = data.SelectableOptions;
     Id      = data.Id;
     Options = new List <IChoiceOption>();
     foreach (var option in data.Options)
     {
         Options.Add(option as ChoiceOption);
     }
 }
示例#49
0
 public static UserChoiceEntity Create(string clientId, IChoice choice)
 {
     return(new UserChoiceEntity
     {
         PartitionKey = GeneratePk(clientId),
         RowKey = GenerateRk(choice.QuestionId),
         QuestionId = choice.QuestionId,
         AnswerIds = choice.AnswerIds,
         Other = choice.Other
     });
 }
示例#50
0
        public EffectHandle(IEffect effect, IChoice choice, ILimit limit)
        {
            if (effect == null)
            {
                throw new ArgumentNullException("effect");
            }

            this.effect = effect;
            this.choice = choice;
            this.limit  = limit;
        }
示例#51
0
 private void StartTaskProcessing(IChoice choice)
 {
     CalculatePerfomance(_currentProcessData);
     EvaluateAnsweringPerformance(choice);
     decisionsRulesManager.ProcessChoiceForDepartment(
         choice, _currentProcessData.department.Designation);
     OccupyResources(_currentProcessData);
     taskProcessStarted.RaiseEvent();
     StartTaskExecuting(_currentProcessData);
     _currentProcessData.department.ProcessTaskExecutingData(_currentProcessData);
     _currentProcessData = null;
     _hasActiveTask      = false;
 }
示例#52
0
        public List <IRule> GetSatisfiedRulesForChoice(IChoice choice)
        {
            var rules          = choice.Rules;
            var satisfiedRules = new List <IRule>();

            foreach (IRule rule in rules)
            {
                if (IsRuleSatisfied(rule))
                {
                    satisfiedRules.Add(rule);
                }
            }
            return(satisfiedRules);
        }
示例#53
0
        public void ChooseWithProbabilityChoicesUnchanged()
        {
            var elts    = Enumerable.Range(1, 2000).Select(i => new TestChoice(Math.Log(i, 2) + Math.Sin(i)) as IChoice).ToList();
            var oldElts = new IChoice[elts.Count];

            elts.CopyTo(oldElts);

            for (var i = 0; i < iterations; i++)
            {
                probabilityUtility.ChooseWithProbability(elts);
            }

            Assert.Equal(oldElts.ToList(), elts);
        }
    public void ProcessChoiceForDepartment(IChoice choice, DepartmentDesignation department)
    {
        bool         paramUpdated = UpdateChoiceParameter(choice);
        List <IRule> choiceRules  = ESKnowledgeBase.DecisionsRulesAnalyzer.GetSatisfiedRulesForChoice(choice);

        ProcessChoiceRules(choiceRules, department);
        if (paramUpdated)
        {
            List <IRule> parameterRules = ESKnowledgeBase.DecisionsRulesAnalyzer.GetSatisfiedRulesForParameter(
                choice.Question.Parameter, choice.ParameterValue);
            parameterRules = FilterRepeatings(parameterRules, choiceRules);
            ProcessParameterRules(parameterRules, department);
        }
    }
示例#55
0
        public bool IsMadeChoice(IChoice choice)
        {
            bool hasChoice = false;

            foreach (IChoice c in _madeChoices)
            {
                if (c.Id == choice.Id)
                {
                    hasChoice = true;
                    break;
                }
            }
            return(hasChoice);
        }
        private void OfferChoiceCallback(IEffect effect, IChoice choice)
        {
            try
            {
                //var x = System.Threading.Thread.CurrentThread.Name;
                Dispatch(() => choiceControl.Load(choice));

                BlockUntil(() => choiceControl.IsValid || choiceControl.IsCancelled);
            }
            catch (Exception ex)
            {
                MessageBox.Show(choice.Text + Environment.NewLine + Environment.NewLine + ex.Message, "Error Offering Choice");
            }
            //statusViewModel.SetCurrentStatus("Choice: " + choice.Text);
            //MessageBox.Show(choice.Text, "OfferChoiceCallback");
        }
示例#57
0
    public void AddChoice(IChoice choice)
    {
        bool toAdd = true;

        foreach (IChoice c in Choices)
        {
            if (c.Id == choice.Id)
            {
                toAdd = false;
                break;
            }
        }
        if (toAdd)
        {
            _choices.Add(choice);
        }
    }
示例#58
0
        static public IChoice getChoiceObj(string choice)
        {
            IChoice objChoice = null;

            if (choice.ToLower() == "car")
            {
                objChoice = new Car();
            }
            else if (choice.ToLower() == "bike")
            {
                objChoice = new Bike();
            }
            else
            {
                objChoice = new InvalidChoice();
            }
            return(objChoice);
        }
    public bool UpdateChoiceParameter(IChoice choice)
    {
        bool updated = false;

        if (!choice.Question.IsParametric)
        {
            return(updated);
        }
        var value = ESWorkingMemory.Parameters.GetValue(choice.Question.Parameter);

        if (value != choice.ParameterValue)
        {
            // ESWorkingMemory.Rules.GetForParameter(choice.Question.Parameter);
            ESKnowledgeBase.DecisionsRulesAnalyzer.RollbackRules(choice.Question.Parameter);
            ESWorkingMemory.Parameters.AssignParameterValue(
                choice.Question.Parameter, choice.ParameterValue);
            updated = true;
        }
        return(updated);
    }
        private void AddChoice(IChoice choice)
        {
            IChoiceDisplay choiceDisplay = choice.OnDisplayGUI();

            choiceDisplay.Initailize(presentation, choice);
            choiceDisplay.SetChoiceStyle(Resource.GetChoiceColors()[row]);

            var choiceDisplayControl = (Control)choiceDisplay;

            choiceDisplayControl.Margin = new Thickness(0, 10, 0, 10);

            //Add To grid
            SlideChoiceGrid.Children.Add(choiceDisplayControl);
            Grid.SetRow(choiceDisplayControl, row);
            row++;

            if (choice.ChoiceLetter == questionSlide.CorrectChoice)
            {
                correctChoiceDisplay = choiceDisplay;
            }
        }