1 package de.lathanda.eos.game.tools;
3 import java.util.Random;
29 public static final int FREE = 0;
33 public static final int WALL = 1;
56 cell =
new int[width][height];
65 for (
int x = 0; x < width; x++) {
66 for (
int y = 0; y < height; y++) {
71 for (
int i = 0; i < width; i++) {
73 cell[i][height - 1] =
WALL;
75 for (
int i = 0; i < height; i++) {
77 cell[width - 1][i] =
WALL;
89 createLabyrinth(labNr, width * height * 10, 2, 1, 1, width - 2, height - 2);
117 public void createLabyrinth(
int labNr,
int wallNr,
int raster,
int xa,
int ya,
int wa,
int ha) {
132 public void createLabyrinth(Random dice,
int wallNr,
int raster,
int xa,
int ya,
int wa,
int ha) {
133 createLabyrinth(dice, wallNr, raster, xa, ya, wa, ha, wa / raster / 2);
148 public void createLabyrinth(Random dice,
int wallNr,
int raster,
int xa,
int ya,
int wa,
int ha,
int wallLength) {
149 final int MIN_LENGTH = 1;
150 int DIFF_LENGTH = wallLength;
153 for (
int m = 0; m < wallNr; m++) {
154 int x = raster * dice.nextInt((wa - 1) / raster) + xa + 1;
155 int y = raster * dice.nextInt((ha - 1) / raster) + ya + 1;
156 int direction = dice.nextInt(4);
157 int length = raster * (dice.nextInt(DIFF_LENGTH) + MIN_LENGTH) + 1;
158 for (
int i = 0; i < length; i++) {
179 if (xa <= xw && xw < xa + wa
180 && ya <= yw && yw < ya + ha
181 && cell[xw][yw] !=
WALL) {
228 public void setCell(
int x,
int y,
int value) {