Question

In: Computer Science

Maze in C++ Simple Maze Program – Project Specifications: 1. Create a simple maze game that...

Maze in C++

Simple Maze Program – Project Specifications:

1. Create a simple maze game that a player must traverse to win.

3. The maze must be text-based and adjustable from 5x5 to 20x20. • Player gets to choose size either as:

1) any size in the range from 5-20 by 5-20. 2) selects from 4 set size options [5x5,10x10,15x15, and 20x20] • the player can choose among different mazes. • You will need to figure out how to denote your location in the maze.

For a 5x5 maze you have 25 actual spots that are valid, if you can get to them. • You will need to figure out a way to know if you can move in a particular direction or not. You cannot move East if there is a wall to your East.

4. The maze must be displayed with a current position of the player after each move. • Display the Text-based Maze to the player - top-down view • Players sees the maze layout (walls and openings), but not what is in each maze area (e.g. Items, locked door, or mobs)

5. The maze must contain Randomized Items for the player to pick up or interact with: • At the start of the game -- Items are randomly placed in the maze • Only story specific items at the starting and ending locations, do not need to be randomized.

Some suggestion for Classes:

1. Maze -- data and functions associated with maintaining and drawing the maze

2. Items -- data and functions associated with each object in the maze

3. Player -- data and functions associated with the player

4. Backpack -- data and functions associated with stuff player picks up in maze

Some suggestion for Functions – mostly if classes not used:

1. Function to display Maze Game Introduction.

2. Function to display Game Help.

3. Function to display the maze for the player.

4. Function to get move direction from player.

5. Function to display information about current location.

6. Function to display information about a specific item.

7. Function to display current inventory

8. Function to display menu or user prompt for next command.

9. Function to display whether the player won or lost

11.The Maze Game Program needs to include:

• A game introduction displayed to the player to welcome them to the game. • Initialize all the game elements.

• Create a Play Again Loop so the player can play again.

• Create an internal Game Loop so that the player can progress through the game one command at a time.

• User Prompts to let the player know how to interact with the game and what commands are valid at this time. This prompt can either be 1 line or a menu display. • A help display on command.

• Quit must be accepted as a command to stop the game at any time. • The maze must be displayed with current position after every command is acted upon.

• You must give the player information/feedback of their current position and what is around them (like items) after each command to let them know their status.

• You must let the player know they won or lost or quit to end the play Game Loop.

• A game farewell message must be given before you end the game.

Solutions

Expert Solution

Hi,

Below is the required code for the maze problem in c++:

#include<bits/stdc++.h>
#include<iostream>
#include<windows.h>
using namespace std;
int getKey();
const char WALL = (char)219;
void main(){
int row = 0;
int column = 0;
int key = getKey();
COORD newCoord = { column, row };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), newCoord);
cout << WALL;
while (key != VK_ESCAPE) {
if (key == VK_LEFT && column > 0){
column--;
}
else if (key == VK_RIGHT){
column++;
}
else if (key == VK_UP && row > 0){
row--;
}
else if (key == VK_DOWN){
row++;
}
COORD newCoord = { column, row };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), newCoord);
cout << WALL;
key = getKey();
}
}
int getKey(){
int result = 0;
while (result == 0)
{
short MAX_SHORT = 0x7FFF; //111111111111111
if (GetAsyncKeyState(VK_LEFT) & MAX_SHORT){
result = VK_LEFT;
}
else if (GetAsyncKeyState(VK_UP) & MAX_SHORT){
result = VK_UP;
}
else if (GetAsyncKeyState(VK_RIGHT) & MAX_SHORT) {
result = VK_RIGHT;
}
else if (GetAsyncKeyState(VK_DOWN) & MAX_SHORT){
result = VK_DOWN;
}
}
return result;
}

Related Solutions

c++ maze game Project Scope – Details of the Project: Sample Maze Layout: User Interface: Data...
c++ maze game Project Scope – Details of the Project: Sample Maze Layout: User Interface: Data Structures: Data Classes: Project Details: Algorithm (flowchart and/or pseudo-code):
The Project is: 1. Create a new Java program which implements a simple PacMan-type text game...
The Project is: 1. Create a new Java program which implements a simple PacMan-type text game which contains the following functionality: A) At program startup, constructs and displays a 2-dimensional grid using standard array(s) (no collection classes allowed) with the size dynamically specified by the user (X and Y sizes can be different). Places the PacMan in the upper-left corner of the grid facing left All grid cells should have the empty cell character of ‘.’ except for the start...
Design c++ program so that it correctly meets the program specifications given below.   Specifications: Create a...
Design c++ program so that it correctly meets the program specifications given below.   Specifications: Create a menu-driven program that finds and displays areas of 3 different objects. The menu should have the following 4 choices: 1 -- square 2 -- circle 3 -- right triangle 4 -- quit If the user selects choice 1, the program should find the area of a square. If the user selects choice 2, the program should find the area of a circle. If the...
In this lab, you will practice the use of array by building an simple maze game,...
In this lab, you will practice the use of array by building an simple maze game, where your task is to control the prince to defeat the monster and save Snow White. You have to work based on the given skeleton code. Game Description The Snow White is detained in the maze by the monster, who needs the prince's help to rescure her out from the exit. The pre-set maze is shown below, with width 11 and height 8. The...
In this lab, you will practice the use of array by building an simple maze game,...
In this lab, you will practice the use of array by building an simple maze game, where your task is to control the prince to defeat the monster and save Snow White. You have to work based on the given skeleton code. Game Description The Snow White is detained in the maze by the monster, who needs the prince's help to rescure her out from the exit. The pre-set maze is shown below, with width 11 and height 8. The...
Create a simple dice game in Java. Add screenshots and the program here.
Create a simple dice game in Java. Add screenshots and the program here.
C program simple version of blackjack following this design. 1. The basic rules of game A...
C program simple version of blackjack following this design. 1. The basic rules of game A deck of poker cards are used. For simplicity, we have unlimited number of cards, so we can generate a random card without considering which cards have already dealt. The game here is to play as a player against the computer (the dealer). The aim of the game is to accumulate a higher total of points than the dealer’s, but without going over 21. The...
1. [100] Create a C program for a number guessing game. Here are the requirements: a....
1. [100] Create a C program for a number guessing game. Here are the requirements: a. Your program generates a random number between -100 and 100 and keeps asking the user to guess the number until the user guesses it correctly. Your random number generator should be implemented as a C function which takes min and max values as input parameters and returns a random number between those values including the min and the max. b. If the user guesses...
Create a C++ program that follows the specifications below: *Define a struct with 4 or more...
Create a C++ program that follows the specifications below: *Define a struct with 4 or more members. *Application must have at least one user-defined function *Declare an array of your struct using a size of 10 or more *Load the date for each element in your array from a text file *Display the data in your array in the terminal *provide brief comments for each line of code
Write a code for simple racing game (using dots) on c program.
Write a code for simple racing game (using dots) on c program.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT