Exemple #1
0
        public ActionResult Parse(string statement)
        {
            object data;
            try
            {
                var parser = new Parser();
                data = parser.Parse(statement);
            }
            catch (ParseException ex)
            {
                data = new { Error = ex.Message, ex.Offset };
            }

            return Content(ToJson(data), "application/json");
        }
Exemple #2
0
        public Game(IList<string> playerIds, GameOptions gameOptions = null)
        {
            if (playerIds == null)
            {
                throw new ArgumentNullException("playerIds");
            }

            if (gameOptions == null || gameOptions.ScoringSystem == null)
            {
                this.scoringSystem = new AverageCardsScoringSystem();
            }
            else
            {
                scoringSystem = gameOptions.ScoringSystem;
            }

            this.parser = new Parser(gameOptions == null ? null : gameOptions.ParserOptions);
            this.compiler = new Compiler(gameOptions == null ? null : gameOptions.CompilerOptions);

            this.gameState = new GameState(this, playerIds);
        }