honor run option with a default maze of 30x30
default_args in project Display.main() if argument is empty ignore it if file read fails, exit add a WHEREWHAT file extract MazeParamEditor to share it, prepare for having a GUI instead of console
This commit is contained in:
@@ -83,56 +83,6 @@ public class Display extends JFrame
|
||||
maze.setWallSize(size);
|
||||
}
|
||||
|
||||
private static class MazeParamEditor implements MazeParams
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
int maxdepth;
|
||||
File labdir;
|
||||
String name;
|
||||
|
||||
public MazeParamEditor(File saveDir)
|
||||
{
|
||||
name = null;
|
||||
labdir = saveDir;
|
||||
}
|
||||
|
||||
public void read(Scanner console)
|
||||
{
|
||||
width = console.nextInt();
|
||||
height = console.nextInt();
|
||||
maxdepth = console.nextInt();
|
||||
}
|
||||
|
||||
public int getWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
public int getHeight()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
public int getMaxDepth()
|
||||
{
|
||||
return maxdepth;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
name = "lab" + width + "x" + height;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public File getSaveDir()
|
||||
{
|
||||
return labdir;
|
||||
}
|
||||
}
|
||||
|
||||
private class MazeControler extends JPanel
|
||||
{
|
||||
@@ -520,7 +470,7 @@ public class Display extends JFrame
|
||||
int W = 600;
|
||||
int H = 400;
|
||||
|
||||
if (pArgs.length > 0)
|
||||
if ( (pArgs.length > 0) && (pArgs[0].length() > 0))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -529,6 +479,7 @@ public class Display extends JFrame
|
||||
catch (IOException io)
|
||||
{
|
||||
io.printStackTrace(System.err);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
int w = W / model.getWidth();
|
||||
|
||||
Reference in New Issue
Block a user