/// <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 Start(Application application, string[] args, IStartupManager appStartupManager) { _application = application; _bootstrapper.Boot(args, appStartupManager, _messengerService); }