-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapDriver.cpp
39 lines (30 loc) · 1013 Bytes
/
mapDriver.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "Map.h"
#include <iostream>
using namespace std;
int main() {
Map map; // create object called map of type Map
map.spawnBestBuy(1, 3);
map.spawnNPC(2, 5);
map.spawnNPC(3, 8);
map.spawnHacker(1, 1);
char move; // for storing user input
// quit after 10 moves
for(int i = 0; i < 10; i++) {
map.displayMap(); // pretty print map_data in terminal
cout << "Valid moves are: " << endl;
map.displayMoves(); // give user a menu of valid moves to pick from
cout << "Input a move: ";
cin >> move;
cout << endl;
map.executeMove(move); // move the player on map based on user input
if (map.isBestBuyLocation()) {
cout << "You're in a Best Buy!" << endl;
}
if (map.isHackerLocation()) {
cout << "You've encountered a Hacker!" << endl;
}
if (map.isNPCLocation()) {
cout << "You've encountered an NPC!" << endl;
}
}
}