예제 #1
0
파일: Robot.cs 프로젝트: pinieb/Hypersonic
        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));
 }