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:
59
java/org/artisanlogiciel/games/MazeParamEditor.java
Normal file
59
java/org/artisanlogiciel/games/MazeParamEditor.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package org.artisanlogiciel.games;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
MazeParamEditor to edit Maze Parameters ( current impl in console / Scanner )
|
||||
**/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user