-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (58 loc) · 1.44 KB
/
main.cpp
File metadata and controls
62 lines (58 loc) · 1.44 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
#include <iostream>
#include <ncurses.h>
#include "main.h"
#include "gameOfLife.h"
#include "wolfram.h"
int main() {
//Initialize ncurses
initscr();
raw();
noecho();
keypad(stdscr, TRUE);
menu();
return 0;
}
void menu() {
bool run = true;
while(run){
mvprintw(3, 27, "---------------------");
mvprintw(4, 27, "CELLULAR AUTOMATA CLI");
mvprintw(5, 27, "---------------------");
mvprintw(7, 11, "C++ Implementations of Different Cellular Automata");
mvprintw(8, 11, "Type the number of the automaton you'd like to run");
mvprintw(10, 24, "0: Wolfram's Elementary CA");
mvprintw(11, 24, "1: Conway's Game of Life");
mvprintw(13, 22, "Press ESC to quit the program");
refresh();
switch (getch()) {
case 48:
wolfram();
run = false;
break;
case 49:
endwin();
gameOfLife();
run = false;
break;
case 27:
endwin();
exit(0);
break;
default:
mvprintw(15, 21, "!!!YOU DIDN'T TYPE AN OPTION!!!");
refresh();
break;
}
}
}
void gameOfLife() {
if (load_file()) {
start_simulation();
}
else {
cout << "Error Loading File" << endl;
}
}
void wolfram() {
automaton();
}