-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
26 lines (19 loc) · 740 Bytes
/
Main.java
File metadata and controls
26 lines (19 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.dj;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
String myLocations = """
lake,at the edge of the lake Tim,E:ocean,W:forest,S:Well house,N:cave
ocean,on Tim's beach before an angry sea,W:lake
cave,at the mouth of Tim's bat cave,E:ocean,W:forest,S:lake
""";
AdventureGame game = new AdventureGame(myLocations);
game.play("lake");
Scanner scanner = new Scanner(System.in);
while (true){
String direction = scanner.nextLine().trim().toUpperCase().substring(0, 1);
if (direction.equals("Q")) break;
game.move(direction);
}
}
}