生命游戏-JAVA语言代码-细胞自动机-毕业论文 联系客服

发布时间 : 星期五 文章生命游戏-JAVA语言代码-细胞自动机-毕业论文更新完毕开始阅读2c24c0c77f1922791688e85b

浙江理工大学本科毕业设计(论文)

public boolean getBirthFromOrganism(Organism organism) {

double percent=0;

if(Math.random()>LifeGameCommon.PAM){

percent = Math.random()*0.2-0.1;

private int x; private int y;

public Organism(int x,int y) { }

public Organism() { }

this.lifeTime = 80 ; this.bodySize = 10.0; this.speed = 5.0; this.strength = 5.0; this.age = 0;

this.adulthoodAge = 20; this.condition = 60; this.reproduceblank=15.0; this.reproduceState = 0; this.foodCondition=1; this(); this.x = x; this.y = y; // 繁殖周期

private double reproduceblank;

}else{

if(Math.random()>=0.5){

23

生命游戏的计算机模拟以及参数对运行结果的分析

} //TODO

double randomNum=Math.random()*6;

this.lifeTime = organism.getLifeTime(); this.bodySize = organism.getBodySize(); this.speed = organism.getSpeed(); this.strength = organism.getStrength();

this.adulthoodAge =organism.getAdulthoodAge(); this.reproduceblank=organism.getReproduceblank();

this.foodCondition=100;

if(randomNum<1){

this.lifeTime = organism.getLifeTime()*(percent+1.0);

percent = LifeGameCommon.PAMPercent;

}else{ }

percent = -LifeGameCommon.PAMPercent;;

}else if(randomNum<2){

this.bodySize = organism.getBodySize()*(percent+1.0); if(bodySize<0.01){ }

bodySize=0.01;

}else if(randomNum<3){

this.speed = organism.getSpeed()*(percent+1.0);

}else if(randomNum<4){

this.strength = organism.getStrength()*(percent+1.0);

24

浙江理工大学本科毕业设计(论文)

}

public double getWeakPercentByAge(){ }

25

}else if(randomNum<5){

this.adulthoodAge = organism.getAdulthoodAge()*(percent+1.0);

}else if(randomNum<6){ }

this.condition = 100; this.reproduceState = 0; this.age = 0;

this.x = organism.getX(); this.y = organism.getY(); return true;

this.reproduceblank = ((double)organism.getReproduceblank()*(1.0+percent));

if(reproduceblank

reproduceblank=lifeTime*0.2;

double dAge = this.age; double lifeTime = this.lifeTime;

if(dAge/lifeTime<0.2){

return 0.2+dAge/lifeTime/0.2*0.8;

}else if(dAge/lifeTime>0.8){

return 1-(lifeTime-dAge)/lifeTime/0.2*0.8;

}else{ }

return 1.0;

生命游戏的计算机模拟以及参数对运行结果的分析

// 获取生物竞争力,

public double getCompetitivenessByGround(GroundUnit groundUnit) {

double competitiveness = getWeakPercentByAge(); if(groundUnit.getGroundType()==0){ }

if(groundUnit.getGroundType()==1){ }

if(groundUnit.getGroundType()==2){ }

//System.out.println(\

26

competitiveness*=(strength*3+speed*7*1.2); if(bodySize<=5){

competitiveness*=(5/bodySize);

}else if(bodySize>=45){ }

competitiveness*=(bodySize/45);

competitiveness*=(strength*3+speed*7*1.2); if(bodySize<=25){

competitiveness*=(25/bodySize);

}else if(bodySize>=80){ }

competitiveness*=(bodySize/80);

competitiveness*=(strength*3+speed*7*1.2); if(bodySize<=45){

competitiveness*=(5/bodySize);

}else if(bodySize>=150){ }

competitiveness*=(bodySize/150);