{{{~cpp #include #include using namespace std; void main() { srand((unsigned)time(NULL)); int size; cout <<"맵의 크기를 결정해주세요>> "; cin>> size; int MAX=size-1; int spawnX = rand()%size; int spawnY = rand()%size; int **data = new int*[size]; for(int i=0;i=0 && spawnY>=0) data[spawnY][spawnX]++; else { spawnY++; spawnX++; } } else if (move==1) { spawnY--; if (spawnY>=0) data[spawnY][spawnX]++; else spawnY++; } else if (move==2) { spawnY--; spawnX++; if (spawnY>=0 && spawnX<=MAX) data[spawnY][spawnX]++; else{ spawnY++; spawnX--; } } else if (move==3){ spawnX++; if (spawnX<=MAX) data[spawnY][spawnX]++; else{ spawnX--; } } else if (move==4){ spawnX++; spawnY++; if (spawnX<=MAX && spawnY<=MAX) data[spawnY][spawnX]++; else{ spawnX--; spawnY--; } } else if (move==5) { spawnY++; if (spawnY<=MAX) data[spawnY][spawnX]++; else spawnY--; } else if (move==6) { spawnY++; spawnX--; if (spawnX>=0 && spawnY<=MAX) data[spawnY][spawnX]++; else{ spawnY--; spawnX++; } } else if (move==7) { spawnX--; if (spawnX>=0) data[spawnY][spawnX]++; else{ spawnX++; } } for(k=0;k