Skip to content

Instantly share code, notes, and snippets.

@yurahuna
Created October 2, 2016 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurahuna/59307af9fb57dbe41ebfbb4537e4d4ab to your computer and use it in GitHub Desktop.
Save yurahuna/59307af9fb57dbe41ebfbb4537e4d4ab to your computer and use it in GitHub Desktop.
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int N;
cin >> N;
vector<string> s(2);
bool toRight = true;
while (true) {
rep(state, 4) {
if (toRight) {
cout << s[0] + (state % 2 ? '.' : '#') << endl;
cout << s[1] + (state / 2 ? '.' : '#') << endl;
} else {
cout << (state % 2 ? '.' : '#') + s[0] << endl;
cout << (state / 2 ? '.' : '#') + s[1] << endl;
}
string ret;
cin >> ret;
if (ret[0] == 'e') {
return 0;
} else if (ret[0] == 'T') {
// next_step
if (toRight) {
s[0] = s[0] + (state % 2 ? '.' : '#');
s[1] = s[1] + (state / 2 ? '.' : '#');
} else {
s[0] = (state % 2 ? '.' : '#') + s[0];
s[1] = (state / 2 ? '.' : '#') + s[1];
}
break;
} else {
// go_on_this_step
if (state == 3) {
// change_direction
assert(toRight);
toRight = false;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment