forked from mayerui/sudoku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
47 lines (41 loc) · 1.07 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
#include <iostream>
#include <string>
#include <cstring>
#include "scene.h"
#include "input.h"
#include "test.h"
#define _TEST_ 0
static void printHelp() {
std::cout << std::endl;
std::cout << "sudoku - a little game in command line" << std::endl
<< std::endl;
std::cout << "Usage:" << std::endl;
std::cout << "\t sudoku [-l <progressFile>]" << std::endl << std::endl;
std::cout << "Options:" << std::endl;
std::cout << "\t -l <path> \t specify path of progress file to load, optional." << std::endl
<< std::endl;
}
int main(int argc, char **argv)
{
#if _TEST_
test_case1();
getchar();
#else
CScene scene;
if (argc == 1) {
int eraseGridNumber = inputDifficulty();
scene.generate();
scene.eraseRandomGrids(eraseGridNumber);
}
else if (argc == 3 && !strcmp(argv[1], "-l")) {
// load saved game progress
scene.load(argv[2]);
}
else {
printHelp();
return 0;
}
scene.play();
#endif
return 0;
}