-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.cpp
More file actions
86 lines (71 loc) · 1.28 KB
/
Copy pathstart.cpp
File metadata and controls
86 lines (71 loc) · 1.28 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include <iostream>
#include "Field.h"
#include "Animal.h"
#include "Victim.h"
#include "Predator.h"
#include <cstdlib>
#include <ctime>
#include <string>
#include <Windows.h>
#include <conio.h>
void main();
void PrintMap(Field& userMap);
using namespace std;
void start(Field& userMap)
{
string command;
//If it's not a loaded map
if (userMap.checkGame() == 2)
{
userMap.setFirstAnimals();
system("cls");
PrintMap(userMap);
cout << "Start game";
}
while (true)
{
//cin >> command;
while (command == "save")
{
if (command == "save")
userMap.SaveMap();
cin >> command;
}
//To menu
if (command == "menu")
main();
userMap.move();
system("cls");
PrintMap(userMap);
switch (userMap.checkGame())
{
case 0:
cout << "All Victims were died! Predators win!";
cin.get();
main();
case 1:
cout << "All Predators were died! Victims win!";
cin.get();
main();
}
Sleep(100);
command.clear();
}
};
//ïå÷àòü êàðòû
void PrintMap(Field& userMap)
{
for (unsigned int i = 0; i < userMap.userHeight; i++)
{
for (unsigned int j = 0; j < userMap.userWidth; j++)
{
if (userMap.getVictim(j, i) == true)
cout << 'v';
else if (userMap.getPredator(j, i) == true)
cout << 'p';
else
cout << '.';
}
cout << endl;
}
}