private static int SkillLevelToDepth(ComputerSkillLevel skillLevel) { const int DefaultComputerSkillLevel = 4; switch (skillLevel) { case ComputerSkillLevel.Low: return(DefaultComputerSkillLevel - 1); case ComputerSkillLevel.Medium: return(DefaultComputerSkillLevel); case ComputerSkillLevel.Good: return(DefaultComputerSkillLevel + 1); case ComputerSkillLevel.Excellent: return(DefaultComputerSkillLevel + 2); default: throw new Exception("Bad ComputerSkillLevel" + skillLevel); } }
private void LoadSettings() { if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey("PlayAgainstComputer")) { _playAgainstComputer = (bool)ApplicationData.Current.LocalSettings.Values["PlayAgainstComputer"]; _computerSkill = (ComputerSkillLevel)ApplicationData.Current.LocalSettings.Values["ComputerSkillLevel"]; _numberOfPlayers = (int)ApplicationData.Current.LocalSettings.Values["NumberOfPlayers"]; _computerPlaysWithOpenHand = (bool)ApplicationData.Current.LocalSettings.Values["ComputerPlaysWithOpenHand"]; _playerNames = CardLib.PlayerNames.FromString(ApplicationData.Current.LocalSettings.Values["PlayerNames"] as string); } }
private static int SkillLevelToDepth(ComputerSkillLevel skillLevel) { const int DefaultComputerSkillLevel = 4; switch (skillLevel) { case ComputerSkillLevel.Low: return DefaultComputerSkillLevel - 1; case ComputerSkillLevel.Medium: return DefaultComputerSkillLevel; case ComputerSkillLevel.Good: return DefaultComputerSkillLevel + 1; case ComputerSkillLevel.Excellent: return DefaultComputerSkillLevel + 2; default: throw new Exception("Bad ComputerSkillLevel" + skillLevel); } }