예제 #1
0
        public void m_MapTest_Corners_AllMaps()
        {
            Game aGame = new Game();
            aGame.SetMap(1);
            Tile[,] theMap;
            Tile[][,] allTheMaps = aGame.GetFiler().GetAllMyMaps();
            bool expected, actual;
            expected = false;
            actual = false;

            // return true if one corner is broken in one of the maps

            for (int i = 0; i < allTheMaps.Length; i++)
            {
                if (allTheMaps[i] != null)
                {
                    theMap = allTheMaps[i];
                    if (aGame.AreCornersBroken(theMap) == true)
                    {
                        actual = true;
                    }
                }
            }

            Assert.AreEqual(expected, actual, "One of the corners is broken in the Map library");
        }
예제 #2
0
        public void b_BlockedMovementTest_Right()
        {
            Point expectedPoint, actualPoint, theseusPoint;
            expectedPoint = new Point(2, 1);
            Game aGame = new Game();
            Theseus theseus = aGame.GetTheseus();
            theseusPoint = new Point(2, 1);

            aGame.SetTestMap(1);
            aGame.GetTheseus().Coordinate = theseusPoint;

            /*
            .___.___.___.
            | 0   1   2 |
            .   .   .   .
            | 1       T |
            .   .   .   .
            | 2         |
            .___.___.___.  */

            aGame.GetTheseus().Move(Direction.Right);
            actualPoint = aGame.GetTheseusPosition();

            Assert.AreEqual(expectedPoint, actualPoint, "Theseus was not stopped by the block. Superman?");
        }
예제 #3
0
        public void m_MapTest_EastWallBroken_AllMaps()
        {
            Game aGame = new Game();
            aGame.SetMap(1);
            Tile[,] theMap;
            Tile[][,] allTheMaps = aGame.GetFiler().GetAllMyMaps();
            bool expected, actual;
            expected = false;
            actual = false;

            // return true if one East wall is broken

            for (int i = 0; i < allTheMaps.Length; i++)
            {
                if (allTheMaps[i] != null)
                {
                    theMap = allTheMaps[i];
                    if (aGame.EastWallBroken(theMap) == true)
                    {
                        actual = true;
                    }
                }
            }

            Assert.AreEqual(expected, actual, "One of the East walls is broken");
        }
예제 #4
0
        public void e_ExitTile_NotFinished()
        {
            Point thesStart;
            bool expected, actual;
            thesStart = new Point(2, 2);
            expected = false;
            Game aGame = new Game();
            Theseus theseus = aGame.GetTheseus();
            Minotaur minotaur = aGame.GetMinotaur();

            aGame.SetTestMap(2);
            aGame.GetTheseus().Coordinate = thesStart;

            /*
            .___.___.___.___.
            | 0   1   2   3 |
            .   .   .   .   .
            | 1             |
            .   .   .   .   .___.
            | 2       T       X
            .   .   .   .   .___.
            | 3             |
            .___.___.___.___. */

            aGame.GetTheseus().Move(Direction.Right);
            actual = aGame.GetTheseus().IsFinished();

            Assert.AreEqual(actual, expected, "Theseus finished the maze");
        }
예제 #5
0
        public void d_MinotaurReaction_Diagonal_blockeddownright_1block_downright()
        {
            Point expectedPoint, actualPoint, minStart, thesStart;
            minStart = new Point(1, 1);
            thesStart = new Point(2, 2);
            expectedPoint = new Point(1, 1);
            Game aGame = new Game();
            Theseus theseus = aGame.GetTheseus();
            Minotaur minotaur = aGame.GetMinotaur();

            aGame.SetTestMap(2);
            Tile[,] theMap = aGame.GetMap();
            theMap[1, 1].MyWalls = TheWalls.South | TheWalls.East;
            theMap[1, 2].MyWalls = TheWalls.North;
            theMap[2, 1].MyWalls = TheWalls.West;
            aGame.GetTheseus().Coordinate = thesStart;
            aGame.GetMinotaur().Coordinate = minStart;

            /*
            .___.___.___.___.
            | 0   1   2   3 |
            .   .   .   .   .
            | 1   M |       |
            .   .___.   .   .___.
            | 2       T       X
            .   .   .   .   .___.
            | 3             |
            .___.___.___.___. */

            aGame.GetMinotaur().Hunt();
            actualPoint = aGame.GetMinotaurPosition();

            Assert.AreEqual(expectedPoint, actualPoint, "Minotaur was not on the expected Tile");
        }
