v3: кубик автоматически перемешивается при загрузке
This commit is contained in:
parent
58954348e6
commit
2747d6173a
@ -259,7 +259,7 @@
|
||||
<div class="control-group">
|
||||
<div class="control-group-title">Действия</div>
|
||||
<div class="btn-row">
|
||||
<button class="kt-ai-btn" data-variant="primary" data-size="sm" onclick="scramble()">Перемешать</button>
|
||||
<button class="kt-ai-btn" data-variant="primary" data-size="sm" onclick="scramble(true)">Перемешать</button>
|
||||
<button class="kt-ai-btn" data-size="sm" onclick="showHint()">Подсказать</button>
|
||||
<button class="kt-ai-btn" data-variant="danger" data-size="sm" onclick="resetGame()">Заново</button>
|
||||
</div>
|
||||
@ -561,14 +561,16 @@ function getRotationAxis(layer) {
|
||||
return 'Z';
|
||||
}
|
||||
|
||||
function scramble() {
|
||||
function scramble(reset = true) {
|
||||
if (isAnimating) return;
|
||||
|
||||
const layers = ['U', 'D', 'L', 'R', 'F', 'B'];
|
||||
const moves = 20;
|
||||
let currentMove = 0;
|
||||
|
||||
if (reset) {
|
||||
resetGame();
|
||||
}
|
||||
moveHistory = [];
|
||||
|
||||
function nextMove() {
|
||||
@ -704,6 +706,7 @@ document.addEventListener('touchend', () => {
|
||||
});
|
||||
|
||||
initCube();
|
||||
setTimeout(() => scramble(), 500);
|
||||
|
||||
let moveHistory = [];
|
||||
let hintTimeout = null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user