#include #include #include #include using namespace std; const int SUM = 2 + 3 + 3 + 4 + 5; int hits = 0, myhits = 0; bool is[12][12]; bool cell[12][12], iscell[12][12]; char MSG[24]; int main() { srand(time(0)); int xcoord = 1; for (int size = 1; size <= 5; ++size) { cout << xcoord << ' ' << 3 << ' ' << 0 << '\n'; is[xcoord][1] = true; cout.flush(); xcoord += 2; } while (true) { while (true) { int xn = rand() % 10 + 1, yn = rand() % 10 + 1; if (!cell[xn][yn]) { cout << xn << ' ' << yn << '\n'; cout.flush(); cell[xn][yn] = true; cin >> MSG; if (MSG[0] == 'H') { iscell[xn][yn] = true; ++hits; } else if (MSG[0] == 'S') { cin >> MSG; break; } break; } } if (hits == SUM) break; int xh, yh; cin >> xh >> yh; if (is[xh][yh]) ++myhits; if (myhits == SUM) break; } }