Example #1
0
 public static RoundResult Compare(this PaperStoneScissorsGameObject source, PaperStoneScissorsGameObject target)
 {
     if (source == target)
     {
         return RoundResult.Draw;
     }
     else if (source == PaperStoneScissorsGameObject.Scissors && target == PaperStoneScissorsGameObject.Paper
         || source == PaperStoneScissorsGameObject.Paper && target == PaperStoneScissorsGameObject.Stone
         || source == PaperStoneScissorsGameObject.Stone && target == PaperStoneScissorsGameObject.Scissors)
     {
         return RoundResult.Win;
     }
     else
     {
         return RoundResult.Lose;
     }
 }
Example #2
0
        public ActionResult SaveRound(PaperStoneScissorsGameObject chosenObject)
        {
            if (Game == null)
                return RedirectToAction("NewGame");

            var autoCompleted = GameObjectHelper.ChoseRandom();

            var round = new Round(Game.Rounds.Count + 1);
            round.AddSelection(1, chosenObject);
            round.AddSelection(2, autoCompleted);
            Game.AddRoundResult(round);

            if (Game.Complete)
            {
                return RedirectToAction("Results");
            }

            return View(Game.Rounds);
        }
Example #3
0
 public void WhenPlayerXChosesY(int player, PaperStoneScissorsGameObject gameObject)
 {
     round.AddSelection(player, gameObject);
 }
Example #4
0
 public void AddSelection(int player, PaperStoneScissorsGameObject gameObject)
 {
     Selections.Add(player, gameObject);
 }