#include <bits/stdc++.h> using namespace std; vector<string> res = { "####", "#..#", "#.##", "####", }; int str = 1, stc = 1, stad = 0; string stds = "NWSE"; int dr[4] = { -1, 0, 1, 0 }, dc[4] = { 0, -1, 0, 1 }; string get(const string& in) { cout << in << endl; /*if (in == "LEFT") { stad = (stad + 1) % 4; cout << stds[stad] << endl; return string(1, stds[stad]); } if (in == "RIGHT") { stad = (stad + 3) % 4; cout << stds[stad] << endl; return string(1, stds[stad]); } if (in == "GO") { int nr = str + dr[stad], nc = stc + dc[stad]; if (res[nr][nc] == '.'){ str = nr; stc = nc; cout << str << ' ' << stc << "SUCC\n"; return "SUCC"; } else { cout << str << ' ' << stc << "FAIL\n"; return "FAIL"; } }*/ string s; cin >> s; return s; } vector<string> v(31, string(31, '#')); vector<vector<int>> vis(31, vector<int>(31)); void dfs(int i, int j) { if (vis[i][j]) return; vis[i][j] = 1; v[i][j] = '.'; for (int k = 0; k < 4; k++) { int r = i + dr[k], c = j + dc[k]; get("LEFT"); if (get("GO") == "SUCC") { for (;get("LEFT") != "N";); dfs(r, c); for (int t = 0; t < k + 2; t++) get("LEFT"); get("GO"); get("LEFT"); get("LEFT"); } } } int main() { for (;get("LEFT") != "N";); dfs(15, 15); for (int i = 1; i <= 30; i++) { for (int j = 1; j <= 30; j++) { cout << v[i][j]; } cout << endl; } return 0; }