Beispiel #1
0
        public void RespawnTileAfterMove()
        {
            var expected = new[]
            {
                0, 0, 2, 0,
                0, 0, 0, 0,
                0, 0, 0, 0,
                2, 2, 0, 0
            };

            random_mock.Enqueue(new[] { 2, 0 });
            g.Move(Directions.Down);
            CollectionAssert.AreEqual(expected, g.Board);
        }
Beispiel #2
0
        public void Move(Directions direction, int[] expected)
        {
            var random_mock = new DeterministicRandomizer();

            random_mock.Enqueue(new[] { 0, 0,
                                        4, 0,
                                        2, 0 });
            var g = new Game(random_mock);

            g.Move(direction);
            CollectionAssert.AreEqual(expected, g.Board);
        }
Beispiel #3
0
        public void Score(Directions direction, int expected_score, int[] spawn_pos)
        {
            var random_mock = new DeterministicRandomizer();
            var spawns      = spawn_pos.SelectMany(s => new[] { s, 0 });

            random_mock.Enqueue(spawns);
            var g = new Game(random_mock);

            Console.WriteLine(g);
            g.Move(direction);
            Console.WriteLine(g);
            Assert.AreEqual(expected_score, g.Score);
        }
Beispiel #4
0
        public void Spawn4()
        {
            var random_mock = new DeterministicRandomizer();

            random_mock.Enqueue(new[] { 0, 9, 0, 9 });
            var g = new Game(random_mock);

            CollectionAssert.AreEqual(new[] {
                4, 4, 0, 0,
                0, 0, 0, 0,
                0, 0, 0, 0,
                0, 0, 0, 0,
            }, g.Board);
        }
Beispiel #5
0
        public void DoNotCreateWithoutMove()
        {
            var random_mock = new DeterministicRandomizer();

            random_mock.Enqueue(new[] { 0, 0, 0, 0, 0, 0 });
            var g = new Game(random_mock);

            g.Move(Directions.Up);
            CollectionAssert.AreEqual(new[] {
                2, 2, 0, 0,
                0, 0, 0, 0,
                0, 0, 0, 0,
                0, 0, 0, 0,
            }, g.Board);
        }
Beispiel #6
0
 public void Setup()
 {
     random_mock = new DeterministicRandomizer();
     random_mock.Enqueue(new[] { 0, 0, 4, 0 });
     g = new Game(random_mock);
 }