diff --git a/README b/README index 5b4caba..b6cbf16 100644 --- a/README +++ b/README @@ -29,4 +29,4 @@ The following outputs are supported: move_dir and are integer offsets relative - to the current position + to the current position; may be just {-1,0,1} diff --git a/connection.cc b/connection.cc index 9425e6b..9832ec3 100644 --- a/connection.cc +++ b/connection.cc @@ -43,6 +43,8 @@ connection::actions(class agent *agent) if (!cmd.compare("move_dir")) { int x = 0, y = 0; sscanf(line.c_str(), "%d %d", &x, &y); + if (x < -1) x = -1; if (x > 1) x = 1; + if (y < -1) y = -1; if (y > 1) y = 1; agent->move_dir(x, y); } else { std::cout << "unknown line " << cmd << " " << line << " ...\n";