private Targil targil; // the Targil of form #endregion Fields #region Constructors public Regular(Peula peula, QuestionType qType) { InitializeComponent(); this.Icon = new Icon(Properties.Resources.App_Icon, new Size(32, 32)); this.targil = new Targil(qType); this.qT = qType; this.targil.peula = peula; this.peula = peula; #region set title of form if (peula == Peula.hibur) this.Text = Languages.ChosenLanguage.Default["plus"]; else if (peula == Peula.hisur) this.Text = Languages.ChosenLanguage.Default["minus"]; else if (peula == Peula.kefel) this.Text = Languages.ChosenLanguage.Default["kefel"]; else if (peula == Peula.hiluk) this.Text = Languages.ChosenLanguage.Default["hiluk"]; else if (peula == Peula.random) this.Text = Languages.ChosenLanguage.Default["random"]; #endregion set title of form this.lb_time.Text = Languages.ChosenLanguage.Default["time"] + "00:00"; this.RightToLeft = Languages.ChosenLanguage.dir; this.RightToLeftLayout = Languages.ChosenLanguage.dirLayout; bt_ok.Text = Languages.ChosenLanguage.Default["send"]; this.Font = Code.Files.PreferrenceFile.GetReadyFont; SetNumbers(); }
/// <summary> /// constructor /// </summary> /// <param name="num1">the first number</param> /// <param name="p">the peula</param> /// <param name="num2">the secend number</param> /// <param name="QType">the question type to the targil : Hiuvi or Mehuvan</param> public Targil(int num1, Peula p, int num2, QuestionType QType) { number1 = num1; number2 = num2; peula = p; if (p == Peula.hibur) answer = num1 + num2; else if (p == Peula.hisur) answer = num1 - num2; else if (p == Peula.kefel) answer = num1 * num2; else if (p == Peula.hiluk) answer = num1 / num2; if (QType == QuestionType.Mehuvan) this.qType = -1; }
/// <summary> /// Randoms the targil /// </summary> /// <param name="r">the random object</param> /// <param name="p">the peula</param> public void RandomAll(Random r, Peula p) { if (p == Peula.hibur) { int x = 50 * ((byte)Code.ChangeDifficulty.Difficulty + 2); if (qType == 1) Set(r.Next(1, x), p, r.Next(1, x)); else Set(r.Next(-x - 1, x), p, r.Next(-x - 1, x)); } else if (p == Peula.hisur) { if (qType == 1) { int num1 = r.Next(1, 50 * ((byte)Code.ChangeDifficulty.Difficulty + 2)); int num2 = r.Next(1, num1); Set(num1, p, num2); } else { int num1 = r.Next(-50 * ((byte)Code.ChangeDifficulty.Difficulty + 1), 50 * ((byte)Code.ChangeDifficulty.Difficulty + 2)); int num2 = r.Next(-50 * ((byte)Code.ChangeDifficulty.Difficulty + 2), num1); Set(num1, p, num2); } } else if (p == Peula.kefel) { int x = 10 * ((byte)Code.ChangeDifficulty.Difficulty + 1); if (qType == 1) Set(r.Next(1, x + 1), p, r.Next(1, x + 1)); else Set(r.Next(-x, x + 1), p, r.Next(-x, x + 1)); } else if (p == Peula.hiluk) { int x = 5 * ((byte)Code.ChangeDifficulty.Difficulty + 2); if (qType == 1) { int num2 = r.Next(1, x + 1); int num1 = r.Next(1, x + 1) * num2; Set(num1, p, num2); } else { int num2 = (r.Next(0, 2) == 0 ? -1 : 1) * r.Next(1, x + 1); int num1 = r.Next(-x, x + 1) * num2; Set(num1, p, num2); } } else { RandomAll(r, (Peula)r.Next(0, 4)); } }
/// <summary> /// Function for setting the targil /// </summary> /// <param name="num1">first number</param> /// <param name="p">the peula</param> /// <param name="num2">secend number</param> public void Set(int num1, Peula p, int num2) { number1 = num1; number2 = num2; peula = p; if (p == Peula.hibur) answer = num1 + num2; else if (p == Peula.hisur) answer = num1 - num2; else if (p == Peula.kefel) answer = num1 * num2; else if (p == Peula.hiluk) answer = num1 / num2; }
public QuizType(QuestionType QuestionSort, Peula Type) { this.QuestionSort = QuestionSort; this.Type = System.Enum.GetNames(typeof(Peula))[(byte)Type]; difficulty = Code.ChangeDifficulty.Difficulty; }