Пример #1
0
        public static int FallInToPit()
        {
            Console.Clear();
            Console.WriteLine("============================================");
            Console.WriteLine("You fall into a buttomless pit...");
            Console.WriteLine("============================================");
            PrintEndINFO();
            Console.WriteLine("--------\nGameOver\n--------");
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
            Console.Clear();
            VisitedPointOfInterest.Clear();
            VisitedTrace.Clear();
            EndMapInfo.Clear();
            MapInfo.Clear();

            return(99);
        }
Пример #2
0
        public static void PopulatePlayer(string size)
        {
            int col = Loc.Next(MapSize[size]);
            int row = Loc.Next(MapSize[size]);

            if (newMap[col, row].Occupied == false)
            {
                newMap[col, row].Player       = true;
                newMap[col, row].Occupied     = true;
                PlayerCurrentCol              = col;
                PlayerCurrentRow              = row;
                newMap[col, row].VisitedTrace = true;
                VisitedTrace.Enqueue($"[{newMap[col, row].Column},{newMap[col, row].Row}]");
            }
            else
            {
                PopulatePlayer(size);
            }
        }
Пример #3
0
        public static int WumpusEatsYou()
        {
            if (newMap[PlayerCurrentCol, PlayerCurrentRow].Wumpus == true)
            {
                Console.Clear();

                Console.WriteLine("==========================");
                Console.WriteLine("You got eaten by Wumpus!");
                Console.WriteLine("==========================");
                PrintEndINFO();
                Console.WriteLine("--------\nGameOver\n--------");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
                Console.Clear();
                VisitedPointOfInterest.Clear();
                VisitedTrace.Clear();
                EndMapInfo.Clear();
                MapInfo.Clear();

                return(99);
            }
            else
            {
                Console.Clear();

                Console.WriteLine("==========================");
                Console.WriteLine("You missed Wumpus...");
                Console.WriteLine("You got eaten by Wumpus!");
                Console.WriteLine("==========================");
                PrintEndINFO();
                Console.WriteLine("--------\nGameOver\n--------");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
                Console.Clear();
                VisitedPointOfInterest.Clear();
                VisitedTrace.Clear();
                EndMapInfo.Clear();
                MapInfo.Clear();


                return(99);
            }
        }
Пример #4
0
 public static int CheckIfWumpusDead(int updateCol, int updatedRow)
 {
     if (newMap[updateCol, updatedRow].Wumpus == true)
     {
         Console.WriteLine("=============================================");
         Console.WriteLine("You shot Wumpus dead in the head, you win!!");
         Console.WriteLine("=============================================");
         PrintEndINFO();
         Console.WriteLine("--------\nGameOver\n--------");
         Console.ReadKey();
         Console.Clear();
         VisitedPointOfInterest.Clear();
         VisitedTrace.Clear();
         EndMapInfo.Clear();
         MapInfo.Clear();
         return(100);
     }
     else
     {
         return(WumpusEatsYou());
     }
 }
Пример #5
0
        //**Methods and statements in below section allow players to Move, Shoot, get Notes, trace Player's previous moves and cheat.**

        //The Move method update the player's location by assigning proper value to Cavern.Player property.
        public static int Move(string size)
        {
            PlayerPreviousCol = PlayerCurrentCol;
            PlayerPreviousRow = PlayerCurrentRow;
            string direction = Console.ReadLine();

            switch (direction)
            {
            case "1":
                newMap[PlayerCurrentCol, PlayerCurrentRow].Player   = false;
                newMap[PlayerCurrentCol, PlayerCurrentRow].Occupied = false;
                int updatedRow = PlayerCurrentRow - 1;
                if (updatedRow < 0)
                {
                    updatedRow = MapSize[size] - 1;
                }
                newMap[PlayerCurrentCol, updatedRow].Player = true;
                PlayerCurrentRow = updatedRow;
                VisitedTrace.Enqueue($"[{newMap[PlayerCurrentCol, updatedRow].Column},{newMap[PlayerCurrentCol, updatedRow].Row}]");
                newMap[PlayerCurrentCol, updatedRow].VisitedTrace = true;
                Game.move++;
                return(CheckIfCavernIsOccupied(size));

            case "2":
                newMap[PlayerCurrentCol, PlayerCurrentRow].Player   = false;
                newMap[PlayerCurrentCol, PlayerCurrentRow].Occupied = false;
                updatedRow = PlayerCurrentRow + 1;
                if (updatedRow > MapSize[size] - 1)
                {
                    updatedRow = 0;
                }
                newMap[PlayerCurrentCol, updatedRow].Player = true;
                PlayerCurrentRow = updatedRow;
                VisitedTrace.Enqueue($"[{newMap[PlayerCurrentCol, updatedRow].Column},{newMap[PlayerCurrentCol, updatedRow].Row}]");
                newMap[PlayerCurrentCol, updatedRow].VisitedTrace = true;
                Game.move++;
                return(CheckIfCavernIsOccupied(size));

            case "4":
                newMap[PlayerCurrentCol, PlayerCurrentRow].Player   = false;
                newMap[PlayerCurrentCol, PlayerCurrentRow].Occupied = false;
                int updatedCol = PlayerCurrentCol - 1;
                if (updatedCol < 0)
                {
                    updatedCol = MapSize[size] - 1;
                }
                newMap[updatedCol, PlayerCurrentRow].Player = true;
                PlayerCurrentCol = updatedCol;
                VisitedTrace.Enqueue($"[{newMap[updatedCol, PlayerCurrentRow].Column},{newMap[updatedCol, PlayerCurrentRow].Row}]");
                newMap[updatedCol, PlayerCurrentRow].VisitedTrace = true;
                Game.move++;
                return(CheckIfCavernIsOccupied(size));

            case "3":
                newMap[PlayerCurrentCol, PlayerCurrentRow].Player   = false;
                newMap[PlayerCurrentCol, PlayerCurrentRow].Occupied = false;
                updatedCol = PlayerCurrentCol + 1;
                if (updatedCol > MapSize[size] - 1)
                {
                    updatedCol = 0;
                }
                newMap[updatedCol, PlayerCurrentRow].Player = true;
                PlayerCurrentCol = updatedCol;
                VisitedTrace.Enqueue($"[{newMap[updatedCol, PlayerCurrentRow].Column},{newMap[updatedCol, PlayerCurrentRow].Row}]");
                newMap[updatedCol, PlayerCurrentRow].VisitedTrace = true;
                Game.move++;
                return(CheckIfCavernIsOccupied(size));

            default:
                Game.Update();
                return(0);
            }
        }