public RoundOutcome getWinner(Guid MatchId, int CurrentRound, RoundOutcome RoundOutcome, string Opponent) { Dictionary<string, string> DictResults = new Dictionary<string,string>(); DetermineWinner DetermineWinner = new Game.DetermineWinner(); if(Opponent == "Computer") { DataLayer.Game.ComputerMatch Match = new DataLayer.Game.ComputerMatch(); DictResults = Match.GetResult(MatchId, CurrentRound); } else { DataLayer.Game.TacticalComputerMatch Match = new DataLayer.Game.TacticalComputerMatch(); DictResults = Match.GetResult(MatchId, CurrentRound); } foreach(var val in DictResults) // this is not a good way to do this but it's the best I can think of in a hurry { if(val.Key == "HumanChoice") { RoundOutcome.HumanChoice = val.Value; } else if(val.Key == "ComputerChoice") { RoundOutcome.ComputerChoice = val.Value; } else { RoundOutcome.Winner = val.Value; } } return RoundOutcome; }
private void BeatLastSelection(string Choice, Guid MatchId, int RoundNumber) { DataLayer.Game.TacticalComputerMatch Match = new DataLayer.Game.TacticalComputerMatch(); string s = Match.GetLastMoveHuman(MatchId, RoundNumber); switch (s) { case "Paper": this.Choice = SetRandomOptionBeatPaper(); break; case "Rock": this.Choice = SetRandomOptionBeatRock(); break; case "Scissors": this.Choice = SetRandomOptionBeatScissors(); break; } }