Exemple #1
0
        public void TestSnakeBreak2Node()
        {
            var snake = new Snake();
            snake.GrowUp(2);
            snake.Move(DIRECTION.Up);
            snake.Move(DIRECTION.Up);
            snake.Move(DIRECTION.Up);

            var body = snake.GetBody();
            var bodyitems = body.ToArray();

            snake.Break(bodyitems[2]);

            body = snake.GetBody();
            bodyitems = body.ToArray();

            Assert.AreEqual(0, bodyitems[0].Position.X);
            Assert.AreEqual(3, bodyitems[0].Position.Y);

            Assert.AreEqual(0, bodyitems[1].Position.X);
            Assert.AreEqual(2, bodyitems[1].Position.Y);
        }
Exemple #2
0
        public void TestSnakeGrowUpMove2Step()
        {
            var snake = new Snake();

            snake.GrowUp(2);

            snake.Move(DIRECTION.Up);
            snake.Move(DIRECTION.Right);

            var body = snake.GetBody();
            var bodyitems = body.ToArray();

            Assert.AreEqual(3, snake.TotalLength);
            Assert.AreEqual(3, bodyitems.Length);

            Assert.AreEqual(1, bodyitems[0].Position.X);
            Assert.AreEqual(1, bodyitems[0].Position.Y);

            Assert.AreEqual(0, bodyitems[1].Position.X);
            Assert.AreEqual(1, bodyitems[1].Position.Y);

            Assert.AreEqual(0, bodyitems[2].Position.X);
            Assert.AreEqual(0, bodyitems[2].Position.Y);
        }
Exemple #3
0
        public void TestSnakeGrowUp()
        {
            var snake = new Snake();

            snake.GrowUp(1);

            Assert.AreEqual(2, snake.TotalLength);
        }
Exemple #4
0
        public void TestSnakeInit()
        {
            var snake = new Snake();
            var body = snake.GetBody();
            var bodyitems = body.ToArray();

            Assert.AreEqual(1, snake.TotalLength);
            Assert.AreEqual(0, bodyitems[0].Position.X);
            Assert.AreEqual(0, bodyitems[0].Position.Y);
        }
Exemple #5
0
        public void TestSnakeMoveLeft()
        {
            var snake = new Snake();

            snake.Move(DIRECTION.Left);

            var body = snake.GetBody();
            var position = body.ToArray()[0].Position;

            Assert.AreEqual(1, snake.TotalLength);
            Assert.AreEqual(-1, position.X);
            Assert.AreEqual(0, position.Y);
        }
Exemple #6
0
 private IEnumerable<SnakeBody> _UpdateBody(Snake snake, DIRECTION direction)
 {
     return null;
 }
Exemple #7
0
 internal void Left(Snake _Snake)
 {
     throw new NotImplementedException();
 }
Exemple #8
0
 internal void Join(Snake snake)
 {
 }
Exemple #9
0
 internal DIRECTION GetDirection(Snake snake)
 {
     throw new NotImplementedException();
 }
Exemple #10
0
 public PlayStage(Remoting.ISoulBinder binder, Snake snake , Zone zone)
 {
     this._Binder = binder;
     this._Snake = snake;
     _Zone = zone;
 }