public int Execute(string aheui) { code = new CodePlane(aheui); cursor = new Cursor(); return Execute(); }
public void Move(CodePlane code, char aheui, bool reversed = false) { int height = code.Height; V.Update(aheui, reversed); int effSpeed = V.Speed; switch (V.Direction) { case Direction.Up: effSpeed = -1; break; case Direction.Down: effSpeed = 1; break; case Direction.Left: effSpeed *= -1; break; } if (V.Direction == Direction.Up || V.Direction == Direction.Down) { int width; for (int i = 0; i < V.Speed; i++) { do { Y += effSpeed; Y %= height; if (Y < 0) Y += height; width = code.WidthAt(Y); } while (X < 0 || X >= width); } } else { int width = code.WidthAt(Y); X += effSpeed; X %= width; if (X < 0) X += width; } }
public void Load(string aheui) { ExecuteCache = new Dictionary<string, int>(); Instructions = new List<Instruction>(); CursorStack = new Stack<CursorReserver>(); code = new CodePlane(aheui); CursorStack.Push(new CursorReserver(new Cursor(), null)); while (CursorStack.Count > 0) { var p = CursorStack.Pop(); cursor = p.Cursor; jumpAction = p.MakeJumpSetter(); while (VirtualStep()) ; } }