Exemplo n.º 1
0
 void setDialogs(QuestionTree temp)
 {
     //nastavi dialoge glede na potek igre
     presernovText.text = temp.question;
     answerA.text       = temp.choiceA;
     answerB.text       = temp.choiceB;
 }
Exemplo n.º 2
0
        static private QuestionTree addNewQuestion(string questionParam)
        {
            Console.WriteLine("\nQual prato você pensou?");
            string answer = Console.ReadLine();

            while (answer == "" || answer == null)
            {
                Console.WriteLine("\n*Por favor, digite alguma coisa :)");
                Console.WriteLine("Qual prato você pensou?");
                answer = Console.ReadLine();
            }
            Console.WriteLine("\n" + answer + " é _________ mas " + questionParam + " não.");
            string answer2 = Console.ReadLine();

            while (answer2 == "" || answer2 == null)
            {
                Console.WriteLine("\n*Por favor, digite alguma coisa :)");
                Console.WriteLine(answer + " é _________ mas " + questionParam + " não.");
                answer2 = Console.ReadLine();
            }
            Console.WriteLine("\n");
            QuestionTree questionNew = new QuestionTree(answer2, answer, "");

            return(questionNew);
        }
Exemplo n.º 3
0
        private static QuestionTree FindQuestionTree(IList <ProblemMapping> problemMappings, int questionNumber)
        {
            if (questionNumber == MaxNumberOfQuestions)
            {
                foreach (var question in GetAllQuestions())
                {
                    var allAnswersYieldOneMapping = true;
                    var results = GetQuestionResults(question, problemMappings);
                    foreach (var result in results)
                    {
                        allAnswersYieldOneMapping &= result.Value.Select(p => p.RobotMapping).Distinct().Count() == 1;
                    }

                    if (allAnswersYieldOneMapping)
                    {
                        return(new QuestionTree(question));
                    }
                }

                return(null);
            }

            var numberOfQuestions = 0;

            foreach (var question in GetAllQuestions())
            {
                if (questionNumber == 1)
                {
                    numberOfQuestions++;
                    Console.WriteLine(numberOfQuestions + ": " + question.Text);
                }
                var questionTree = new QuestionTree(question);
                var allAnswersYieldOneMapping = true;
                var results = GetQuestionResults(question, problemMappings);
                foreach (var result in results)
                {
                    var childQuestionTree = FindQuestionTree(result.Value, questionNumber + 1);
                    if (childQuestionTree == null)
                    {
                        allAnswersYieldOneMapping = false;
                        break;
                    }
                    questionTree.Children.Add(result.Key, childQuestionTree);
                }

                if (allAnswersYieldOneMapping)
                {
                    return(questionTree);
                }
            }

            return(null);
        }
Exemplo n.º 4
0
 //funkcija ki se klice ob izbiri odgovora B
 public void goPathB()
 {
     if (currQuestion == null)
     {
         return;
     }
     currQuestion = currQuestion.pathB;
     //ce trenutnega vprasanja ni pomeni, da smo prisli do konca, v nasprotnem primeru nadaljujemo z igro
     if (currQuestion == null)
     {
         Hide_test.show_selected(cg);
     }
     else
     {
         setDialogs(currQuestion);
     }
 }
 private void InitializeQuestionTree()
 {
     _tree = new QuestionTree
     {
         Question = QuestionsEnum.OperationCategory,
         Children = new List <QuestionTree>
         {
             new QuestionTree
             {
                 Question = QuestionsEnum.OperationSum,
                 Children = new List <QuestionTree>
                 {
                     new QuestionTree
                     {
                         Question = QuestionsEnum.OperationDate,
                         Children = new List <QuestionTree>()
                     }
                 }
             }
         }
     };
 }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        //postavi trenutno vprasanje na prvo
        currQuestion = treeSet[0];

        //povezi vprasanja med seboj, glede na izbiro
        treeSet[0].pathA = treeSet[1];
        treeSet[0].pathB = treeSet[0];
        treeSet[1].pathA = treeSet[2];
        treeSet[1].pathB = treeSet[1];
        treeSet[2].pathA = treeSet[2];
        treeSet[2].pathB = treeSet[3];
        treeSet[3].pathA = treeSet[4];
        treeSet[3].pathB = treeSet[3];
        treeSet[4].pathA = treeSet[4];
        treeSet[4].pathB = treeSet[5];
        treeSet[5].pathA = treeSet[5];
        treeSet[5].pathB = null;

        //tako, zdaj imas pripravljeno vse za zacetek igre;
        setDialogs(currQuestion);
    }
 private void InitializeQuestionTree()
 {
     _tree = new QuestionTree
     {
         Question = QuestionsEnum.StatsAction,
         Children = new List <QuestionTree>
         {
             new QuestionTree
             {
                 Question = QuestionsEnum.StatsCategory,
                 Children = new List <QuestionTree>
                 {
                     new QuestionTree
                     {
                         Question = QuestionsEnum.StatsCategoryDateRange,
                         Children = new List <QuestionTree>()
                     }
                 }
             }
         }
     };
 }
        public async Task <List <HandlerServiceResult> > Handle(Message message)
        {
            var user = await _userDocumentService.GetByChatId(message.UserInfo.ChatId);

            var categories = await _categoryDocumentService.GetByUserIdAsync(user.Id);

            categories = categories.Where(c => c.Configured).ToList();

            if (categories.Count > 0)
            {
                user.Context = new Context
                {
                    CurrentNode = _tree
                };
            }
            else
            {
                var parentTree = new QuestionTree
                {
                    Children = new List <QuestionTree>
                    {
                        _tree
                    },
                    Question = QuestionsEnum.AddNewCategoryOrNot
                };

                user.Context = new Context()
                {
                    CurrentNode = parentTree
                };
            }

            await _userDocumentService.UpdateAsync(user);

            return(new List <HandlerServiceResult>
            {
                await _questionService.BuildQuestion(user)
            });
        }
