示例#1
0
        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);
            }
        }
示例#2
0
 public void GetMapIndexTest_112_Returns12_10()
 {
     Assert.AreEqual(new Tuple <int, int>(12, 10), BitState.GetMapIndex(112));
 }
示例#3
0
 public void GetMapIndexTest_0_Returns0_0()
 {
     Assert.AreEqual(new Tuple <int, int>(0, 0), BitState.GetMapIndex(0));
 }