亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? simplebug.java

?? Swarm多agent仿真教程ObserverSwarm應用:運用GUI可初化仿真
?? JAVA
字號:
// SimpleBug.java
// Defines the class for our SimpleBug agents/

import swarm.Globals;
import swarm.defobj.Zone;
import swarm.objectbase.SwarmObjectImpl;

import swarm.space.Discrete2dImpl;
import swarm.space.Grid2dImpl;

import swarm.gui.Raster;
import swarm.gui.ZoomRasterImpl;

public class SimpleBug extends SwarmObjectImpl
{
    // These instance variables keep track of a given bug's foodspace,
    // position, hardiness and identity.  We also save the dimensions
    // of the foodspace so that we can make fewer calls to the
    // getSizeX() and getSizeY() methods in the bug's randomWalk().
    public FoodSpace myFoodSpace;
    public Grid2dImpl myBugSpace;
    public int xPos;
    public int yPos;
    public int bugNumber;
    public int bugHardiness;
    public ModelSwarm modelSwarm;

    int worldXSize;
    int worldYSize;

    // bugColor records the color that this bug is to use when drawing
    // itself on the GUI display raster.
    public byte bugColor;

    // haveEaten keeps track of whether the bug has eaten on its most
    // recent walk and periodsSinceEaten keeps track of just that.
    public boolean haveEaten;
    public int periodsSinceEaten = 0;

    // Constructor to create a SimpleBug object in Zone aZone and to
    // place it in the foodspace and bugspace, fSpace and bSpace, at
    // the specified X,Y location. The bug is also given a numeric id,
    // bNum.
    public SimpleBug(Zone aZone, FoodSpace fSpace, Grid2dImpl bSpace, 
		     int X, int Y, int bNum, int bHardiness, 
		     ModelSwarm mSwarm)
    {
	// Call the constructor for the bug's parent class.
	super(aZone);

	// Record the bug's foodspace, bugspace, initial position and
	// id number.
	myFoodSpace = fSpace;
	myBugSpace = bSpace;
	worldXSize = myFoodSpace.getSizeX();
	worldYSize = myFoodSpace.getSizeY();
	xPos = X;
	yPos = Y;
	bugNumber = bNum;
	bugHardiness = bHardiness;
	modelSwarm = mSwarm;
    }

    // This is the method to have the bug take a random walk backward
    // (-1), forward (+1), or not at all (0) in first the X and then
    // the Y direction.  The randomWalk method uses
    // getIntegerWithMin$withMax() to return an integer between a
    // minimum and maximum value, here between -1 and +1.
    // Globals.env.uniformRand is an instance of the class
    // UniformIntegerDistImpl, instantiated by the call to
    // Globals.env.initSwarm in StartSimpleBug.  Note that the bug's
    // world is a torus.  If the bug walks off the edge of its
    // rectangular world, it is magically transported (via the modulus
    // operator) to the opposite edge.  If on its walk the bug finds
    // food, it eats it and turns on the haveEaten flag so it can
    // report its feast if asked.  Note that before the bug actually
    // moves, we must check to see that there is no other bug at the
    // destination cell.  If there is, the this bug just stays put.
    public void randomWalk()
    {
	int newX, newY;

	// Decide where to move.
	newX = xPos + 
            Globals.env.uniformIntRand.getIntegerWithMin$withMax(-1, 1);
	newY = yPos +
	    Globals.env.uniformIntRand.getIntegerWithMin$withMax(-1, 1);
	newX = (newX + worldXSize) % worldXSize;
	newY = (newY + worldYSize) % worldYSize;

	// Is there a bug at the new position already? If not, put a
	// null at this bug's current position and put this bug at the
	// new position.
	if (myBugSpace.getObjectAtX$Y(newX, newY) == null)
	    {
		myBugSpace.putObject$atX$Y(null, xPos, yPos);
		xPos = newX;
		yPos = newY;
		myBugSpace.putObject$atX$Y(this, xPos, yPos);
	    }

	// If there is food at this cell, eat it and record the
	// fact. Otherwise, increment periodsSinceEaten and change the
	// bugColor to yellow (3).
	if (myFoodSpace.getValueAtX$Y(xPos, yPos) == 1)
	    {
	    myFoodSpace.putValue$atX$Y(0, xPos, yPos);
	    haveEaten = true;
	    periodsSinceEaten = 0;
	    setBugColor((byte)2);
	    }
	else
	    {
	    haveEaten = false;
	    ++periodsSinceEaten;
	    if (periodsSinceEaten >= bugHardiness/2)
		setBugColor((byte)3);
	    }

	// Now check to see if we're still alive!  If not, we tell
	// modelSwarm that we've died.
	if (periodsSinceEaten >= bugHardiness)
	    modelSwarm.bugDeath(this);
    }

