-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
69 lines (53 loc) · 1.26 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
using namespace std;
#include <iostream>
#include <filesystem>
#include <fstream>
#include <string>
#include <ncurses.h>
#define ESC 27
//░▓■O╬
//DWPSG
//https://kirilllive.github.io/ASCII_Art_Paint/ascii_paint.html
//https://codeincomplete.com/games/boulderdash/play/
#include "board.h"
int main(){
//Board testLvl("levels/testLevel.txt");
cout << "Enter level location (CTRL+D (for default)): ";
string location = "levels/lvl1.txt";
cin >> location;
cout << endl << location;
Board testLvl(location);
initscr();
noecho();
curs_set(0);
timeout(50); //run game at 20 fps
int i = 0;
int j = 0;
while(1){
if(i == 4){
i = 0;
testLvl.checkAround();
}
if(!testLvl.alive){
j++;
if(j == 32) break;
}
if(testLvl.complete && testLvl.alive){
j++;
if(j == 32) break;
}
if (testLvl.playerMove() == ESC) break;
testLvl.printBoard();
i++;
}
curs_set(1);
echo();
endwin();
if(!testLvl.alive){
cout << endl << "Game over!" << endl;
}
if(testLvl.alive && testLvl.complete){
cout << endl << "Level complete!" << endl;
}
return 0;
}