Exemplo n.º 9
0
 public QuestionChooser(QuestionTree tree, int left, int top)
     : base(tree, left, top)
 {
 }
 public static QuestionTree FindChildByQuestion(this QuestionTree tree, QuestionsEnum question)
 {
     return(tree.Children.FirstOrDefault(child => child.Question == question));
 }
Exemplo n.º 11
0
 void Awake()
 {
     questionTree = new QuestionTree();
     questionTree.SetupTree();
 }
 private void InitializeQuestionTree()
 {
     _tree = new QuestionTree
     {
         Children = new List <QuestionTree>
         {
             //delete
             new QuestionTree
             {
                 Question = QuestionsEnum.ChooseCategoryToDelete,
                 Children = new List <QuestionTree>()
             },
             //edit
             new QuestionTree
             {
                 Question = QuestionsEnum.ChooseCategoryToEdit,
                 Children = new List <QuestionTree>
                 {
                     new QuestionTree
                     {
                         Question = QuestionsEnum.CategoryName,
                         Children = new List <QuestionTree>
                         {
                             new QuestionTree
                             {
                                 Question = QuestionsEnum.CategoryCurrency,
                                 Children = new List <QuestionTree>
                                 {
                                     new QuestionTree
                                     {
                                         Question = QuestionsEnum.CategoryType,
                                         Children = new List <QuestionTree>
                                         {
                                             new QuestionTree
                                             {
                                                 Question = QuestionsEnum.CategorySupposedToSpentThisMonth,
                                                 Children = new List <QuestionTree>
                                                 {
                                                     new QuestionTree
                                                     {
                                                         Question = QuestionsEnum.None,
                                                         Children = new List <QuestionTree>()
                                                     }
                                                 }
                                             },
                                             new QuestionTree
                                             {
                                                 Question = QuestionsEnum.None,
                                                 Children = new List <QuestionTree>()
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             },
             //add
             new QuestionTree
             {
                 Question = QuestionsEnum.CategoryName,
                 Children = new List <QuestionTree>
                 {
                     new QuestionTree
                     {
                         Question = QuestionsEnum.CategoryCurrency,
                         Children = new List <QuestionTree>
                         {
                             new QuestionTree
                             {
                                 Question = QuestionsEnum.CategoryType,
                                 Children = new List <QuestionTree>
                                 {
                                     new QuestionTree
                                     {
                                         Question = QuestionsEnum.CategorySupposedToSpentThisMonth,
                                         Children = new List <QuestionTree>
                                         {
                                             new QuestionTree
                                             {
                                                 Question = QuestionsEnum.None,
                                                 Children = new List <QuestionTree>()
                                             }
                                         }
                                     },
                                     new QuestionTree
                                     {
                                         Question = QuestionsEnum.None,
                                         Children = new List <QuestionTree>()
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         },
         Question = QuestionsEnum.CategoryAction
     };
 }