Skip to content

Commit

Permalink
Add: 맵과 플레이어 초기화
Browse files Browse the repository at this point in the history
  • Loading branch information
kyupid committed Dec 13, 2020
1 parent 8fea5b6 commit 4af7911
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/Game.java
@@ -0,0 +1,31 @@
class Game {
private final String[][] map = new String[11][11];

Game() {
initMap();
initPlayer();
printAll();
}


private void initMap() {
for (int i = 0; i < map.length; i++) {
for (int j = 0; j < map.length; j++) {
map[i][j] = "* ";
}
}
}

private void initPlayer() {
map[5][5] = "P ";
}

private void printAll() {
for (String[] e : map) {
for (String ee : e) {
System.out.print(ee);
}
System.out.println();
}
}
}
5 changes: 5 additions & 0 deletions src/Main.java
@@ -0,0 +1,5 @@
public class Main {
public static void main(String[] args) {
new Game();
}
}

0 comments on commit 4af7911

Please sign in to comment.