From 12cf78567dfde9ebd37548ba13311651d36a55c2 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sat, 16 Feb 2019 18:22:47 +0100 Subject: Fix referee --- .gitignore | 1 + referee/Makefile | 2 +- referee/referee.cpp | 28 +++++++++++++++++++--------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 3e5e27a..6ab5a49 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ aimc airand .objs/ +competition/ diff --git a/referee/Makefile b/referee/Makefile index 4b96779..ffa79c7 100644 --- a/referee/Makefile +++ b/referee/Makefile @@ -1,5 +1,5 @@ CXX := g++ -CXXFLAGS := -Wall -Wextra -std=c++11 -g -O2 +CXXFLAGS := -Wall -Wextra -std=c++11 -O2 TARGET := referee .PHONY: all clean diff --git a/referee/referee.cpp b/referee/referee.cpp index f3a2b5d..92af0ec 100644 --- a/referee/referee.cpp +++ b/referee/referee.cpp @@ -15,6 +15,10 @@ int main() { gettimeofday(&tv, nullptr); srandom(tv.tv_sec * 1000000U + tv.tv_usec); + cout << "feature write_lines" << endl; + cout << "feature no_last_move" << endl; + cout << "feature_end" << endl; + string line; getline(cin, line); int nplayers = stoi(line); @@ -25,10 +29,15 @@ int main() { getline(cin, players[i]); } - cout << "feature write_lines" << endl; - Board bd = Board::makeEmpty(); - bd.put(BSZ * BMID + BMID, bd.bag.drawRandom()); + uint8_t midstoneClr = bd.bag.drawRandom(); + bd.put(BSZ * BMID + BMID, midstoneClr); + + for (int i = 0; i < NC; i++) { + cout << i << " place 0 0 " << (unsigned)midstoneClr << endl; + } + cout << "0 Start" << endl; + cout << "write_end" << endl; uint8_t onturn = 1; @@ -40,7 +49,7 @@ int main() { assert(cin.get() == ' '); getline(cin, line); - if ((unsigned)pidx != onturn) { + if ((unsigned)pidx + 1 != onturn) { cout << "invalid\nwrite_end" << endl; continue; } @@ -65,18 +74,19 @@ int main() { uint8_t win = bd.putCW(idx, clr); if (win != 0 || (win == 0 && bd.bag.totalLeft() == 0)) { - cout << "valid end" << endl; + cout << "valid end\nwrite_end" << endl; for (int i = 1; i <= NC; i++) { if (i != 1) cout << ' '; - if ((unsigned)i == win) cout << 3; - else cout << 1; + if ((unsigned)i == win) cout << '3'; + else cout << '1'; } cout << endl; - cout << "write_end" << endl; break; } - for (int i = 1; i <= NC; i++) { + cout << "valid" << endl; + + for (int i = 0; i < NC; i++) { int x = idx % BSZ - BMID, y = idx / BSZ - BMID; cout << i << " place " << x << ' ' << y << ' ' << (unsigned)clr << endl; } -- cgit v1.2.3-54-g00ecf