-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.java
More file actions
66 lines (59 loc) · 1.23 KB
/
Copy pathClient.java
File metadata and controls
66 lines (59 loc) · 1.23 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
/**
* Write a description of class Client here.
*
* @melmccord
* @rowanholop
* @version 1.1
*
* This is a facade class that allows our client to more easily run our program.
*
*/
public class Client
{
private RobotMaze maze;
/**
* empty constructor
*/
public Client(){}
/**
* Make the maze.
*/
public void makeMaze(int n)
{
maze = new RobotMaze(n);
}
/**
* Draw the maze.
*/
public void drawMaze()
{
StdDraw.enableDoubleBuffering();
maze.draw();
}
/**
* Solve the maze.
*/
public void solveMaze()
{
maze.solve();
}
/**
* Method to read a file in on the client end and create the maze based on the first int in the file.
*/
public static void main(String[] args) {
try {
Client client = new Client();
Scanner sc = new Scanner(new File(args[0]));
int n = sc.nextInt();
client.makeMaze(n);
client.drawMaze();
client.solveMaze();
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}