diff options
Diffstat (limited to 'src/2016/day10/aoc.h')
-rw-r--r-- | src/2016/day10/aoc.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/2016/day10/aoc.h b/src/2016/day10/aoc.h index a7d8d72..ea73529 100644 --- a/src/2016/day10/aoc.h +++ b/src/2016/day10/aoc.h @@ -12,9 +12,11 @@ struct bot { bool is_output = false; bool can_give() const noexcept { return vs[0] != 0 && vs[1] != 0; } - void set(int v) { + bool set(int v) { + bool done{false}; for (int i = 0; i < 2; i++) { if (vs[i] == 0) { + done = true; vs[i] = v; break; } @@ -22,6 +24,7 @@ struct bot { if (vs[0] > vs[1]) { std::swap(vs[0], vs[1]); } + return done; } void get(int v) { // bot as output |