Skip to content

Instantly share code, notes, and snippets.

@hanss314
Created March 8, 2017 01:04
Show Gist options
  • Save hanss314/107f8647c71cc4313e9b3df079921638 to your computer and use it in GitHub Desktop.
Save hanss314/107f8647c71cc4313e9b3df079921638 to your computer and use it in GitHub Desktop.
public void rotSymRandomize(int deadDensity){
for(int x = 0; x<(WIDTH/2); x++){ //doesn't cover everything for odd widths, but it's good enough
for(int y = 0; y<HEIGHT; y++){
Tile t = allTiles[x][y];
Tile pair = allTiles[WIDTH-1-x][HEIGHT-1-y];
int state = MathUtil.randInt(0,deadDensity*2)
switch(state){
case 0: t.setState(1);
pair.setState(2);
break;
case 1: t.setState(2);
pair.setState(1);
break;
default:t.setState(0);
pair.setState(0);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment