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