Tetris randomizers, bueno ver como evoluciono el motor de seleccion de piezas aleatorias en los diferentes tetris:
- random
- random, 1 spot de memoria, 1 nivel de "roll" (no repetidos)
- random, 4 spot de memoria, 4 nivel de "roll" (no repetidos)
- 7 bag (2001+)
https://simon.lc/the-history-of-tetris-randomizers
function* historyRandomizer() {
const pieces = ["I", "J", "L", "O", "S", "T", "Z"];
let history;
while (true) {
// First "roll"
piece = pieces[Math.floor(Math.random() * pieces.length)];
// Roll is checked against the history
if (piece === history) {
piece = pieces[Math.floor(Math.random() * pieces.length)];
}
history = piece;
yield piece;
}
}
No hay comentarios.:
Publicar un comentario