Package org.baseagent.grid
Class GridLayerStep
java.lang.Object
org.baseagent.grid.GridLayerStep
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleaverage4Neighbors(int x, int y) doubleaverage8Neighbors(int x, int y) doubleaverage9Neighbors(int x, int y) voidclear(int x, int y) voidclear(GridPosition position) longReturns a count of the number of times the predicate is true across the full layer.intcount4Neighbors(int x, int y, Predicate<? super Object> predicate) Returns a count of the neighbors to the north, south, east, and west of the given cell that match the predicate.intcount8Neighbors(int x, int y, Predicate<? super Object> predicate) Returns a count of the neighbors surrounding the given cell that match the predicate.voidvoidvoidDefines a visual arrangement for playing the given thing on the grid.voidget(int x, int y) get(GridPosition position) intgetBooleanAsOneOrZero(int x, int y, Predicate<Object> predicate) Test the give predicate.doublelaplacian_3x3(int x, int y, double centerWeight, double adjacentWeight, double diagonalWeight) voidRandomly places the given thing throughout the GridLayerStep, making sure to not place a thing on a space that already has the same thing.voidvoidvoidvoidvoidset(GridPosition position, Object value) voidvoidsetEachCell(GridLayerStep conditionalLayer, Function<Object, Object> f)
-
Constructor Details
-
GridLayerStep
-
-
Method Details
-
fill
-
fill
-
laplacian_3x3
public double laplacian_3x3(int x, int y, double centerWeight, double adjacentWeight, double diagonalWeight) -
set
-
set
-
clear
public void clear(int x, int y) -
clear
-
get
-
get
-
setEachCell
-
setEachCell
-
count8Neighbors
Returns a count of the neighbors surrounding the given cell that match the predicate. -
count4Neighbors
Returns a count of the neighbors to the north, south, east, and west of the given cell that match the predicate. -
average9Neighbors
public double average9Neighbors(int x, int y) -
average8Neighbors
public double average8Neighbors(int x, int y) -
average4Neighbors
public double average4Neighbors(int x, int y) -
count
Returns a count of the number of times the predicate is true across the full layer. -
getBooleanAsOneOrZero
Test the give predicate. If the predicate is true, return 1, otherwise return 0. -
scatter
Randomly places the given thing throughout the GridLayerStep, making sure to not place a thing on a space that already has the same thing. -
scatter
-
scatter
-
scatter
-
form
Defines a visual arrangement for playing the given thing on the grid. Key: . = empty space, O = Thing -
form
-
getRandomUnoccupiedPosition
-