第一范文网 - 专业文章范例文档资料分享平台

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

来源:用户分享 时间:2025/5/15 18:12:47 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

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

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);

生命游戏-JAVA语言代码-细胞自动机-毕业论文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c1q08w7s8491cf865cb4r_8.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top