-
Notifications
You must be signed in to change notification settings - Fork 0
/
shgame.cpp
47 lines (34 loc) · 1018 Bytes
/
shgame.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
// Show a given game file.
#include <iostream>
#include <fstream>
#include <string>
#include "session.hpp"
#include "Pente.hpp"
using namespace std;
int main(int argc, char** argv)
{
if (argc != 2) {
cout << "Please specify a gameid." << endl;
}
string gameid = argv[1];
ifstream game_file(gameid.c_str());
if (!game_file) {
cout << "Unable to open file at "
<< gameid << "." << endl;
exit(1);
}
Pente p;
p.deserialize(game_file);
cout << "Reading " << gameid << endl
<< p.toString() << endl
<< "Sessions:" << endl
<< " players[0] => " << p.players[0] << endl
<< " players[1] => " << p.players[1] << endl
<< "Captures:" << endl
<< " White: " << p.whtCaps << endl
<< " Black: " << p.blkCaps << endl
<< "GameOutcome(WHITE) => " << p.gameOutcome(WHITE) << endl
<< "turn => " << p.turn << endl;
game_file.close();
return 0;
}