-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.c
107 lines (104 loc) · 2.85 KB
/
main.c
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
96
97
98
99
100
101
102
103
104
105
106
107
#include <stdio.h>
#include "ADT/Utility/inisiasi.c"
#include "ADT/Simulator/simulator.c"
#include "ADT/Time/time.c"
#include "ADT/Map/map.c"
#include "ADT/Mesin_Kata/wordmachine.c"
#include "ADT/Mesin_Karakter/charmachine.c"
#include "ADT/Stack/stack.c"
#include "ADT/Utility/notif.c"
#include "ADT/Tree/tree.c"
// #include "ADT/Makanan/makanan.c"
// #include "ADT/PrioQueue/prioqueuetime.c"
// #include "ADT/PrioQueue/prioqueue.c"
int main() {
startMenu();
STARTWORD1();
int a;
WordToInt(&a);
if (a == 1) {
Stack U;
Stack R;
CreateEmptyStack(&U);
CreateEmptyStack(&R);
Simulator S;
listMakanan l, BUY, FRY, BOIL, MIX, CHOP;
Queue q;
CreateEmpty(&q, 50);
STARTWORDFILE("Config/resep.txt");
int x;
int n = 0;
WordToInt(&x);
ADVNEWLINE1();
ListOfTree tree;
createListTree(&tree, x);
createMakanan(&l, &BUY, &FRY, &BOIL, &MIX, &CHOP);
BacaSimulator(&S);
// Enqueue(&S, MAKANAN(l, 1));
// Enqueue(&S, MAKANAN(l, 0));
// printf("Num elmt = %d\n", NBElmt(Inventory(S)));
// PrintPrioQueueTime(S);
printf("\n");
DisplaySimulator(S);
TIME T;
CreateTime(&T,0,0,0);
TulisTIME2(T);
printf("Notifikasi: -\n");
STARTWORDFILE("Config/map.txt");
MAP m;
int row,col;
WordToInt(&row);
ADVWORD1();
WordToInt(&col);
ADVNEWLINE1();
readMap(&m,row,col);
displayMap(m);
printf("\n");
boolean y = true;
while(y) {
QueueN n;
int x = 0;
printf("Enter Command: ");
STARTWORD2();
int p;
WordToInt(&p);
printf("\n");
if (p==40231){
undo(&U, &R, &S, &T, &m, &q);
DisplaySimulator(S);
TulisTIME2(T);
printf("Notifikasi: ");
displayNotif(n);
displayMap(m);
printf("\n");
}
else if (p==36331){
redo(&U, &R, &S, &T, &m, &q);
DisplaySimulator(S);
TulisTIME2(T);
printf("Notifikasi: ");
displayNotif(n);
displayMap(m);
printf("\n");
}
else{
moveSim(&m, p, &S, &T, &n, &U, &R, &q, tree, l, BUY, FRY, BOIL, MIX, CHOP);
DisplaySimulator(S);
TulisTIME2(T);
printf("Notifikasi: ");
displayNotif(n);
displayMap(m);
printf("\n");
}
y++;
}
}
else if (a == 2) {
printf("Terima kasih telah bermain!\n");
exit(0);
}
else {
printf("Input tidak valid\n");
}
return 0;
}