Skip to content

Instantly share code, notes, and snippets.

@sumtyme
Forked from anonymous/gist:5274745
Last active December 15, 2015 14:39
Show Gist options
  • Save sumtyme/5275666 to your computer and use it in GitHub Desktop.
Save sumtyme/5275666 to your computer and use it in GitHub Desktop.
public void seedEarth(int coord1, int coord2, int probStat, int probDec) {
if(coord1 < gridSize && coord2 < gridSize && coord1 >= 0 && coord2 >= 0) {
if(grid[coord1][coord2]!= 1){
grid[coord1][coord2] = 1;
if(randomGen.nextInt(100) <= 100 - probStat) {
seedEarth(coord1 -1,coord2, probStat + probDec, probDec);
}
if(randomGen.nextInt(100) <= 100 - probStat) {
seedEarth(coord1, coord2-1, probStat + probDec, probDec);
}
if(randomGen.nextInt(100) <= 100 - probStat) {
seedEarth(coord1+1, coord2, probStat + probDec, probDec);
}
if(randomGen.nextInt(100) <= 100 - probStat) {
seedEarth(coord1, coord2+1, probStat + probDec, probDec);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment