/// <summary>
        /// This method contains the main loop cycle for the game, showing the
        /// start menu and registering player input for each action every turn,
        /// finishing whenever someone wins, loses or quits
        /// it returns nothing
        /// </summary>
        public void Loop(int chosenDiff)
        {
            // create new level based on the chosen difficulty and current lvl
            newLevel = new Levels(lvlCount, (chosenDiff * lvlCount));


            // initialise the PrintText class so different texts can be printed
            PrintText gameInfo = new PrintText();

            // only show the menu and create board at startup
            if (!start)
            {
                menu.Menu();
                board.DefineBoard(newLevel);
            }

            // set start to true to hide menu and set the board
            start = true;

            // For reading the player's input
            ConsoleKey answer;

            // cycle to print board and run the game while conditions not met
            do
            {
                // render the board anew each time the cycle loops
                board.RenderBoard(newLevel);

                // Showcase player's current stats through level progression
                gameInfo.GameText(newLevel, board.player, board.inventory, key);

                // Read user's single key input
                answer = Console.ReadKey().Key;

                // Clear console for ease of view
                Console.Clear();

                // check the action given by the player

                // activate look around
                if (answer == ConsoleKey.D5)
                {
                    List <CurrentMapObjects> lookAroundItems =
                        new List <CurrentMapObjects>();

                    // get the objects around the player
                    foreach (CurrentMapObjects item in board.itemList)
                    {
                        board.player.Surroundings(lookAroundItems, item, board);
                    }

                    // show the look around menu
                    gameInfo.LookAroundText(lookAroundItems);

                    // clear the items for next movement positions
                    lookAroundItems.Clear();
                }


                // move to the south
                if (answer == ConsoleKey.S &&
                    Position.IsValidPosition
                        ((new Position((board.player.Position.Row + 1),
                                       (board.player.Position.Col))), (GameBoard.RowSize - 1),
                        (GameBoard.ColSize - 1)))
                {
                    // set the key to print the action
                    key = 'S';

                    // remove 1hp for turn
                    board.player.HealthChange(-1);

                    // reset the cell the player was on
                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells((char)Chars.path, true);

                    // set the cell at new player position
                    board.player.Position.Row++;
                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells(board.player.name, false);
                }

                if (answer == ConsoleKey.W &&
                    Position.IsValidPosition
                        ((new Position((board.player.Position.Row - 1),
                                       (board.player.Position.Col))), (GameBoard.RowSize - 1),
                        (GameBoard.ColSize - 1)))
                {
                    key = 'W';

                    board.player.HealthChange(-1);

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells((char)Chars.path, true);

                    board.player.Position.Row--;

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells(board.player.name, false);
                }

                if (answer == ConsoleKey.A && Position.IsValidPosition((new Position((board.player.Position.Row), (board.player.Position.Col - 1))), (GameBoard.RowSize - 1), (GameBoard.ColSize - 1)))
                {
                    key = 'A';

                    board.player.HealthChange(-1);

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells((char)Chars.path, true);

                    board.player.Position.Col--;

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells(board.player.name, false);
                }

                if (answer == ConsoleKey.D &&
                    Position.IsValidPosition((
                                                 new Position((board.player.Position.Row),
                                                              (board.player.Position.Col + 1))),
                                             (GameBoard.RowSize - 1), (GameBoard.ColSize - 1)))
                {
                    key = 'D';

                    board.player.HealthChange(-1);

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells((char)Chars.path, true);

                    board.player.Position.Col++;

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells(board.player.name, false);
                }

                if (answer == ConsoleKey.Q &&
                    Position.IsValidPosition((
                                                 new Position((board.player.Position.Row - 1),
                                                              (board.player.Position.Col - 1))),
                                             (GameBoard.RowSize - 1), (GameBoard.ColSize - 1)))
                {
                    key = 'Q';

                    board.player.HealthChange(-1);

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells((char)Chars.path, true);

                    board.player.Position.Col--;
                    board.player.Position.Row--;

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells(board.player.name, false);
                }

                if (answer == ConsoleKey.E &&
                    Position.IsValidPosition((
                                                 new Position((board.player.Position.Row - 1),
                                                              (board.player.Position.Col + 1))), (GameBoard.RowSize - 1),
                                             (GameBoard.ColSize - 1)))
                {
                    key = 'E';

                    board.player.HealthChange(-1);

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells((char)Chars.path, true);

                    board.player.Position.Col++;
                    board.player.Position.Row--;

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells(board.player.name, false);
                }

                if (answer == ConsoleKey.Z &&
                    Position.IsValidPosition((
                                                 new Position((board.player.Position.Row + 1),
                                                              (board.player.Position.Col - 1))),
                                             (GameBoard.RowSize - 1), (GameBoard.ColSize - 1)))
                {
                    key = 'Z';

                    board.player.HealthChange(-1);

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells((char)Chars.path, true);

                    board.player.Position.Col--;
                    board.player.Position.Row++;

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells(board.player.name, false);
                }

                if (answer == ConsoleKey.X &&
                    Position.IsValidPosition((new Position((
                                                               board.player.Position.Row + 1),
                                                           (board.player.Position.Col + 1))), (GameBoard.RowSize - 1),
                                             (GameBoard.ColSize - 1)))
                {
                    key = 'X';

                    board.player.HealthChange(-1);

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells((char)Chars.path, true);

                    board.player.Position.Col++;
                    board.player.Position.Row++;

                    board.cells[board.player.Position.Row,
                                board.player.Position.Col] =
                        new BoardCells(board.player.name, false);
                }

                if (answer == ConsoleKey.D2)
                {
                    if (board.map.FallenInto(board.player))
                    {
                        key = 'M';

                        board.itemList.Remove(board.map);

                        foreach (CurrentMapObjects items in board.itemList)
                        {
                            board.cells[items.Position.Row, items.Position.Col]
                                = new BoardCells((char)items.Name, false);
                        }
                    }

                    else
                    {
                        key = 'P';

                        foreach (Food foode in board.food)
                        {
                            if (foode.FallenInto(board.player))
                            {
                                board.player.Inventory.AddToInventory(
                                    new Food(foode.Position,
                                             foode.Name, foode.Info, foode.Weight,
                                             foode.HPIncrease));
                            }
                        }
                        board.inventory.WriteInfo(board, board.player, "pickup");
                    }
                }


                if (answer == ConsoleKey.D3)
                {
                    key = 'D';
                    if (board.inventory.foodInInventory.Count > 0 || board.inventory.weaponsInInventory.Count > 0)
                    {
                        board.inventory.WriteInfo(board, board.player, "use");
                    }
                    else
                    {
                        Console.Clear();
                        Console.WriteLine("your inventory is empty!!");

                        Console.ReadKey();
                    }
                }

                if (answer == ConsoleKey.D4)
                {
                    if (board.inventory.foodInInventory.Count > 0 || board.inventory.weaponsInInventory.Count > 0)
                    {
                        board.inventory.WriteInfo(board, board.player, "drop");
                    }
                    else
                    {
                        Console.Clear();
                        Console.WriteLine("your inventory is empty!!");

                        Console.ReadKey();
                    }
                }

                if (answer == ConsoleKey.D1)
                {
                    gameInfo.EnemyAttackText();
                }
                if (answer == ConsoleKey.D6)
                {
                    gameInfo.HelpText(board.food, board.weapons, board.traps,
                                      board.inventory, board.player);
                }

                if (answer == ConsoleKey.D8)
                {
                    Console.Clear();

                    Console.WriteLine("are you sure you wish to quit? y/n");
                    ConsoleKey quit = Console.ReadKey().Key;


                    if (quit == ConsoleKey.Y)
                    {  //insert score stuff
                        Console.WriteLine("thank you for playing!");
                        board.player.Health = 0;
                    }
                }


                foreach (Enemy enemy in board.enemies)
                {
                    if (enemy.FallenInto(board.player))
                    {
                        board.player.HealthChange(-rnd.Next(enemy.AttackPower,
                                                            enemy.MaxDamage));
                        key = 'L';
                    }
                }

                foreach (Trap trap in board.traps)
                {
                    if (trap.FallenInto(board.player))
                    {
                        board.player.HealthChange(-rnd.Next(trap.MaxDamage));
                        key         = 'T';
                        trap.Active = false;
                    }
                }



                if (board.cells[board.player.Position.Row,
                                board.player.Position.Col] ==
                    board.cells[board.exit.Position.Row,
                                board.exit.Position.Col])
                {
                    Console.WriteLine("Congratulations! you've reached the exit!");
                    Console.WriteLine("Press any key to continue to the next level");
                    Console.ReadKey();
                    Console.Clear();
                    start = true;
                    board.ResetBoard();
                    board.DefineBoard(newLevel);
                    lvlCount++;
                    Loop(chosenDiff);
                }
            }
            // run the loop while the player hasn't won, lost or quit
            while (board.player.Health > 0);

            Console.WriteLine("please input your name for the score");
            string name = Console.ReadLine();

            score = new GameScore(name, newLevel.ScoreSetter(lvlCount));
            score.SaveScoreOnFile(score);
            Environment.Exit(0);
        }
        /// <summary>
        /// Method to store all information needed for the Main menu.
        /// This method returns nothing
        /// </summary>
        public void Menu()
        {
            // Clear console
            Console.Clear();

            // Creation of instance of gameloop
            GameLoop loop = new GameLoop();

            // Creation of instance of GameScore
            GameScore score = new GameScore();

            // Creation of instance of PrintText
            PrintText menuInfo = new PrintText();

            // Get the text menu method
            menuInfo.MenuText();

            // Variable
            ConsoleKey answer;

            answer = Console.ReadKey().Key;
            Console.WriteLine();

            // Depending on user key input switch to the respective case and
            // Perform according to its case body
            switch (answer)
            {
            // Start game
            case ConsoleKey.A:
                //   loop.Loop();
                break;

            // Load Score screen
            case ConsoleKey.B:
                Console.WriteLine();
                if (File.Exists(($"Highscores_{GameBoard.RowSize}x{GameBoard.ColSize}.txt")) == false)
                {
                    Console.WriteLine("No highscores for this board yet!");
                    Console.WriteLine();
                    Console.WriteLine("Press any key to return");
                    Console.ReadKey();
                }

                else
                {
                    menuInfo.ScoreText();
                    score.LoadScoreFromFile(loop.score);
                    Console.WriteLine();
                    Console.WriteLine("Press any key to return");
                    Console.ReadKey();
                }
                Menu();
                break;

            // Load credits screen
            case ConsoleKey.C:
                Console.WriteLine("Game developed by:");
                Console.WriteLine();
                Console.WriteLine("Ana dos Santos - a21801899");
                Console.WriteLine("Diana Levay - a21801515");
                Console.WriteLine();
                Console.WriteLine("Press any key to return");
                Console.ReadKey();
                Menu();
                break;

            // End game
            case ConsoleKey.D:
                Console.WriteLine("Thank you for playing!");
                Environment.Exit(0);
                break;

            // In case other unknown key are typed by the user. Print the
            // message and go back to menu.
            default:
                Console.WriteLine("Please select one of the letters in the menu!");
                Console.WriteLine("Press any key to return");
                Console.ReadKey();
                Menu();
                break;
            }
        }