Commit c6be28d8 authored by Dumoulin Nicolas's avatar Dumoulin Nicolas
Browse files

runtime fixes

1 merge request!1Add Svn history
Showing with 21 additions and 16 deletions
+21 -16
...@@ -2,11 +2,7 @@ ...@@ -2,11 +2,7 @@
<!DOCTYPE xml> <!DOCTYPE xml>
<pikelake.Grid> <pikelake.Grid>
<torusType>BOTH</torusType> <torusType>BOTH</torusType>
<neighborsType>NEIGHBORHOOD_VON_NEUMANN</neighborsType> <neighborsType>NEIGHBORHOOD_VON_NEUMANN</neighborsType>
<preyCarryingCapacity>50</preyCarryingCapacity> <gridWidth>10</gridWidth>
<gridWidth>10</gridWidth> <gridHeight>10</gridHeight>
<gridHeight>10</gridHeight>
<habitatValue0>0.25</habitatValue0>
<habitatValue1>0.5</habitatValue1>
<habitatValue2>1</habitatValue2>
</pikelake.Grid> </pikelake.Grid>
\ No newline at end of file
...@@ -5,6 +5,8 @@ import fr.cemagref.simaqualife.extensions.spatial2D.Grid2D.NeighborsType; ...@@ -5,6 +5,8 @@ import fr.cemagref.simaqualife.extensions.spatial2D.Grid2D.NeighborsType;
import fr.cemagref.simaqualife.kernel.AquaNismsGroup; import fr.cemagref.simaqualife.kernel.AquaNismsGroup;
import fr.cemagref.simaqualife.kernel.util.TransientParameters.InitTransientParameters; import fr.cemagref.simaqualife.kernel.util.TransientParameters.InitTransientParameters;
import fr.cemagref.simaqualife.pilot.Pilot; import fr.cemagref.simaqualife.pilot.Pilot;
import java.util.ArrayList;
import java.util.List;
import pikelake.pikes.Pike; import pikelake.pikes.Pike;
public class Grid extends Grid2D<Cell, Individual> { public class Grid extends Grid2D<Cell, Individual> {
...@@ -16,8 +18,9 @@ public class Grid extends Grid2D<Cell, Individual> { ...@@ -16,8 +18,9 @@ public class Grid extends Grid2D<Cell, Individual> {
@InitTransientParameters @InitTransientParameters
public void initTransientParameters(Pilot pilot) { public void initTransientParameters(Pilot pilot) {
// TODO // TODO
// TODO empty grid
this.grid = new Cell[]{new Cell(0, 0.0), new Cell(1, 0.0)};
} }
@Override @Override
...@@ -39,4 +42,10 @@ public class Grid extends Grid2D<Cell, Individual> { ...@@ -39,4 +42,10 @@ public class Grid extends Grid2D<Cell, Individual> {
ind.getPosition().removePike((Pike) ind); ind.getPosition().removePike((Pike) ind);
} }
public List<Cell> getNeighbours(Cell position, int distance) {
// TODO
return new ArrayList<Cell>();
}
} }
...@@ -13,22 +13,22 @@ import fr.cemagref.simaqualife.pilot.Pilot; ...@@ -13,22 +13,22 @@ import fr.cemagref.simaqualife.pilot.Pilot;
public class PikeMovement extends LoopAquaNismsGroupProcess<Pike, PikesGroup> { public class PikeMovement extends LoopAquaNismsGroupProcess<Pike, PikesGroup> {
private int distance;
transient private UniformGen uniformGen; transient private UniformGen uniformGen;
public PikeMovement(Pilot pilot) { public PikeMovement(Pilot pilot) {
uniformGen = new UniformGen(pilot.getRandomStream(), new UniformDist()); uniformGen = new UniformGen(pilot.getRandomStream(), new UniformDist());
} }
@InitTransientParameters
public void initTransientParameters(Pilot pilot) { @InitTransientParameters
uniformGen = new UniformGen(pilot.getRandomStream(), new UniformDist(0,1)); public void initTransientParameters(Pilot pilot) {
} uniformGen = new UniformGen(pilot.getRandomStream(), new UniformDist(0, 1));
}
@Override @Override
protected void doProcess(Pike pike, PikesGroup group) { protected void doProcess(Pike pike, PikesGroup group) {
final List<Cell> surrounding = group.getEnvironment(). final List<Cell> surrounding = group.getEnvironment().getNeighbours(pike.getPosition(), distance);
getNeighbours(pike.getPosition());
// the first possiblity is the cell where the prey is // the first possiblity is the cell where the prey is
List<Cell> possibilities = new ArrayList<Cell>(); List<Cell> possibilities = new ArrayList<Cell>();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment