Skip to content

Instantly share code, notes, and snippets.

@hfuller
Created June 2, 2013 09:27
Show Gist options
  • Save hfuller/5693133 to your computer and use it in GitHub Desktop.
Save hfuller/5693133 to your computer and use it in GitHub Desktop.
private function generate() {
$rs = $RANKS; $ts = $TYPES;
shuffle($rs) and shuffle($ts) or die("Failed to shuffle stuff");
$rsi = 0; //ranks index
$tsi = 0; //types index
for ( $i = 0; $i < $SIZE; $i++ ) {
if ( $i < $SIDE /*or we are on the left or right side*/) {
$this->getHex($i)->setType(Hex::Water);
} else {
$this->getHex($i)->setType($ts[$tsi]);
$tsi++;
$this->getHex($i)->setRank($rs[$rsi]);
$rsi++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment