summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2018-08-31 11:44:53 +0200
committertomsmeding <tom.smeding@gmail.com>2018-08-31 11:44:53 +0200
commitfca6e0750b83f337c61b994a191b8463585ea655 (patch)
tree7f4d69987e7407a22bc4dbe4be020ad6081d1570
parentaaa342471b02cc283c83e44829ecb1bae7a7beeb (diff)
Print game code name when player errors
-rw-r--r--main.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index aa92b64..c863cca 100644
--- a/main.cpp
+++ b/main.cpp
@@ -261,7 +261,8 @@ static void playMatch(Player &p1, Player &p2, int index, const Params &params) {
while (true) {
for (int i = 0; i < 2; i++) {
if (!procs[i].writeLine(lastMove)) {
- cout << "ERROR writing move to player " << i+1 << endl;
+ cout << "ERROR writing move to player " << i+1
+ << " (game " << gameCodeName(p1, p2, index) << ")" << endl;
throw StopCompetitionError();
}
@@ -269,7 +270,8 @@ static void playMatch(Player &p1, Player &p2, int index, const Params &params) {
int64_t start = gettimestamp();
optional<string> oline = procs[i].readLine();
if (!oline) {
- cout << "ERROR reading move from player " << i+1 << endl;
+ cout << "ERROR reading move from player " << i+1
+ << " (game " << gameCodeName(p1, p2, index) << ")" << endl;
throw StopCompetitionError();
}
@@ -287,7 +289,8 @@ static void playMatch(Player &p1, Player &p2, int index, const Params &params) {
}
if (!referee.moveValid(i, lastMove)) {
- cout << "ERROR in player " << i+1 << ": invalid move '" << lastMove << "'" << endl;
+ cout << "ERROR in player " << i+1 << ": invalid move '" << lastMove << "'"
+ << " (game " << gameCodeName(p1, p2, index) << ")" << endl;
throw StopCompetitionError();
}