import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int cases = Integer.parseInt(br.readLine());
for (int i = 0; i < cases; i++) {
sb.append("Bitmap #").append(i+1).append("\n");
StringTokenizer st = new StringTokenizer(br.readLine());
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
char[][] arr = new char[32][32];
for (int j = 0; j < 32; j++) {
for (int z = 0; z < 32; z++) {
arr[j][z] = '.';
}
}
StringBuilder str = new StringBuilder(br.readLine());
for (int j = 0; j < str.length(); j++) {
if (str.charAt(j) == 'E') {
x++;
arr[x-1][y-1] = 'X';
} else if (str.charAt(j) == 'W') {
x--;
arr[x][y] = 'X';
} else if (str.charAt(j) == 'N') {
y++;
arr[x][y-1] = 'X';
} else if (str.charAt(j) == 'S') {
y--;
arr[x-1][y] = 'X';
}
}
for (int j = 31; j >-1; j--) {
for (int z = 0; z < 32; z++) {
sb.append(arr[z][j]);
}
sb.append("\n");
}
sb.append("\n");
}
System.out.print(sb);
}
}
No comments:
Post a Comment