Mind. 1/3 positionen sind rotiert bei der levelgeneration
This commit is contained in:
parent
e0c25532ae
commit
20fd1fcf8a
@ -198,9 +198,13 @@ class LevelManager extends StandardManager
|
||||
}
|
||||
$words[$levelsToGenerate[$currentIndex]["wordLength"]] = $currentWords;
|
||||
$positions = [];
|
||||
do {
|
||||
for ($i = 0; $i < $levelsToGenerate[$currentIndex]["numPositions"]; $i++) {
|
||||
$positions[] = rand(0, 3);
|
||||
}
|
||||
} while (count(array_filter($positions, function($position) {
|
||||
return $position == 0;
|
||||
}))/$levelsToGenerate[$currentIndex]["numPositions"] >= 0.67);
|
||||
|
||||
$level = new Level();
|
||||
$level->setWords(json_encode($selectedWords));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user