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 /main.cpp | |
parent | 5c3415af4a2881b3ca7cdb4ef5bbf240b4a8b93b (diff) |
Correctly print "TIE"
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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; + } } |