public OpenSVGForm(ClientTcp client) { InitializeComponent(); this.svgFile = new SvgDocument(); this.parser = new SVGParser(); this.interpretor = new Interpretor(); this.myClient = client; }
// Use this for initialization void Start() { if (code == null) { code = gameObject.GetComponent <MainObject>().script; } Compiler.setCode(code); Compiler.compile(); _ip = new Interpretor(); _ip.setICode(Compiler.getICode()); _ip.init(); //animation setup// anim = GetComponent <Animator>(); if (anim == null) { anim = GetComponentInChildren <Animator>(); } if (controller == null) { controller = GetComponent <CharacterController>(); } if (controller == null) { controller = GetComponentInChildren <CharacterController>(); } stats = gameObject.GetComponent <AnimalStats>(); _speed = stats.walk_speed; //stats.setType(0); //TMP fun animation// vision = gameObject.GetComponent <VisionScript2>(); if (vision == null) { vision = gameObject.AddComponent <VisionScript2>(); } vision.setSpeed(stats.walk_speed); vision.setTurnSpeed(stats.turn_speed); vision.enabled = false; //add libraries.// SensingLib sl = gameObject.AddComponent <SensingLib>(); sl.setInterpretor(_ip); //audio setup// audioSetup(); //tmp code tantest(); }
/// <summary> /// A static method that return a string, which will be used to /// display to the user to show the usage of the command. s /// </summary> /// <returns></returns> public static string getHelpTips(MessageContext mc) { string formattedreply = "Use: **" + Manager.GetServerCommandPrefix(mc) + "math** to give " + "me a math problem, here is an example: \n"; Random rd = new Random(); Interpretor temp = new Interpretor(CommandConstant.EXAMPLES[rd.Next(2)]); formattedreply += "Your Input: \"" + temp.inputexpression + "\"+\n"; formattedreply += "The Output will be: " + temp.outputresult; return(formattedreply); }
public void generate(string code) { string[] func; //track variable information //initializing compiler and compiling code.// //parse the whole code. Compiler.setCode(code); if (!(Compiler.compile())) { return; } //interpretor setup and initilisation// _ip = new Interpretor(); _ip.setICode(Compiler.getICode()); _ip.init(); //each track instruction is provided while ((func = _ip.nextIns()) != null) { string __st = func[0]; if (errorFlag) { break; } else if (__st == Compiler.EOP) { if (wallFlag) { executeWall(); } break; } else if (__st == "place") { placeObject(func); } else if (__st == "drawline") { drawLine(func); } else if (__st == "setposition") { setPosition(func); } else if (__st == "wall") { wallFlag = true; addWall(func); } } }
// Use this for initialization void Start() { if (code == null) { code = gameObject.GetComponent <MainObject>().script; } Compiler.setCode(code); Compiler.compile(); _ip = new Interpretor(); _ip.setICode(Compiler.getICode()); _ip.init(); //add libraries.// SensingLib sl = gameObject.AddComponent <SensingLib>(); sl.setInterpretor(_ip); }
//generates track and stores those objects public void generate(string code) { string[] track; //track variable information //initializing compiler and compiling code.// Compiler.setCode(code); Compiler.compile(); //interpretor setup and initilisation// _ip = new Interpretor(); _ip.setICode(Compiler.getICode()); _ip.init(); rg = new WallGenerator(this); path = new GameObject("path"); rg.setPath(path); //parse the whole code. Compiler.setCode(code); if (!(Compiler.compile())) { return; } //Debug.Log("track generation sarted-------------------"); //Debug.Log("s:" + speed_points + ",p:" + points_per_track); //each track instruction is provided while ((track = _ip.nextIns()) != null) { string __st = track[0]; if (__st == Compiler.EOP) { break; } else if (__st == "wall") { wallFunc(track); } } load(); }
void resetSpawnPoint(int index) { spawnObj = Data.objects[index]; string code = null; if (code == null) { code = spawnObj.GetComponent <MainObject>().script; } Compiler.setCode(code); Compiler.compile(); Interpretor _ip = new Interpretor(); _ip.setICode(Compiler.getICode()); _ip.init(); string[] ins = _ip.nextIns(); while ((ins) != null && ins[0] != Compiler.EOP) { if (ins[0] == "movement") { if (ins[1].Replace("\"", "") == "false") { Data.movementFlag = false; } } ins = _ip.nextIns(); RCLog.append(ins[0]); } Vector3 distAboveGround = new Vector3(0, 3, 0); if (Data.vrEnabled) { VRPlayer.transform.position = spawnObj.transform.position + distAboveGround; } else { player.transform.position = spawnObj.transform.position + distAboveGround; } spawnObj.SetActive(false); }
protected string evaluteMath(string[] objects) { string UserSpeaking = Context.NameOfUserSpeaking(); string formattedouput = "Hi! " + UserSpeaking + " Here is my take on this: \n"; Interpretor[] replies = new Interpretor[objects.Length]; for (int i = 0; i < objects.Length; i++) { replies[i] = new Interpretor(objects[i]); } foreach (Interpretor itp in replies) { if (itp.HasErrorOccured()) { formattedouput += "```" + itp.inputexpression + "```" + "Is not a valid expression\n" + itp.outputresult + "\n"; continue; } formattedouput += itp.inputexpression + " = " + itp.outputresult + "\n"; } Utilities.Stuff.ConsoleLog("This is the bot output: "); Utilities.Stuff.ConsoleLog(formattedouput); return(formattedouput); }
public void setInterpretor(Interpretor interpretor) { _ip = interpretor; }
protected override void OnSessionChanged(Session session, SessionChange change) { Send.Invoke(Interpretor.Interpretate(session)); }
public Supervisor(List <Pair <Container, Info> > soliders, List <Pair <Container, Info> > spells, SimpleDatabase.Database database, int startSolidersCount, int startSpellsCount) { if ((this.database = database) == null) { throw new ArgumentNullException(nameof(database)); } foreach (var f in soliders) { Soliders.Add(new Pair <Container, Pair <InterpretedObject, Info> >(f.Obj1, new Pair <InterpretedObject, Info>(Interpretor.Interpretate(f.Obj1), f.Obj2))); } foreach (var f in spells) { Spells.Add(new Pair <Container, Pair <InterpretedObject, Info> >(f.Obj1, new Pair <InterpretedObject, Info>(Interpretor.Interpretate(f.Obj1), f.Obj2))); } (sessionFounder = new Task(new Action(SessionFounder))).Start(); StartSolidersCount = startSolidersCount; StartSpellsCount = startSpellsCount; }