小编Dam*_*ing的帖子

生命游戏 - Java,不起作用(不显示单元格)

目前我正在做一个关于创建"生命游戏"版本的任务.但是我的细胞不会出现.

这是我的Cell Class:

class Cell{
boolean alive; //true if cell is alive, false if cell is dead
int numNeighbors; //number of alive neightboring cells 

//change alive/dead state of the cell
void setAlive(boolean state){
    alive = state;
}

//return alive/dead state of the cell
boolean isAlive(){
    return alive;
}

//set numNeightbors of the cell to n
void setNumNeighbors(int n){
    numNeighbors = n;
}

//take the cell to the next generation
void update(){
    if(numNeighbors <2 || numNeighbors >3){
        alive = false;
    } …
Run Code Online (Sandbox Code Playgroud)

java swing

1
推荐指数
1
解决办法
134
查看次数

标签 统计

java ×1

swing ×1