/// <summary> /// By passing through the choice the player (or AI) has made, a new one is then picked to play against it. /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Results(string id) { try { var playerPick = _game.GetChoices().Where(p => p.Name == id).FirstOrDefault(); var autoPick = playerPick ?? _game.GetRandomElement();//fall back to two AI's playing var aiPick = _game.GetRandomElement(); var res = autoPick.GetResult(aiPick); model.Ai1Pic = aiPick; model.PlayerPic = playerPick; model.Ai2Pic = autoPick; model.Result = res.ToString(); } catch (Exception ex) { _logger.LogError("Error in playing.", ex); } return(View(model)); }