-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (27 loc) · 717 Bytes
/
main.cpp
File metadata and controls
33 lines (27 loc) · 717 Bytes
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
#include "board.h"
#include "game.h"
#include "player.h"
#include <cstring>
#include <iostream>
using namespace std;
int char_to_int(char* s){
if (strcmp(s, "0") == 0)return 0;
if (strcmp(s, "1") == 0)return 1;
if (strcmp(s, "2") == 0)return 2;
if (strcmp(s, "3") == 0)return 3;
return -1;
}
int main(int argc , char *argv[]) {
int p1=0,p2=3;
if(argc>2){
argv++;
int x1=char_to_int(*argv);
argv++;
int x2=char_to_int(*argv);
if(x1>=0 && x2>=0)p1=x1,p2=x2;
}
gobang::Board board;
gobang::Player player1(true,p1, "Clever Bob"), player2(false,p2, "Smart Amy");
gobang::Game game(&player1, &player2, &board,0);
game.Start();
}