예제 #6
0
        public void c_MinotaurReaction_Diagonal_1block_upleft()
        {
            Point expectedPoint, actualPoint, minStart, thesStart;
            minStart = new Point(1, 1);
            thesStart = new Point(0, 0);
            expectedPoint = new Point(0, 0);
            Game aGame = new Game();
            Theseus theseus = aGame.GetTheseus();
            Minotaur minotaur = aGame.GetMinotaur();

            aGame.SetTestMap(2);
            aGame.GetTheseus().Coordinate = thesStart;
            aGame.GetMinotaur().Coordinate = minStart;

            /*
            .___.___.___.___.
            | T   1   2   3 |
            .   .   .   .   .
            | 1   M         |
            .   .   .   .   .___.
            | 2               X
            .   .   .   .   .___.
            | 3             |
            .___.___.___.___. */

            aGame.GetMinotaur().Hunt();
            actualPoint = aGame.GetMinotaurPosition();

            Assert.AreEqual(expectedPoint, actualPoint, "Minotaur was not on the expected Tile");
        }
예제 #7
0
        public void d_MinotaurReaction_Diagonal_blockeddownleft_3blocks_downleft_3()
        {
            Point expectedPoint, actualPoint, minStart, thesStart;
            minStart = new Point(3, 0);
            thesStart = new Point(2, 3);
            expectedPoint = new Point(3, 0);
            Game aGame = new Game();
            Theseus theseus = aGame.GetTheseus();
            Minotaur minotaur = aGame.GetMinotaur();

            aGame.SetTestMap(2);
            Tile[,] theMap = aGame.GetMap();
            theMap[3, 0].MyWalls = TheWalls.North | TheWalls.South | TheWalls.East | TheWalls.West;
            theMap[3, 1].MyWalls = TheWalls.North | TheWalls.East;
            theMap[2, 0].MyWalls = TheWalls.North | TheWalls.East;
            aGame.GetTheseus().Coordinate = thesStart;
            aGame.GetMinotaur().Coordinate = minStart;

            /*
            .___.___.___.___.
            | 0   1   2 | M |
            .   .   .   .___.
            | 1             |
            .   .   .   .   .___.
            | 2               X
            .   .   .   .   .___.
            | 3       T     |
            .___.___.___.___. */

            aGame.GetMinotaur().Hunt();
            actualPoint = aGame.GetMinotaurPosition();

            Assert.AreEqual(expectedPoint, actualPoint, "Minotaur was not on the expected Tile");
        }
예제 #8
0
        public void a_BasicMovementTest_Right()
        {
            Point expectedPoint, actualPoint;
            expectedPoint = new Point(2, 1);
            Game aGame = new Game();
            Theseus theseus = aGame.GetTheseus();

            aGame.SetTestMap(1);
            /*
            .___.___.___.
            | 0   1   2 |
            .   .   .   .___.
            | 1   T   E | M |
            .   .   .   .___.
            | 2         |
            .___.___.___.  */

            aGame.GetTheseus().Move(Direction.Right);
            actualPoint = aGame.GetTheseusPosition();

            Assert.AreEqual(expectedPoint, actualPoint, "Theseus was not on the expected Tile");
        }
예제 #9
0
        public void b_IsBlockedTest_Up()
        {
            Point theseusPoint;
            Boolean expected, actual;
            expected = true;
            Game aGame = new Game();
            Theseus theseus = aGame.GetTheseus();
            theseusPoint = new Point(1, 0);

            aGame.SetTestMap(1);
            aGame.GetTheseus().Coordinate = theseusPoint;

            /*
            .___.___.___.
            | 0   T   2 |
            .   .   .   .
            | 1         |
            .   .   .   .
            | 2         |
            .___.___.___.  */

            actual = aGame.GetTheseus().IsBlocked(Direction.Up);

            Assert.AreEqual(expected, actual, "Theseus did not recognise he was blocked");
        }
