-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.cpp
38 lines (35 loc) · 1.3 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
#include <cstdio>
#include "common_define.h"
#include "compiler.h"
#include "scheduler.h"
#include "simple_match.h"
#include "sandbox.h"
int main() {
char fname[128];
Compiler::InitInstance(SRC_PREFIX);
Scheduler *sched = Scheduler::GetInstance();
sched->InitScheduler(MATCH_RENJU);
while (1) {
int u1, u2, sub1, sub2;
fprintf(stderr, "try to arrange new match\n");
if (sched->ArrangeMatch(MATCH_RENJU, u1, u2, sub1, sub2)) {
fprintf(stderr, "Scheduler arranged an new match: (uid:%d sid:%d) v.s. (uid:%d sid:%d)", u1, sub1, u2, sub2);
sched->RegNewMatch(MATCH_RENJU, u1, u2, sub1, sub2);
SimpleMatch *match = new SimpleMatch;
match->InitMatch(MATCH_RENJU, 0, "Renju Test Match");
snprintf(fname, 128, "/home/roba/wai/submit/%d.exe", sub1);
Sandbox p1(fname);
snprintf(fname, 128, "/home/roba/wai/submit/%d.exe", sub2);
Sandbox p2(fname);
snprintf(fname, 128, "/home/roba/wai/trunk/test_judge/renju_judge.exe");
Sandbox judge(fname);
match->SetJudge(&judge);
match->AddPlayer(&p1, sub1);
match->AddPlayer(&p2, sub2);
match->Start();
} else {
sleep(1);
}
}
return 0;
}