⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fly.java

📁 MASON代表多主体邻里或网络仿真(Multi-Agent Simulator of Neighborhoods or Networks)。它是乔治梅森大学用Java开发的离散事件多主体仿真核心库
💻 JAVA
字号:
package sim.app.tutorial7;import sim.engine.*;import sim.util.*;import sim.field.grid.*;public class Fly implements Steppable    {    public void step(SimState state)        {        Tutorial7 tut = (Tutorial7) state;                SparseGrid3D flies = tut.flies;                // Move me in a random direction        Int3D myLoc = flies.getObjectLocation(this);        int x = flies.stx(myLoc.x + (tut.random.nextBoolean() ? 1 : -1));        int y = flies.sty(myLoc.y + (tut.random.nextBoolean() ? 1 : -1));        int z = flies.stz(myLoc.z + (tut.random.nextBoolean() ? 1 : -1));        flies.setObjectLocation(this, new Int3D(x,y,z));                // Update the projections with, I dunno, some function based on my position :-)        tut.xProjection.field[y][z] += Math.log(x+2);        tut.yProjection.field[x][z] += Math.log(y+2);        tut.zProjection.field[x][y] += Math.log(z+2);        }    }    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -