コード例 #1
0
 /// <summary>
 /// Runs all the statements in the body
 /// </summary>
 public void Execute(IGame.IGame game)
 {
     foreach (var s in statements)
     {
         s.Execute(game);
     }
 }
コード例 #2
0
 public override void Execute(IGame.IGame game)
 {
     while (Condition.Eval(game) != 0)
     {
         Body.Execute(game);
     }
 }
コード例 #3
0
        public override void Execute(IGame.IGame game)
        {
            //write text to console
            int id = objectId.Eval(game);

            game.PrintObjectName(id);
        }
コード例 #4
0
        public override void Execute(IGame.IGame game)
        {
            int value = Right.Eval(game);

            //look up the lhs by name and set its value
            game.SetVar(VarName, value);
        }
コード例 #5
0
 public override int Eval(IGame.IGame game)
 {
     if (game.ObjectSees(Left.Eval(game), Right.Eval(game)))
     {
         return(1);
     }
     return(0);
 }
コード例 #6
0
 public override int Eval(IGame.IGame game)
 {
     if (Left.Eval(game) != Right.Eval(game))
     {
         return(1);
     }
     return(0);
 }
コード例 #7
0
        public override void Execute(IGame.IGame game)
        {
            int objId = Left.Eval(game);
            int value = Right.Eval(game);

            //look up the lhs by name and set its value
            //            if (objid == -1)
            //                throw new Exception("game doesn't have an object named objName (in GetObjAttr)");

            game.SetObjectAttr(objId, attrName, value);
        }
コード例 #8
0
        public int Eval(IGame.IGame game)
        {
            //look up the variable name and return it

            int objId = Left.Eval(game);

            /*
             * if (objId == -1)
             *  throw new Exception("game doesn't have an object named objName (in GetObjProp)");
             *
             */
            return(game.GetObjectProp(objId, PropName));
        }
コード例 #9
0
        public int Eval(IGame.IGame game)
        {
            //look up the variable name and return it
            //return game.GetProperty(name, prop);
            //look up the variable name and return it

            int objId = Left.Eval(game);

            //            int objId = game.GetObjectId(objNum);

            //          if (objId == -1)
            //              throw new Exception("game doesn't have an object named objName (in GetObjAttr)");

            return(game.GetObjectAttr(objId, AttrName));
        }
コード例 #10
0
        public override void Execute(IGame.IGame game)
        {
            if (Condition.Eval(game) != 0)
            {
                Body.Execute(game);
            }
            else
            {
                //try each else if
                foreach (IfStatement i in elseifs)
                {
                    if (i.Condition.Eval(game) != 0)
                    {
                        i.Body.Execute(game);
                        return;
                    }
                }

                if (Else != null)
                {
                    Else.Execute(game);
                }
            }
        }
コード例 #11
0
 public override int Eval(IGame.IGame game)
 {
     return(Left.Eval(game) - Right.Eval(game));
 }
コード例 #12
0
 public override void Execute(IGame.IGame game)
 {
     //jumps don't get executed when interpreting
 }
コード例 #13
0
 public override void Execute(IGame.IGame game)
 {
     //labels don't get executed
 }
コード例 #14
0
        public override void Execute(IGame.IGame game)
        {
            int varVal = game.GetVarVal(VarName);

            game.PrintString(varVal.ToString());
        }
コード例 #15
0
 public int Execute(IGame.IGame game)
 {
     return(r.Next(upper.Eval(game)));
 }
コード例 #16
0
 public override void Execute(IGame.IGame game)
 {
     //write text to console
     game.PrintCr();
 }
コード例 #17
0
 public void Execute(IGame.IGame game)
 {
     body.Execute(game);
 }
コード例 #18
0
 public override void Execute(IGame.IGame game)
 {
     //write text to console
     //int index = text.Eval();
     game.PrintString(game.GetStringId(text));
 }
コード例 #19
0
 public override void Execute(IGame.IGame game)
 {
     //write text to console
     game.PrintStringCr(game.GetStringId(text));
 }
コード例 #20
0
 public abstract void Execute(IGame.IGame game);
コード例 #21
0
 public override void Execute(IGame.IGame game)
 {
     game.Ask();
 }
コード例 #22
0
 public override void Execute(IGame.IGame game)
 {
     game.CallFunction(name);
 }
コード例 #23
0
 public int Eval(IGame.IGame game)
 {
     return(val);
 }
コード例 #24
0
 public abstract int Eval(IGame.IGame game);
コード例 #25
0
 public int Eval(IGame.IGame game)
 {
     //look up the variable name and return it
     return(game.GetVarVal(VarName));
 }
コード例 #26
0
 public int Eval(IGame.IGame game)
 {
     //            return 0; //look up string in literal table
     return(game.GetStringId(s));
 }