diff options
author | tomsmeding <tom.smeding@gmail.com> | 2019-02-15 23:34:26 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2019-02-15 23:34:43 +0100 |
commit | da16f39035e21603551360aaca10899e32f0f2e4 (patch) | |
tree | f0fc03f584127ec94fdce1985317441e48b88e4b | |
parent | 5c3415af4a2881b3ca7cdb4ef5bbf240b4a8b93b (diff) |
Correctly print "TIE"
-rw-r--r-- | TODO.txt | 1 | ||||
-rw-r--r-- | main.cpp | 15 |
2 files changed, 9 insertions, 7 deletions
diff --git a/TODO.txt b/TODO.txt deleted file mode 100644 index 2896735..0000000 --- a/TODO.txt +++ /dev/null @@ -1 +0,0 @@ -competition now has feature write_lines, so a referee for this game can be implemented. @@ -30,6 +30,8 @@ int main() { cout << bd << endl; + uint8_t win = 0; + uint8_t onturn = 1; while (bd.bag.totalLeft() > 0) { cout << "--- NEXT TURN: " << Stone(onturn) << " ---" << endl; @@ -44,17 +46,18 @@ int main() { } uint8_t clr = bd.bag.drawRandom(); - uint8_t win = bd.putCW(idx, clr); + win = bd.putCW(idx, clr); cout << bd << endl; - if (win != 0) { - cout << "Winner: " << Stone(clr) << endl; - break; - } + if (win != 0) break; onturn = NEXTTURN(onturn); } - cout << "TIE" << endl; + if (win == 0) { + cout << "TIE" << endl; + } else { + cout << "Winner: " << Stone(win) << endl; + } } |