示例#1
0
        public void TwoOnOne_Minimize_victim_gun()
        {
            var bangStrategy = new CleverBangStrategy();

            Assert.That(bangStrategy.BangTwoOnOne(1, 3, 1), Is.EqualTo(Gun.Left));
            Assert.That(bangStrategy.BangTwoOnOne(3, 1, 1), Is.EqualTo(Gun.Right));
        }
示例#2
0
        public void TwoOnOne_Choose_right_if_enough_to_kill()
        {
            var bangStrategy = new CleverBangStrategy();

            Assert.That(bangStrategy.BangTwoOnOne(1, 2, 3), Is.EqualTo(Gun.Right));
            Assert.That(bangStrategy.BangTwoOnOne(1, 3, 2), Is.EqualTo(Gun.Right));
            Assert.That(bangStrategy.BangTwoOnOne(1, 4, 2), Is.EqualTo(Gun.Right));
            Assert.That(bangStrategy.BangTwoOnOne(1, 5, 3), Is.EqualTo(Gun.Right));
        }
示例#3
0
        public void TwoOnOne_Choose_left_if_enough_to_kill()
        {
            var bangStrategy = new CleverBangStrategy();

            Assert.That(bangStrategy.BangTwoOnOne(2, 1, 3), Is.EqualTo(Gun.Left));
            Assert.That(bangStrategy.BangTwoOnOne(3, 1, 2), Is.EqualTo(Gun.Left));
            Assert.That(bangStrategy.BangTwoOnOne(4, 1, 2), Is.EqualTo(Gun.Left));
            Assert.That(bangStrategy.BangTwoOnOne(5, 1, 3), Is.EqualTo(Gun.Left));
        }
示例#4
0
        public void TwoOnOne_Make_victim_gun_odd_size_to_avoid_split()
        {
            var bangStrategy = new CleverBangStrategy();

            Assert.That(bangStrategy.BangTwoOnOne(1, 2, 1), Is.EqualTo(Gun.Right));
            Assert.That(bangStrategy.BangTwoOnOne(2, 1, 1), Is.EqualTo(Gun.Left));

            Assert.That(bangStrategy.BangTwoOnOne(2, 3, 1), Is.EqualTo(Gun.Left));
            Assert.That(bangStrategy.BangTwoOnOne(3, 2, 1), Is.EqualTo(Gun.Right));
        }
示例#5
0
        public void TwoOnOne_If_shooter_guns_are_equal_it_doesnt_matter()
        {
            var bangStrategy = new CleverBangStrategy();

            Assert.That(new List <Gun> {
                Gun.Left, Gun.Right
            }.Contains(bangStrategy.BangTwoOnOne(1, 1, 3)));
            Assert.That(new List <Gun> {
                Gun.Left, Gun.Right
            }.Contains(bangStrategy.BangTwoOnOne(2, 2, 2)));
            Assert.That(new List <Gun> {
                Gun.Left, Gun.Right
            }.Contains(bangStrategy.BangTwoOnOne(3, 3, 1)));
        }