/// <summary> /// Starts a game and attempts to run it a specified number of generations. Will call the connected /// clients on completion or error. /// </summary> /// <param name="settings">Settings to start the game with.</param> public void StartGame(GameSettingsModel settings) { if (settings == null) { throw new ArgumentNullException("settings"); } try { var rules = RuleFactory.Build(settings.Rules); var lifeForm = LifeFormFactory.Build(settings.LifeForm); var game = bootstrapper.Boot <LinqGame>(rules); game.InitializeFrom(lifeForm.GetPattern()); game.GameStepEvent += OnGameStepEvent; game.RunThrough(settings.NumberOfGenerations); Clients.All.DisplayResults(game); } catch (BootFailedException) { var message = "Booting the game failed."; Clients.All.DisplayError(message); } }
public void Build_GivenStandard_ReturnsStandardRulesObject() { // act var rules = RuleFactory.Build(Rule.Standard) as StandardRules; // assert Assert.IsNotNull( rules, message: "StandardRules not built per expectation."); }
public void Build_GivenSierpinskish_ReturnsSierpinskishRulesObject() { // act var rules = RuleFactory.Build(Rule.Sierpinskish) as SierpinskishRules; // assert Assert.IsNotNull( rules, message: "SierpinskishRules not built per expectation."); }