-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
95 lines (71 loc) · 1.87 KB
/
main.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
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
87
88
89
90
91
92
93
94
95
#include <iostream>
#include "WirtualnySwiat.h"
#include "wilk.h"
#include "owca.h"
#include "trawa.h"
#include "lis.h"
#include "guarana.h"
#include "wilcze_jagody.h"
#include "zolw.h"
#include "leniwiec.h"
// Dodac do sciezki canva.cpp, WirtualnySwiat.cpp organizm.cpp
/*
SYMULATOR ŚWIATA WIRTUALNEGO
Miłosz Skobejko 187224
*/
int main (void)
{
{
Swiat * Ziemia = new Swiat(40,20,' ', '#');
char option = 'o';
while (option != 'x')
{
Ziemia -> wykonajTure();
option = getchar();
switch (option)
{
case 's':
/* ZAPISZ SWIAT DO PLIKU */
getchar();
try
{
Ziemia -> save();
std::cout << "Pomyslnie zapisano plik!" << std::endl;
Canvas::clear_buffer();
}
catch (const char *error)
{
std::cout << error << std::endl;
Canvas::clear_buffer();
}
break;
case 'l':
/* WCZYTAJ SWIAT Z PLIKU */
getchar();
try
{
Ziemia -> load();
std::cout << "Pomyslnie wczytano plik!" << std::endl;
Canvas::clear_buffer();
}
catch (const char *error)
{
std::cout << error << std::endl;
Canvas::clear_buffer();
}
break;
case 'x':
getchar();
std::cout << "Konczenie programu\n";
Canvas::clear_buffer();
break;
case '\n':
break;
default:
getchar();
}
}
delete Ziemia;
}
return 0;
}