basically what i am trying to do is to set each spot in my maze to a specific enumerated type based on a random number i.e i randomly place 10 walls on the maze and those 10 spaces would be wall enum types. This is the code i have so far, and i cant figure out how to get it to work.
public enum CellType {
CHEESE, OPEN, WALL, VISITED, MOUSE
}
public class Cell {
private Color color;
private ImageIcon image;
CellType type;
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public ImageIcon getImage() {
return image;
}
public void setImage(ImageIcon image) {
this.image = image;
}
public CellType getType() {
return type;
}
public void setType(CellType type) {
this.type = type;
}
}
maze = new int[row][col];
Random randomMaze = new Random();
for (int ran = 0; ran <= numWalls ; ran++)
maze[randomMaze.nextInt(maze.length)][randomMaze.nextInt(maze.length)].setType(WALL);
if (maze[randomMaze.nextInt(maze.length)][randomMaze.nextInt(maze.length)].getType().equals(WALL)) ran--;before the set.