    // Method to report the bug's position to the console.
    public void reportPosition()
    {
	System.out.println("Bug " + bugNumber + " is at " + xPos + 
			   ", " + yPos);
    }
    // Method to report if the bug has eaten.
    public boolean reportIfEaten()
    {
	if ( haveEaten )
	    System.out.println("Bug " + bugNumber + " has found food at " +
			       xPos + ", " + yPos);

	return haveEaten;
    }

    // These are methods that allow the bug to draw itself on the GIU
    // raster display object.  The first tells the bug what color it
    // should use, the second draws the bug at its current location.
    public Object setBugColor(byte c)
    { 
	bugColor = c; 
	return this; 
    }

    public Object drawSelfOn (Raster r)
    {
	r.drawPointX$Y$Color (xPos, yPos, bugColor);
	return this;
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
偷拍亚洲欧洲综合| 日本欧美一区二区| 国产目拍亚洲精品99久久精品| 91精品国产综合久久国产大片| 欧美性猛交xxxxxxxx| 欧美主播一区二区三区美女| 欧美主播一区二区三区美女| 欧美精品一二三| 日韩欧美色综合| 久久亚洲欧美国产精品乐播| 国产女主播一区| 一区在线观看视频| 午夜精品成人在线视频| 男女男精品视频| 国产九色sp调教91| 91在线精品秘密一区二区| 色一情一乱一乱一91av| 欧美日韩一二三| 26uuu色噜噜精品一区| 中文字幕在线视频一区| 亚洲国产欧美在线| 国内成+人亚洲+欧美+综合在线| 国产成人精品亚洲777人妖| jlzzjlzz欧美大全| 欧美日韩五月天| 国产欧美一区二区精品秋霞影院 | 久久精品一区四区| 亚洲色图一区二区| 日韩精彩视频在线观看| 国产成人免费9x9x人网站视频| eeuss国产一区二区三区| 欧美午夜精品久久久久久超碰 | 久久色.com| 樱桃视频在线观看一区| 久久精品国产一区二区| 成人avav影音| 欧美一级欧美三级| 亚洲欧洲中文日韩久久av乱码| 久久精品国产999大香线蕉| 东方aⅴ免费观看久久av| 欧美裸体一区二区三区| 日本一区二区在线不卡| 视频一区欧美日韩| 91麻豆精东视频| 欧美精品一区二区三区在线播放 | 欧美一区二区三区四区五区| 国产欧美日韩在线观看| 石原莉奈在线亚洲三区| av电影在线观看不卡| 欧美mv和日韩mv国产网站| 一区二区视频在线| 欧美在线观看视频一区二区三区| 亚洲欧美国产77777| 丝袜亚洲另类欧美| 北条麻妃国产九九精品视频| 欧美成人精品福利| 亚洲福利视频一区二区| 97se亚洲国产综合自在线不卡| 欧美日韩高清一区二区三区| 久久99热这里只有精品| 日本一区二区不卡视频| 欧美视频一区在线观看| 黄页网站大全一区二区| 亚洲欧洲制服丝袜| 精品88久久久久88久久久| av亚洲精华国产精华精| 日本不卡不码高清免费观看| 国产精品伦一区| 欧美一级xxx| 99精品国产99久久久久久白柏| 三级欧美韩日大片在线看| 中文字幕免费在线观看视频一区| 欧美日韩高清一区二区三区| 国产aⅴ综合色| 日本欧美在线观看| 亚洲另类色综合网站| 欧美成人伊人久久综合网| 色综合久久综合网欧美综合网| 久久超碰97中文字幕| 亚洲一区二区欧美日韩 | 狠狠色丁香婷婷综合久久片| 日韩久久一区二区| 26uuu亚洲综合色| 欧美一区二区三区在线看| 成人aa视频在线观看| 蜜桃视频第一区免费观看| 自拍av一区二区三区| 久久先锋影音av| 欧美日韩你懂的| 日本久久电影网| 99re热视频这里只精品| 九色综合狠狠综合久久| 午夜久久久久久电影| 亚洲精品日日夜夜| 国产精品久久久久一区二区三区| 日韩一区二区电影| 欧美日韩视频在线第一区 | 国产精品二区一区二区aⅴ污介绍| 91精品国产色综合久久| 欧美日韩成人在线| 91久久精品一区二区三| eeuss鲁一区二区三区| 国产精品一线二线三线精华| 国内偷窥港台综合视频在线播放| 日韩精品免费视频人成| 亚洲国产成人porn| 亚洲一区日韩精品中文字幕| 亚洲激情一二三区| 亚洲精品视频一区| 亚洲一区二区在线视频| 亚洲美女区一区| 亚洲日本一区二区| 亚洲卡通动漫在线| 一区二区三区欧美日韩| 亚洲影院免费观看| 亚洲高清久久久| 日韩国产高清在线| 美腿丝袜亚洲综合| 激情偷乱视频一区二区三区| 国产原创一区二区| 精品一区二区三区免费观看| 国产乱码精品一区二区三| 国产91在线看| 色综合一区二区| 欧美二区乱c少妇| 欧美电影免费观看高清完整版在线 | 91视频在线看| 色999日韩国产欧美一区二区| 欧美写真视频网站| 51精品国自产在线| 久久尤物电影视频在线观看| 国产精品久久久久久亚洲伦| 一区二区理论电影在线观看| 日韩精品电影在线| 国产精品一区二区三区四区| 成人视屏免费看| 欧美日韩卡一卡二| 国产亚洲自拍一区| 亚洲精选视频免费看| 日韩电影免费在线观看网站| 国产一区二区精品久久| 色八戒一区二区三区| 欧美大片一区二区| 亚洲欧洲日韩在线| 美国欧美日韩国产在线播放| 欧美亚洲动漫精品| 欧美xxxxxxxx| 亚洲色图欧美偷拍| 日本不卡在线视频| 不卡一区中文字幕| 777xxx欧美| 国产精品嫩草久久久久| 视频在线观看一区| 成人免费黄色在线| 91麻豆精品91久久久久同性| 国产女主播视频一区二区| 亚洲成人资源在线| 国产成人免费视频网站| 欧美视频一区二区三区四区| 国产无一区二区| 天堂久久久久va久久久久| 高清不卡在线观看av| 欧美丰满美乳xxx高潮www| 国产精品天美传媒| 麻豆91在线观看| 欧美性做爰猛烈叫床潮| 中文字幕 久热精品 视频在线| 日韩成人免费看| 色天使色偷偷av一区二区| 国产视频亚洲色图| 美女视频免费一区| 日本道在线观看一区二区| 久久久影院官网| 日韩福利视频网| 欧美中文字幕亚洲一区二区va在线 | 亚洲综合一区二区精品导航| 成人在线一区二区三区| 亚洲精品在线观| 免费人成黄页网站在线一区二区| 欧美视频在线一区| 亚洲精品国产a久久久久久| 国产宾馆实践打屁股91| 亚洲精品在线一区二区| 麻豆国产精品777777在线| 欧美人体做爰大胆视频| 亚洲一区二区三区四区在线| 成人av资源在线| 日本一区二区三区在线不卡| 韩日av一区二区| 日韩精品一区二区三区四区视频| 日韩电影免费在线观看网站| 欧美乱熟臀69xxxxxx| 亚洲国产视频a| 欧美精品v国产精品v日韩精品| 一区二区三区在线免费视频| 91福利在线免费观看| 亚洲一区二区三区精品在线| 欧美性视频一区二区三区| 亚洲第一在线综合网站| 欧美丝袜自拍制服另类|