예제 #10
0
        public void m_MapTest_HasExitTile_allMaps()
        {
            Game aGame = new Game();
            aGame.SetMap(1);
            Tile[,] theMap;
            Tile [][,] allTheMaps = aGame.GetFiler().GetAllMyMaps();
            bool expected, actual;
            expected = true;
            actual = true;

            // return true if one tile is the exit, else return false

            for (int i = 0;  i < allTheMaps.Length; i++)
            {
                if (allTheMaps[i] != null)
                {
                    theMap = allTheMaps[i];
                    if (aGame.HasExitTile(theMap) == false)
                    {
                        actual = false;
                    }
                }
            }
            Assert.AreEqual(expected, actual, "One of the maps does not have an exit tile");
        }
예제 #11
0
        public void c_MinotaurReaction_Vertical_3blocks()
        {
            Point expectedPoint, actualPoint, minStart, thesStart;
            minStart = new Point(0, 0);
            thesStart = new Point(0, 3);
            expectedPoint = new Point(0, 2);
            Game aGame = new Game();
            Theseus theseus = aGame.GetTheseus();
            Minotaur minotaur = aGame.GetMinotaur();

            aGame.SetTestMap(2);
            aGame.GetTheseus().Coordinate = thesStart;
            aGame.GetMinotaur().Coordinate = minStart;

            /*
            .___.___.___.___.
            | M   1   2   3 |
            .   .   .   .   .
            | 1             |
            .   .   .   .   .___.
            | E               X
            .   .   .   .   .___.
            | T             |
            .___.___.___.___. */

            aGame.GetMinotaur().Hunt();
            actualPoint = aGame.GetMinotaurPosition();

            Assert.AreEqual(expectedPoint, actualPoint, "Minotaur was not on the expected Tile");
        }
예제 #12
0
파일: Program.cs 프로젝트: midas06/Theseus
 static void Main(string[] args)
 {
     //new Controller(new ConsoleView(), new Game()).Init();
     Game aGame = new Game();
     aGame.Run();
 }
예제 #13
0
파일: Thing.cs 프로젝트: midas06/Theseus
 internal void SetGame(Game aGame)
 {
     myGame = aGame;
 }
예제 #14
0
        public void d_MinotaurReaction_Vertical_1block()
        {
            Point expectedPoint, actualPoint, minStart, thesStart;
            minStart = new Point(0, 0);
            thesStart = new Point(0, 1);
            expectedPoint = new Point(0, 0);
            Game aGame = new Game();
            Theseus theseus = aGame.GetTheseus();
            Minotaur minotaur = aGame.GetMinotaur();

            aGame.SetTestMap(2);
            aGame.GetMap()[0, 0].MyWalls = TheWalls.North | TheWalls.South | TheWalls.West;
            aGame.GetMap()[0, 1].MyWalls = TheWalls.North | TheWalls.West;
            aGame.GetTheseus().Coordinate = thesStart;
            aGame.GetMinotaur().Coordinate = minStart;

            /*
            .___.___.___.___.
            | M   1   2   3 |
            .___.   .   .   .
            | T             |
            .   .   .   .   .___.
            | 2               X
            .   .   .   .   .___.
            | 3             |
            .___.___.___.___. */

            aGame.GetMinotaur().Hunt();
            actualPoint = aGame.GetMinotaurPosition();

            Assert.AreEqual(expectedPoint, actualPoint, "Minotaur was not on the expected Tile");
        }
예제 #15
0
        public void d_MinotaurReaction_Diagonal_blockedup_3blocks_upright_2()
        {
            Point expectedPoint, actualPoint, minStart, thesStart;
            minStart = new Point(0, 3);
            thesStart = new Point(1, 0);
            expectedPoint = new Point(1, 2);
            Game aGame = new Game();
            Theseus theseus = aGame.GetTheseus();
            Minotaur minotaur = aGame.GetMinotaur();

            aGame.SetTestMap(2);
            Tile[,] theMap = aGame.GetMap();
            theMap[0, 3].MyWalls = TheWalls.South | TheWalls.West | TheWalls.North;
            theMap[0, 2].MyWalls = TheWalls.West | TheWalls.South;
            aGame.GetTheseus().Coordinate = thesStart;
            aGame.GetMinotaur().Coordinate = minStart;

            /*
            .___.___.___.___.
            | 0   T   2   3 |
            .   .   .   .   .
            | 1             |
            .   .   .   .   .___.
            | 2               X
            .___.   .   .   .___.
            | M             |
            .___.___.___.___. */

            aGame.GetMinotaur().Hunt();
            actualPoint = aGame.GetMinotaurPosition();

            Assert.AreEqual(expectedPoint, actualPoint, "Minotaur was not on the expected Tile");
        }