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);
        }
        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);
        }
        //
        // GET: /Play/
        public ActionResult Index(SelectPlayModel selectedModel)
        {
            ViewBag.Message = "Play Azure Math!";
            ViewBag.HomeClass = "unselected";
            ViewBag.PlayClass = "selected";
            ViewBag.RegisterClass = "unselected";

            return View(selectedModel);
        }
        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);
        }
Exemple #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;
        }
Exemple #6
0
        public FullPlayModel(SelectPlayModel selectModel)
        {
            _selectPlayModel = selectModel;

            Initialise();
        }