follow right wall (unlike the other sheeple :))

This commit is contained in:
Thomas Lindner 2022-05-20 19:00:35 +02:00
parent 173182f8e7
commit 374402299d

View file

@ -172,11 +172,11 @@ asio::awaitable<bool> Bot::Move(Direction direction) {
} }
asio::awaitable<void> Bot::ChooseMove() { asio::awaitable<void> Bot::ChooseMove() {
// follow left wall // follow right wall
while (!co_await Move(heading)) { while (!co_await Move(heading)) {
heading = Direction{(static_cast<int>(heading) + 1) % 4}; heading = Direction{(static_cast<int>(heading) + 3) % 4};
} }
heading = Direction{(static_cast<int>(heading) + 3) % 4}; heading = Direction{(static_cast<int>(heading) + 1) % 4};
co_return; co_return;
} }