public string getCommand(Move move) { var mapPos = BitState.GetMapIndex(position); int comx = mapPos.Item1; int comy = mapPos.Item2; switch (move.direction) { case MoveDirection.Right: comx++; break; case MoveDirection.Left: comx--; break; case MoveDirection.Up: comy--; break; case MoveDirection.Down: comy++; break; } if (move.type == MoveType.Move) { return("MOVE " + comx + " " + comy); } else { return("BOMB " + comx + " " + comy); } }
public void GetMapIndexTest_112_Returns12_10() { Assert.AreEqual(new Tuple <int, int>(12, 10), BitState.GetMapIndex(112)); }
public void GetMapIndexTest_0_Returns0_0() { Assert.AreEqual(new Tuple <int, int>(0, 0), BitState.GetMapIndex(0)); }