Beispiel #1
0
        public void TestIsTigerGoalState()
        {
            State s = new State();
            Board b = s.Board;
            Assert.IsNotNull(b);
            Assert.IsNotNull(b.GetSpace(2,2));
            Assert.IsNotNull(s.GetSpaceState(2,2));

            GoatPlacementMove g = new GoatPlacementMove(null, b.GetSpace(1, 3), s.Goat);
            TigerCaptureMove t1 = new TigerCaptureMove(b.GetSpace(0, 4), b.GetSpace(2, 2), b.GetSpace(1, 3), s.Tiger);
            TigerCaptureMove t2 = new TigerCaptureMove(b.GetSpace(2,2), b.GetSpace(0,4), b.GetSpace(1, 3), s.Tiger);

            Assert.IsFalse(s.IsTigerGoalState());
            Assert.IsFalse(s.IsGoatGoalState());

            g.ExecuteMove(s);
            t1.ExecuteMove(s);  // 1 down
            g.ExecuteMove(s);
            t2.ExecuteMove(s);  // 2 down
            g.ExecuteMove(s);
            t1.ExecuteMove(s);  // 3 down
            g.ExecuteMove(s);
            t2.ExecuteMove(s);  // 4 down
            g.ExecuteMove(s);
            t1.ExecuteMove(s);  //5 down

            Assert.IsTrue(s.IsTigerGoalState());
            Assert.IsFalse(s.IsGoatGoalState());
        }
Beispiel #2
0
        public void TestSlideMovesMove()
        {
            State s = new State();
            Board b = s.Board;
            Assert.IsNotNull(b.GetSpace(1, 3));
            Assert.IsNotNull(s.Tiger);
            AbstractMove g = new GoatPlacementMove(null, b.GetSpace(1, 3), s.Goat);
            g.ExecuteMove(s);

            AbstractMove ts = new SlideMove(b.GetSpace(4, 4), b.GetSpace(3, 3), s.Tiger);
            Assert.IsNotNull(ts.StartSpace);
            Assert.IsNotNull(ts.EndSpace);
            Assert.IsNotNull(ts.Player);

            ts.ExecuteMove(s);
            Assert.AreEqual(b.GetSpace(4, 4).GetSpaceState(), 'X');
            Assert.AreEqual(b.GetSpace(3, 3).GetSpaceState(), 'T');

            AbstractMove gs = new SlideMove(b.GetSpace(1, 3), b.GetSpace(1, 4), s.Goat);
            gs.ExecuteMove(s);
            Assert.AreEqual(b.GetSpace(1, 3).GetSpaceState(), 'X');
            Assert.AreEqual(b.GetSpace(1, 4).GetSpaceState(), 'G');

            Console.WriteLine("Tested placement 1,3, tiger slide 4,4 to 3,3 and goat slide 1,3 to 1,4 \r\n" + s.Board.GetBoardPic());
        }
Beispiel #3
0
        public void TestGoatPlacementMove()
        {
            State s = new State();
            Board b = s.Board;
            Assert.IsNotNull(b.GetSpace(1, 3));
            Assert.IsNotNull(s.Goat);
            AbstractMove g = new GoatPlacementMove(null, b.GetSpace(1, 3), s.Goat);
            Assert.IsNotNull(g.Player.Symbol);
            Assert.IsNotNull(g.EndSpace);

            g.ExecuteMove(s);
            Assert.AreEqual(b.GetSpace(1, 3).GetSpaceState(), 'G');
            Assert.AreEqual(b.GetSpace(0, 4).GetSpaceState(), 'T');
            Assert.AreEqual(s.Goat.GoatsInHand, 19);
        }
Beispiel #4
0
        public void TestMoveList()
        {
            State s = new State();
            Board b = s.Board;

            Assert.AreEqual(s.Goat.GetCountLegalMoves(s), 21);
            Assert.AreEqual(s.Tiger.GetCountLegalMoves(s), 12);

            GoatPlacementMove g = new GoatPlacementMove(null, b.GetSpace(1, 3), s.Goat);
            g.ExecuteMove(s);
            Assert.AreEqual(s.Goat.GetCountLegalMoves(s), 20);

            TigerCaptureMove t = new TigerCaptureMove(b.GetSpace(0, 4), b.GetSpace(2, 2), b.GetSpace(1, 3), s.Tiger);
            t.ExecuteMove(s);

            Assert.AreEqual(s.Goat.GetCountLegalMoves(s), 21);
            Assert.AreEqual(s.Tiger.GetCountLegalMoves(s), 17);
        }
Beispiel #5
0
        public void TestTigerCaptureMove()
        {
            State s = new State();
            Board b = s.Board;
            Assert.IsNotNull(b.GetSpace(1, 3));
            Assert.IsNotNull(s.Tiger);
            AbstractMove g = new GoatPlacementMove(null, b.GetSpace(1, 3), s.Goat);
            g.ExecuteMove(s);

            TigerCaptureMove t = new TigerCaptureMove(b.GetSpace(0, 4), b.GetSpace(2, 2), b.GetSpace(1, 3), s.Tiger);
            Assert.IsNotNull(t.StartSpace);
            Assert.IsNotNull(t.EndSpace);
            Assert.IsNotNull(t.JumpSpace);
            Assert.IsNotNull(t.Player);
            t.ExecuteMove(s);
            Assert.AreEqual(b.GetSpace(0, 4).GetSpaceState(), 'X');
            Assert.AreEqual(b.GetSpace(2, 2).GetSpaceState(), 'T');
            Assert.AreEqual(b.GetSpace(1, 2).GetSpaceState(), 'X');
            Assert.AreEqual(s.Goat.GoatsKilled, 1);
            Console.WriteLine("Tested placement 1,3 and capture from 0,4 to 2,2 \r\n" + s.Board.GetBoardPic());
        }