path is on a lower ground if maze was resolved.

This commit is contained in:
philippe lhardy
2018-03-04 21:36:03 +01:00
parent 0e8ab1e5bb
commit 3cb922455a
2 changed files with 17 additions and 4 deletions

View File

@@ -1313,7 +1313,7 @@ public class Display extends JFrame
try try
{ {
FileOutputStream out = new FileOutputStream(outfile); FileOutputStream out = new FileOutputStream(outfile);
Wall3d.streamWallsOut(params.getName(), (WallsProvider) model, out); Wall3d.streamWallsOut(params.getName(), model, out);
out.flush(); out.flush();
out.close(); out.close();
System.out.println("... Done."); System.out.println("... Done.");

View File

@@ -3,6 +3,7 @@ package org.artisanlogiciel.games.stl;
import java.util.Scanner; import java.util.Scanner;
import org.artisanlogiciel.games.Brick; import org.artisanlogiciel.games.Brick;
import org.artisanlogiciel.games.LabyModel;
import org.artisanlogiciel.games.WallsProvider; import org.artisanlogiciel.games.WallsProvider;
import java.io.OutputStream; import java.io.OutputStream;
@@ -28,7 +29,8 @@ public class Wall3d
public final static Wall3d West = new Wall3d(1, 10, 10, 0, 0, 0); public final static Wall3d West = new Wall3d(1, 10, 10, 0, 0, 0);
public final static Wall3d North = new Wall3d(10, 1, 10, 0, 10, 0); public final static Wall3d North = new Wall3d(10, 1, 10, 0, 10, 0);
public final static Wall3d East = new Wall3d(1, 10, 10, 10, 0, 0); public final static Wall3d East = new Wall3d(1, 10, 10, 10, 0, 0);
public final static Wall3d Ground = new Wall3d(10, 10, 2, 0, 0, 0); public final static Wall3d HighGround = new Wall3d(10, 10, 3, 0, 0, 0);
public final static Wall3d LowGround = new Wall3d(10, 10, 2, 0, 0, 0);
int triangle[][][] = null; int triangle[][][] = null;
@@ -157,7 +159,7 @@ public class Wall3d
System.out.println(West.toString()); System.out.println(West.toString());
} }
public static void streamWallsOut(String name, WallsProvider provider, OutputStream stream) throws IOException public static void streamWallsOut(String name, LabyModel provider, OutputStream stream) throws IOException
{ {
int width = provider.getWidth(); int width = provider.getWidth();
int height = provider.getHeight(); int height = provider.getHeight();
@@ -200,7 +202,18 @@ public class Wall3d
{ {
stream.write(new Wall3d(East, x * xl, y * yl, 0).toString().getBytes()); stream.write(new Wall3d(East, x * xl, y * yl, 0).toString().getBytes());
} }
stream.write(new Wall3d(Ground, x * xl, y * yl, 0).toString().getBytes()); short path = provider.getPath(x,y);
if ( ( path & LabyModel.SOLVED ) == LabyModel.SOLVED )
// if ( (walls & ( Brick.GOAL | Brick.ENTRY ) ) == 0 )
{
// if ( ( (x+y) % 2) == 0 )
stream.write(new Wall3d(LowGround, x * xl, y * yl, 0).toString().getBytes());
}
else
{
stream.write(new Wall3d(HighGround, x * xl, y * yl, 0).toString().getBytes());
}
} }
} }