diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2019-02-13 23:32:08 +0100 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2019-02-13 23:32:08 +0100 |
commit | bc598375da7b9a20a35e958afb61dcd690d3d7b7 (patch) | |
tree | 764398251e30ae68920e53aa256d7e30b4cf55a0 /main.cpp | |
parent | 6175cb1c53772cc92d91a39a254c38bdf8f64905 (diff) |
Play interactively against AI
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -3,6 +3,7 @@ #include <sys/time.h> #include "board.h" #include "mc.h" +#include "ui.h" #include "util.h" using namespace std; @@ -15,15 +16,23 @@ int main() { Board bd = Board::makeEmpty(); cerr << "Initial stone at " << Idx(BSZ * BMID + BMID) << endl; - bd.put(BSZ * BMID + BMID, 1); + bd.put(BSZ * BMID + BMID, bd.bag.drawRandom()); cout << bd << endl; - uint8_t onturn = 2; + uint8_t onturn = 1; while (bd.bag.totalLeft() > 0) { cout << "--- NEXT TURN: " << Stone(onturn) << " ---" << endl; - int idx = MC::calcMove(bd, onturn); + int idx; + + if (onturn == 1) { + cout << "YOUR TURN." << endl; + idx = UI::getMove(bd); + } else { + idx = MC::calcMove(bd, onturn); + } + uint8_t clr = bd.bag.drawRandom(); uint8_t win = bd.putCW(idx, clr); |