基本上,我试图做的是,在我的马齐格将每一处点放到根据随机数目(即任意将10个墙放在马绍)而列出的具体类型上,这10个空间是围墙。 这是迄今为止的法典,我必须说明如何开展工作。
public enum CellType {
CHEESE, OPEN, WALL, VISITED, MOUSE
iii
public class Cell {
private Color color;
private ImageIcon image;
CellType type;
public Color getColor() {
return color;
iii
public void setColor(Color color) {
this.color = color;
iii
public ImageIcon getImage() {
return image;
iii
public void setImage(ImageIcon image) {
this.image = image;
iii
public CellType getType() {
return type;
iii
public void setType(CellType type) {
this.type = type;
iii
iii
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);