public void Execute_Rotate_Left_Test() { var p = new Position(0, 0, 'N'); var r = new Rotate('L', p); r.Execute(); Assert.AreEqual(eDirection.West, p.Direction); }
private void RotateCommand(Vector2 direction) { if (GameState.stateOfGame == GameState.StateOfGame.Pause) { GameState.stateOfGame = GameState.StateOfGame.Play; } if (GameState.stateOfGame == GameState.StateOfGame.Play && inputBlock == false) { Command newCommand = new Rotate(); newCommand.Execute(CommandTarget, direction); LockInput(); } }
public void BackwardShift() { /* * Rotates the top i things on the stack. Using a negative rotational value rotates backwards. Examples: * "a" "b" "c" "d" -4 rotate * would leave * "d" "a" "b" "c" * on the stack. */ var stack = new Stack <ForthDatum>(); stack.Push(new ForthDatum("a")); stack.Push(new ForthDatum("b")); stack.Push(new ForthDatum("c")); stack.Push(new ForthDatum("d")); stack.Push(new ForthDatum(-4)); var local = stack.ClonePreservingOrder(); var parameters = new ForthPrimativeParameters(null, local, null, Dbref.NOT_FOUND, Dbref.NOT_FOUND, Dbref.NOT_FOUND, null, null, null, null, default); var result = Rotate.Execute(parameters); Assert.NotNull(result); Assert.IsTrue(result.IsSuccessful, result.Reason); var c = local.Pop(); Assert.AreEqual(ForthDatum.DatumType.String, c.Type); Assert.AreEqual("c", c.Value); var b = local.Pop(); Assert.AreEqual(ForthDatum.DatumType.String, b.Type); Assert.AreEqual("b", b.Value); var a = local.Pop(); Assert.AreEqual(ForthDatum.DatumType.String, a.Type); Assert.AreEqual("a", a.Value); var d = local.Pop(); Assert.AreEqual(ForthDatum.DatumType.String, d.Type); Assert.AreEqual("d", d.Value); Assert.AreEqual(0, local.Count); }
public void Rotate3() { /* * ROT ( x y z -- y z x ) * * Rotates the top three things on the stack. This is equivalent to 3 rotate. */ var stack = new Stack <ForthDatum>(); stack.Push(new ForthDatum("x")); stack.Push(new ForthDatum("y")); stack.Push(new ForthDatum("z")); var local = stack.ClonePreservingOrder(); local.Push(new ForthDatum(3)); var parameters = new ForthPrimativeParameters(null, local, null, Dbref.NOT_FOUND, Dbref.NOT_FOUND, Dbref.NOT_FOUND, null, null, null, null, default); var result = Rotate.Execute(parameters); Assert.NotNull(result); Assert.IsTrue(result.IsSuccessful, result.Reason); var x = local.Pop(); Assert.AreEqual(ForthDatum.DatumType.String, x.Type); Assert.AreEqual("x", x.Value); var z = local.Pop(); Assert.AreEqual(ForthDatum.DatumType.String, z.Type); Assert.AreEqual("z", z.Value); var y = local.Pop(); Assert.AreEqual(ForthDatum.DatumType.String, y.Type); Assert.AreEqual("y", y.Value); Assert.AreEqual(0, local.Count); }
public void createDrawble(string text) { string command = extractCommand(text); switch (command) { case "draw": { Draw.Execute(text, control); OnChangeViewList(); break; } case "connect": { Connect.Execute(text, control); break; } case "rotate": { //requires object info, because to rotate you must redraw the object with new rotation. OnClear(); Rotate.Execute(text, control); OnChangeViewList(); break; } case "clear": { Clear.Execute(); //clears the borad and redraws it with a delegate OnClear(); //Update the List // clears it OnChangeViewList(); break; } case "delete": { // only clears the Canvas not thing stored OnClear(); Delete.Execute(text, control); //Update the List // clears it OnChangeViewList(); break; } case "edit": { // only clears the Canvas not thing stored OnClear(); Delete.Execute(text, control); //Update the List // clears it OnChangeViewList(); break; } } }