diff options
Diffstat (limited to 'referee.h')
-rw-r--r-- | referee.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -4,6 +4,7 @@ #include <string> #include <string_view> #include <optional> +#include <utility> #include "process.h" using namespace std; @@ -14,6 +15,10 @@ class Referee { bool isEnd = false; vector<int> scores; + bool featureWriteLines = false; + vector<pair<int, string>> writeLinesList; + + optional<string> readLine(); void readScores(); public: @@ -22,6 +27,7 @@ public: // player: 0 = first player, 1 = second player bool moveValid(int player, const string_view line); + vector<pair<int, string>> playerWriteLines(); bool gameEnded(); optional<vector<int>> getScores(); @@ -45,4 +51,14 @@ then write a line to stdout that is equal to either 'valid', 'invalid', or 'valid end', the referee should write a line containing as many integers (separated by spaces) as there are players, giving their scores at the end of the game. + +FEATURES +At any time the referee may write 'feature <name>' to stdout, which enables the +protocol feature with the given name. The following features are supported: +- 'write_lines': After a move validity judgement, the referee should write lines + of the form '<player> <line>' to stdout, where <player> is the index of the + player on whose stdin to write <line>. The referee should signal the end of + this list by writing a line 'write_end' to stdout. + This allows the referee to write additional data to players' inputs after they + have written their moves. */ |