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; } }
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); }
public void WhenPlayerXChosesY(int player, PaperStoneScissorsGameObject gameObject) { round.AddSelection(player, gameObject); }
public void AddSelection(int player, PaperStoneScissorsGameObject gameObject) { Selections.Add(player, gameObject); }