- display cell as hexagon is Display.mHexagon if set ( not default ) will need a checkbox to set this - various new models preparation...
71 lines
1.2 KiB
Java
71 lines
1.2 KiB
Java
package org.artisanlogiciel.games.maze;
|
|
|
|
/*
|
|
|
|
2x2 Tile to represent a labyrinth position with some walls
|
|
|
|
this is 2x2 downright most part of 3x3 centered tile.
|
|
|
|
center right
|
|
down downright
|
|
|
|
ab
|
|
cd
|
|
|
|
a is 'H' or '.' or ' '
|
|
bcd is within 'H' or ' '
|
|
|
|
*/
|
|
public class Brick
|
|
{
|
|
|
|
public final static short LEFT = 1;
|
|
public final static short DOWN = 2;
|
|
public final static short RIGHT = 4;
|
|
public final static short UP = 8;
|
|
public final static short ENTRY = 16;
|
|
public final static short GOAL = 32;
|
|
|
|
// TODO get rid of those chars
|
|
char a;
|
|
char b;
|
|
char c;
|
|
char d;
|
|
|
|
short walls; // according to LabyModel.getWalls();
|
|
|
|
protected Brick()
|
|
{
|
|
//
|
|
}
|
|
|
|
public Brick(String up, String low, short walls)
|
|
{
|
|
a = up.charAt(0);
|
|
b = up.charAt(1);
|
|
c = low.charAt(0);
|
|
d = low.charAt(1);
|
|
this.walls = walls;
|
|
}
|
|
|
|
public static boolean isFlagSet(short flags, short wall)
|
|
{
|
|
return ( flags & wall ) == flags;
|
|
}
|
|
|
|
public String getUpString()
|
|
{
|
|
return "" + a + b;
|
|
}
|
|
|
|
public String getLowString()
|
|
{
|
|
return "" + c + d;
|
|
}
|
|
|
|
public short getWalls()
|
|
{
|
|
return walls;
|
|
}
|
|
}
|