package pl.am.podstawy.lekcja9;
import java.util.Scanner;
public class Malpa {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
char[][] plansza = {
{'.','.','.','.','.','.','.','.','.','.'},
{'.','.','.','.','.','.','.','.','.','.'},
{'.','.','.','.','.','.','.','.','.','.'},
{'.','.','.','.','.','.','.','.','.','.'},
{'.','.','.','.','.','.','.','.','.','.'}
};
int malpaK = 8;
int malpaW = 1;
plansza[malpaW][malpaK] = '@';
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
for (int i=0; i<5; i++) {
for (int j=0; j<10; j++) {
System.out.print(plansza[i][j]);
}
System.out.println();
}
while (true) {
String kierunek = scanner.nextLine();
plansza[malpaW][malpaK] = '.';
switch (kierunek) {
case "W":
case "w":
if (malpaW>0) malpaW--;
break;
case "S":
case "s":
if (malpaW<4) malpaW++;
break;
case "A":
case "a":
if (malpaK>0) malpaK--;
break;
case "D":
case "d":
if (malpaK<9) malpaK++;
break;
}
plansza[malpaW][malpaK] = '@';
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
for (int i=0; i<5; i++) {
for (int j=0; j<10; j++) {
System.out.print(plansza[i][j]);
}
System.out.println();
}
}
}
}