prepare for hexagon display & other models

- display cell as hexagon is Display.mHexagon if set ( not default )
will need a checkbox to set this
- various new models preparation...
This commit is contained in:
philippe lhardy
2020-12-27 15:40:22 +01:00
parent e146199ba0
commit afbe26065b
15 changed files with 403 additions and 26 deletions

View File

@@ -170,8 +170,14 @@ lues, they are used as it is for
}
}
public void out4XY(int x, int y) {
int direction = t[x][y];
public void out4XY(int x, int y)
{
out4XY(x,y,t[x][y],(x < width -1) ?t[x+1][y] : 0);
}
public void out4XY(int x, int y, short txy, short txpy) {
int direction = txy;
if ((direction & OPEN) == OPEN) {
System.out.print("?");
} else if ((direction & CLOSED) == CLOSED) {
@@ -251,7 +257,7 @@ lues, they are used as it is for
System.out.print("..");
}
if (((t[x][y] & RIGHT) == RIGHT) || ((x + 1 < width) && ((t[x + 1][y] & LEFT) == LEFT))) {
if (((txy & RIGHT) == RIGHT) || ((x + 1 < width) && (txpy & LEFT) == LEFT)) {
System.out.print("-");
} else {
System.out.print("H");
@@ -260,8 +266,12 @@ lues, they are used as it is for
}
public String outHorizWall2XY(int x, int y) {
return outHorizWall2XY(x,y,t[x][y],(y<height-1) ? t[x][y+1] : 0);
}
public String outHorizWall2XY(int x, int y,short txy, short txyp) {
String freeway = " ";
if ((t[x][y] & SOLVED) == SOLVED) {
if ((txy & SOLVED) == SOLVED) {
freeway = "*";
}
if ((x < 0) || (x > width)) {
@@ -271,23 +281,28 @@ lues, they are used as it is for
return "HH";
}
if (((t[x][y] & DOWN) == DOWN) || ((y + 1 < height) && ((t[x][y + 1] & UP) == UP))) {
if (((txy & DOWN) == DOWN) || ((y + 1 < height) && ((txyp & UP) == UP))) {
return freeway + "H";
} else {
return "HH";
}
}
public String out2XY(int x, int y) {
public String out2XY(int x, int y)
{
return out2XY(x,y,t[x][y],(x < width -1) ?t[x+1][y] : 0, width, height);
}
public static String out2XY(int x, int y, short txy, short txpy, int width, int height) {
// can check for entry exits.
if ((y < 0) || (y >= height) || (x < 0) || (x > width)) {
return " H";
}
String low = "";
int direction = t[x][y];
int direction = txy;
String freeway = " ";
if ((t[x][y] & SOLVED) == SOLVED) {
if ((txy & SOLVED) == SOLVED) {
freeway = "*";
}
// don't display information about short.
@@ -337,14 +352,16 @@ lues, they are used as it is for
low = ".";
}
/* don't display entry or exits
for (Position exit : entryExits) {
if ((exit.getX() == x + 1) && (exit.getY() == y)) {
low = low + ">";
return low;
}
}
*/
if (((t[x][y] & RIGHT) == RIGHT) || ((x + 1 < width) && ((t[x + 1][y] & LEFT) == LEFT))) {
if (((txy & RIGHT) == RIGHT) || ((x + 1 < width) && ((txpy & LEFT) == LEFT))) {
low = low + freeway;
} else {
low = low + "H";