Exemple #1
0
 public ResultLabel(string answer, List <Answer> answers)
 {
     InitializeComponent();
     this.rightAnswerLabel.Text = answer;
     foreach (var a in answers)
     {
         AnswerBox answerBox = new AnswerBox(a);
         this.rightResultPanel.Controls.Add(answerBox);
         if (LevenshteinDistance.Compute(this.rightAnswerLabel.Text, a.AnswerString) < 5)
         {
             answerBox.isRight   = true;
             answerBox.BackColor = Color.Green;
         }
         else
         {
             answerBox.isRight   = false;
             answerBox.BackColor = Color.Red;
         }
     }
 }
Exemple #2
0
        public void countPoints()
        {
            bool first = true;

            foreach (var comp in rightResultPanel.Controls)
            {
                if (comp is AnswerBox)
                {
                    AnswerBox box = (AnswerBox)comp;
                    if (box.isRight)
                    {
                        if (first)
                        {
                            Game.teams[box.answer.TeamName].give_points(3);
                            first = false;
                        }
                        else
                        {
                            Game.teams[box.answer.TeamName].give_points(1);
                        }
                    }
                }
            }
        }