Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program in C++ 11 (Please provide proof- screenshots of the working resu

ID: 3673794 • Letter: W

Question

Write a program in C++ 11 (Please provide proof- screenshots of the working result)

The program enables the user to move through a maze. Maze should contain locked doors that require keys. There are killer ghosts guarding the maze. For every 30 steps the player takes, a new killer ghost will randomly appear on each level. Ghosts cannot hurt a player who just picked up and ate an apple. To get out of the maze the user needs to navigate the maze,escape ghosts by eating apples.. There will be apples that protects the player against the ghosts. A player can carry up to two apples at a time.As long as the player has an apple in their inventory, they may stop and eat it in order to render them invulnerable to swans for the next 15 steps. and reach a ladder which takes them to another maze. Each maze must contain a ladder that takes the player to the next maze till its the final maze where there is an exit door instead of a ladder.

Start the game with a single command line argument. This will be an integer value that indicates the number of levels. The floor files will be named floor_# where # indicates which floor it holds. Your program will always start reading with the first floor. An example of running the game with a maze that has 3 floors: ./maze 3 (assumes name of first floor is: floor_1) The maze is defined by a set of text files, each of which contains a single level. Whenever the game starts or the player reaches a new level, that data must be read from the appropriate text file. The first line of each file will have two integer values which describe the number of rows and columns for that level. You must use this to create a dynamic array of that size and then read in the data for the level. Perform input validation on all characters in the file as you read them. Do not load the file and inform the user there is a problem.

The following characters or symbols describe objects in the levels: ‘#’- walls ‘D’- door ‘L’- Ladder ‘P’- Player ‘S’- Swan (the starting location of the first swan) ‘K’ Key ‘A’- Apple ‘E’- Starting location for each level ‘X’- Exit(one way out) ‘ ‘- empty space (blank character) You must concatenate the file name with the new floor number. You will not use an array of filenames? HINT: This will require string streams. You must display that level to the user. Then you will accept the following commands from the user: ‘w’ move up ‘a’ move left ‘s’ move down ‘d’ move right ‘e’ eat apple ‘u’ use ladder ‘q’ quit Each input from the user must be validated before any action takes place. After each command, you will update the array, then print the current status of the game to the screen. Each command is one “step” which you will use to coordinate movement and summoning of the swans. You will update the position of the player and all swans after every move entered by the player. The K (key) and A (apple) symbols will be removed from the maze after the player picks them up. The D (door) is removed once the player enters that space with a key. To move between floors, the player must get to the space with the ladder. On the final level the player must reach the X to exit the maze and make their escape. The position of each Actor (Swan or Player) will not be stored in the array. It will be stored in the Player or Swan object. When you read in the initial floor array the ‘S’ should be changed to a blank character. When you display the floor after each move you will print the array, adding a ‘P’ or ‘S’ as appropriate for each Actor. Movement- To move around a level the players must use the ‘W’, ‘A’. ‘S, and ‘D’ keys. Your move function should prevent them from moving through walls, or a door if they don’t have a key. If the player has a key then they can move through a door. Simply remove a key from the player and convert the D space to an empty space assuming the user has at least one. When the player gets to a ladder space they climb it with a ‘U’ command. The E character designates where the player starts on the new level. Time (i.e. the number of steps) is reset on each new level. When the player moves from the starting space, the E must remain. If a swan catches a player, their location must be changed to the E square. After each move, the updated maze must be displayed for the user. When the player moves into a space that contains a key (‘K’) they pick up the key to add it to their inventory. When a player moves into a space with an apple (‘A’) they pick it up. A player can hold no more than 3 keys and they can carry only 2 apples. If they enter a space and cannot hold the key or apple it remains in that space. The player can use an apple by eating it (‘E’). This makes the swans ignore the player for the next 15 turns, decreases the apples the player has by 1, and takes an entire step/turn (i.e. they don’t move that step). Swans (10 points): The Swans will be similar to the Player, except they move randomly. They cannot move through walls or doors. They will ignore apples on the ground. If a swan is in a square adjacent to the player, the player will be moved back to the starting space for that level. The swans cannot move between levels. For every 30 steps the player takes, place a new swan at a random valid location in the current level.

Classes. You will need the following classes: Game class- dynamic array for current floor, array of pointers to actors, int total#_floors, int current_floor, function to read in floors from a file Floor class- char [][] tiles, void print to screen, constructor Actor class: ABSTRACT- int row, int column, char symbol, virtual move Swan class (inherits Actor)- move (automated), Player class (inherits Actor)- move (prompt for WASD), keys(s), hold up to 3 keys, hold up to 2 apples (You will need a function to send the player back to the start if a swan moves adjacent to their position.

Explanation / Answer

private void CreatePassage (MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazePassage passage = Instantiate(passagePrefab) as MazePassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(passagePrefab) as MazePassage; passage.Initialize(otherCell, cell, direction.GetOpposite()); } private void CreateWall (MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazeWall wall = Instantiate(wallPrefab) as MazeWall; wall.Initialize(cell, otherCell, direction); if (otherCell != null) { wall = Instantiate(wallPrefab) as MazeWall; wall.Initialize(otherCell, cell, direction.GetOpposite()); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote