public void RunGameLast(RunBotsModel model, String login) { // smth with model; //GameResultViewModel result = new GameResultViewModel("test1", new List<CommandViewModel>() //{ // new CommandViewModel("test1", "R2D2", "Move", new String[] { "14", "14", "4", "11" }), // new CommandViewModel("test2", "T34-T2", "Move", new String[] { "14", "14", "8", "6" }) //}); Player p = GameManager.FindUser(login); p.BotsCode = model.Code; p.BotsCount = model.BotsCount; Game game = p.Game; if (game.Players.Any(pl => pl.BotsCode.Length == 0)) { return; } BotsRunner runner = new BotsRunner(); runner.RunCode(game.Players.First().BotsCode, game.Players.Last().BotsCode, game.Field.MapPath, GameFinishType.CommandsNumber, game.Field.Bots[game.Players.First().Name], game.Field.Bots[game.Players.Last().Name]); var connections = GameManager.FindUser(login).ConnectionIds.ToList(); // Clients.Clients(connections).startGameMovie(result); }
public JsonResult CompileBots(RunBotsModel model) { CompilationResultDTO result = compiler.CompileBotsCode(model.Code, model.BotsCount); return(Json(_mapper.Map <CompilationResultModel>(result))); }