-
Notifications
You must be signed in to change notification settings - Fork 0
/
GLOBALS.h
60 lines (42 loc) · 1.27 KB
/
GLOBALS.h
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
// Todo's and Concerns
// Lv4 [maybe not]
// Graphic Interface
// ./chess --help flag?
// More tests
#ifndef GLOBALS_H
#define GLOBALS_H
#include <iostream>
#include <memory>
#include <vector>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <cstdlib>
#include <ctime>
#include <cctype>
using namespace std;
const set<char> WHITEPIECESET{'R', 'N', 'B', 'Q', 'K', 'B', 'K', 'R', 'P'};
const set<char> BLACKPIECESET{'r', 'n', 'b', 'q', 'k', 'b', 'k', 'r', 'p'};
const set<string> VALIDPLAYERS{"human", "computer1",
"computer2", "computer3", "compouter4"};
const set<string> VALIDSETUPOPS{"+", "-", "=", "done"};
// Coordinates defined in the first coordinate
// cellIdx = (row - 1) * 8 + (col - 1)
// row = CellIndex / 8 + 1
// col = CellIndex % 8 + 1
// Converts index to row number
int toRow(int Idx);
// Converts index to column number
int toCol(int Idx);
// Converts row and column number to cells index
int toIdx(int row, int col);
// Converts chess coordinate to cells index
bool coordToIdx(string coord, int &Idx);
// Checks validity of coordinate
bool validCoord(string coord);
// Gets words from command line
bool getWords(vector<string> &words);
// Produce a invalid input warnin [todo (Improve)]
void badInput();
#endif