Пример #1
0
        public void CannotWinWhileTheresBeerLeft()
        {
            var pos = getStartPositions();
            pos[0] = Position.GreenGoal1;
            pos[1] = Position.GreenGoal2;
            pos[2] = Position.GreenGoal3;
            pos[3] = Position.GreenGoal4;

            var sit = new Situation(pos);
            sit.beers[(int)Piece.Green] = 1;

            Assert.AreEqual(Piece.None, sit.GetWinner());

            sit.DrinkBeers(Piece.Green, 1);

            Assert.AreEqual(Piece.Green, sit.GetWinner());
        }
Пример #2
0
        public void TripleFinishesOverOwnPiece()
        {
            var pos = getStartPositions();
            pos[0] = Position.GreenGoal2;
            pos[1] = pos[2] = pos[3] = Position.GreenGoal1;

            var sit = new Situation(pos);
            var moves = sit.GetMoves(Piece.Green, 3);

            sit.ApplyMove(moves[0]);

            Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal1]);
            Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal2]);
            Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal3]);
            Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal4]);

            Assert.AreEqual(Piece.Green, sit.GetWinner());
        }
Пример #3
0
        public void TestYellowWins()
        {
            Position[] pos = getStartPositions();
            pos[12] = Position.YellowGoal1;
            pos[13] = Position.YellowGoal2;
            pos[14] = Position.YellowGoal4;
            pos[15] = Position.YellowGoal3;
            Situation start = new Situation(pos);

            Assert.AreEqual(Piece.Yellow, start.GetWinner());
        }
Пример #4
0
        public void DoubleUnfoldsWhenPiecesBeforeItAreFilled()
        {
            var pos = getStartPositions();
            pos[0] = Position.GreenGoal4;
            pos[1] = pos[2] = Position.GreenGoal2;
            pos[3] = Position.GreenGoal1;

            var sit = new Situation(pos);
            var moves = sit.GetMoves(Piece.Green, 2);

            sit.ApplyMove(moves[0]);

            Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal1]);
            Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal2]);
            Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal3]);
            Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal4]);

            Assert.AreEqual(Piece.Green, sit.GetWinner());
        }
Пример #5
0
        public void TestGreenWins()
        {
            Position[] pos = getStartPositions();
            pos[0] = Position.GreenGoal2;
            pos[1] = Position.GreenGoal1;
            pos[2] = Position.GreenGoal4;
            pos[3] = Position.GreenGoal3;
            Situation start = new Situation(pos);

            Assert.AreEqual(Piece.Green, start.GetWinner());
        }