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:
philippe lhardy
2016-06-23 22:07:50 +02:00
parent 841793cc86
commit afeafc1ec8
7 changed files with 87 additions and 60 deletions

View File

@@ -1,10 +1,18 @@
package org.artisanlogiciel.games;
import java.util.Scanner;
import java.util.LinkedList;
import java.util.Scanner;
public class Main
{
public MazeParamEditor editor()
{
MazeParamEditor editor = new MazeParamEditor(null);
System.out.println("enter width height and maxdepth");
Scanner console = new Scanner(System.in);
editor.read(console);
return editor;
}
public WallsProvider generate(int width, int height, int maxdepth, MazeResolutionListener listener)
{
@@ -41,13 +49,9 @@ public class Main
public static void main(String pArgs[])
{
System.out.println("enter width height and maxdepth");
Scanner console = new Scanner(System.in);
int width = console.nextInt();
int height = console.nextInt();
int maxdepth = console.nextInt();
Main m = new Main();
LabyMap map = m.generate2(width, height, maxdepth);
MazeParamEditor editor = m.editor();
LabyMap map = m.generate2(editor.width, editor.height, editor.maxdepth);
System.out.println(map.toShortString());
System.out.println(map.toString());
System.out.println(Brick.getDirLine());