Beispiel #1
0
        public ActionResult SaveScore(string PlayMode, int Min, int Max, int numRight, int numWrong, int seconds, int rank)
        {
            SelectPlayModel playModel = new SelectPlayModel(String.Format("{0}|{1}|{2}", PlayMode, Min, Max));
            FullPlayModel fullModel = new FullPlayModel(playModel);

            return Json(fullModel.PlayValues);
        }
Beispiel #2
0
        public ActionResult LoadPlay(string PlayMode, int Min, int Max)
        {
            SelectPlayModel playModel = new SelectPlayModel(String.Format("{0}|{1}|{2}", PlayMode, Min, Max));
            FullPlayModel fullModel = new FullPlayModel(playModel);

            return Json(fullModel.PlayValues);
        }
Beispiel #3
0
        //
        // GET: /Play/
        public ActionResult Index(SelectPlayModel selectedModel)
        {
            ViewBag.Message = "Play Azure Math!";
            ViewBag.HomeClass = "unselected";
            ViewBag.PlayClass = "selected";
            ViewBag.RegisterClass = "unselected";

            return View(selectedModel);
        }
Beispiel #4
0
        public ActionResult Select(SelectPlayModel model)
        {
            if (ModelState.IsValid)
            {
                return this.RedirectToAction("Index");
                //return this.RedirectToAction(c => c.Index(model));
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Beispiel #5
0
        private List<PlayValue> GeneratePlayValues(SelectPlayModel selectModel)
        {
            List<PlayValue> playValues = new List<PlayValue>();

            for (int n = 0; n <= 200; n++)
            {
                int result = 0;
                int first = GetRandomIntegerBetween((n*3), 1, selectModel.Min);
                int second = GetRandomIntegerBetween((n*7), 1, selectModel.Max);

                switch (SelectPlayModel.PlayMode)
                {
                    case "Bonds":
                        {
                            result = first + second;
                            int alt = n%2;
                            if (alt == 0)
                                playValues.Add(new PlayValue(result, first, second, "&#45;"));
                            else
                                playValues.Add(new PlayValue(first, second, result, "&#43;"));
                            break;
                        }
                    case "Multiply":
                        {
                            result = first*second;
                            playValues.Add(new PlayValue(first, second, result, "&times;"));
                            break;
                        }
                    case "Divide":
                        {
                            result = first*second;
                            playValues.Add(new PlayValue(result, first, second, "&divide;"));
                            break;
                        }
                }

            }
            return playValues;
        }
Beispiel #6
0
        public FullPlayModel(SelectPlayModel selectModel)
        {
            _selectPlayModel = selectModel;

            Initialise();
        }