...
 
Commits (2)
import davis.core.agents.rendez_vous.RDVRingAgent; import davis.core.agents.rendez_vous.RDVRectangularAgent;
import davis.core.model.RectangularAgent;
import java.util.ArrayList;
import java.util.Random; import java.util.Random;
public class RandomWalkWaitRing extends RDVRingAgent { public class RandomWalkPath extends RDVRectangularAgent {
Random random; Random random;
public void init() { public void init() {
...@@ -11,10 +13,10 @@ public class RandomWalkWaitRing extends RDVRingAgent { ...@@ -11,10 +13,10 @@ public class RandomWalkWaitRing extends RDVRingAgent {
} }
public void randomWalk(Object Board) { public void randomWalk(Object Board) {
if (random.nextBoolean()) stay(); if (random.nextBoolean()) {
else { if (!goRight()) goLeft();
if (random.nextBoolean()) goLeft(); } else {
else goRight(); if (!goLeft()) goRight();
} }
} }
} }
...@@ -2,7 +2,7 @@ import davis.core.agents.rendez_vous.RDVRingAgent; ...@@ -2,7 +2,7 @@ import davis.core.agents.rendez_vous.RDVRingAgent;
import java.util.Random; import java.util.Random;
public class randomWalkRing extends RDVRingAgent { public class RandomWalkRing extends RDVRingAgent {
Random random; Random random;
public void init() { public void init() {
...@@ -14,8 +14,4 @@ public class randomWalkRing extends RDVRingAgent { ...@@ -14,8 +14,4 @@ public class randomWalkRing extends RDVRingAgent {
if (random.nextBoolean()) goLeft(); if (random.nextBoolean()) goLeft();
else goRight(); else goRight();
} }
public void rdv(Object board) {
super.rdv(board);
}
} }
import davis.core.idscheme.IdScheme;
import davis.core.model.RectangularAgent;
import davis.core.model.RectangularPlace;
import davis.core.network.AgentFactory;
import davis.core.network.RectangularGridGenerator;
import io.jbotsim.core.Topology;
public class RectangularTwoAgents<B> extends RectangularGridGenerator<RectangularPlace<B>> {
@Override
public void generate(Topology topo, IdScheme id) {
Class defaultNode = topo.getDefaultNodeModel();
topo.setDefaultNodeModel(RectangularPlace.class);
super.generate(topo, id);
topo.setDefaultNodeModel(defaultNode);
AgentFactory.<RectangularAgent<B>, B>nAgentsAtRandomPlace(topo, 2);
}
}
test1 RingAnon2AgentsSym.java RandomIds 18 randomWalkRing.java RandomWalkRing RingAnon2AgentsSym.java RandomIds 18 RandomWalkRing.java
test2 RingAnon2AgentsSym.java RandomIds 18 RandomWalkWaitRing.java RandomWalkPath RectangularTwoAgents.java RandomIds 18*1 RandomWalkPath.java