assingment

I have this assignment and I cannot understand what I am supposed to offer (deliver) as my finished product, what is being asked in this assignment.

Create a Visual Studio project named GSP115_CourseProject using the process you learned in the iLab this week, but instead of calling your file main.cpp, name it GSP115_Course_Project.cpp.
Type or copy the code listed as PROJECT FILE into the GSP115_Course_Project.cpp file.
Next, right click on the header files in the solution explorer. Select add -> new item. Then select C++ header file and name it GSP115_Course_Project.h.
Type or copy the code listed as header file below into the GSP115_Course_Project.h file.
Familiarize yourself with the code.


From the directions and the code itself I cannot understand if the instructor wants me to write some code, text code for the game as the assignment? So weird.


// GSP115 TREASURE CAVE
// Week 1
#pragma once
#include "GSP115_Course_Project.h"

// Global Constants
const int MAX_ROWS = 7;
const int MIN_ROWS = 0;
const int MAX_COLS = 7;
const int MIN_COLS = 0;
const int TOTAL_ROWS = MAX_ROWS + 1;
const int TOTAL_COLS = MAX_COLS + 1;

using namespace std;


int main()
{
//**Initialize Variables**
srand(time(NULL)); // Seed the random number function

int row, column; // temporarily hold the new player position

string msg; // status message variable
char command; // player input

int playerX, playerY;//WK1 only

bool movePlayer = true; // flag to indicate the player position can be updated
bool gameOver = false; // status flag

//...Add player in rows 0-2, columns 0-2
playerY = rand()%3;//WK1 only
playerX = rand()%3;//WK1 only
cout << "Player starts at row " << char('A'+ playerY) << " and column " << playerX+1 << endl;//WK1&2 only


//**Play Game*************
//...Begin Game Loop
while (!gameOver)
{
cout << "You have moved to position " << char('A'+ playerY)<< playerX+1 << endl;//WK1&2 only
cout << msg.c_str() << endl;
//....Get command
cout << "What is your command? ";
cin >> command;
//....Clear display and message
msg.clear();
system("cls");
//....Process player command
row = playerY;//WK1 only
column = playerX;//WK1 only
switch (command)
{
case 'a':
column = playerX - 1;//WK1 only
if (column < MIN_COLS)
{
column = playerX;//WK1 only
msg = "You have hit the west wall!";
}
break;
case 's':
//row = player.position.row + 1;
row = playerY + 1;//WK1 only
if (row > MAX_ROWS)
{
//row = player.position.row;
row = playerY;//WK1 only
msg = "You have hit the south wall!";
}
break;
case 'w':
row = playerY - 1;//WK1 only
if (row < MIN_ROWS)
{
row = playerY;//WK1 only
msg = "You have hit the north wall!";
}
break;
case 'd':
column = playerX + 1;//WK1 only
if (column > MAX_COLS)
{
column = playerX;//WK1 only
msg = "You have hit the east wall!";
}
break;
case 'q':
gameOver = true;
msg = "Quitting?\n";
break;
default:
movePlayer = false;
break;
}
//....Check if the game is over
if (!gameOver)
{
//.....Move Player
if (movePlayer)
{
playerY = row;//WK1 only
playerX = column;//WK1 only
}
movePlayer = true;
}
}
//...End Game Loop
//**End Game**************
//...Do clean-up
//...Quit
return 0;
}


Header Files:

#pragma once
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <windows.h>
As I understand this assignment you are only supposed to create the project and add the 2 files and paste the code inside. It doesn't say you should write any code, but you should
Familiarize yourself with the code.
That means study it, try to understand and maybe run it.
Topic archived. No new replies allowed.