test edition
practical magic
autumn scotland 2025

Test

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Test » One, Two, Buckle My Shoe » ивент 1


ивент 1

Сообщений 1 страница 1 из 1

1

[indent]#1 урожай тётушки рут : игра-головоломка
[indent]ивент с подраками после открытия форума

https://forumstatic.ru/files/001b/7a/c4/18160.jpg

Ходят слухи, что Тётушка Рут - самая настоящая ведьма, а её ферму близ Элрика обычно объезжают стороной, кроме одного дня в году - Самайна. Рут выращивает самую сладкую тыкву в Шотландии, и в канун праздника окончания уборки урожая у её фермы выстраивается огромная очередь из людей и ведьм, только чтобы попробовать этот легендарный осенний плод. А на сбережённую сумму тётушка Рут засадит еще больше тыквы к следующему году. Ну что, поможешь старой ведьме собрать весь урожай к ночи Самайна?
[indent]

правила игры

  • цель - убрать все тыквы с игрового поля

  • победой считается пустое поле как на скриншоте

  • не получилось? не страшно, для сброса игры нажмите на кнопку "новая игра"

  • пришлите результат в этой теме под хайдом

  • ивент продлится до 05.11.2025

  • награда победителям: 200 ед. валюты и особое оформление личной страницы в виде купона

  • для обналичивания купона пришлите его амс на форуме после открытия в теме магазина

  • удачи! 🎃

Код:
[hide=99999][img]ссылка на скриншот[/img][/hide]

[hideprofile]

[html]
УРОВЕНЬ 1
<div id="game">
  <div id="grid"></div>
  <button onclick="resetGame()">Новая игра</button>
  <p id="message"></p>
</div>

<style>
#game { text-align: center; }
#grid { display: grid; grid-template-columns: repeat(3, 50px); gap: 5px; margin: 20px 0; justify-content: center; }
.light { width: 50px; height: 50px; border: 1px solid #d2d1bb; cursor: pointer; border-radius: 5px; }
.light.on { background: url(https://forumstatic.ru/files/001b/7a/c4/55034.png) no-repeat #373625; box-shadow: 0 0 15px #5b5c56; background-size: cover; border: solid 1px #5b5c56;}
.light.off { background-color: #fefbf2; }
#message { margin-top: 10px; font-weight: bold; }
button {  padding: 3px 10px;
    text-transform: lowercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: solid 1px var(--button_line);
    background: var(--button);
    -webkit-transition: 0.25s;
    transition: 0.25s;
    border-radius: 20px;
    outline: none;}
button:hover {
background: var(--button_line);
</style>

<script>
function createGame() {
  const grid = document.getElementById('grid');
  grid.innerHTML = '';
 
  for (let i = 0; i < 9; i++) {
    const light = document.createElement('div');
    light.className = Math.random() > 0.5 ? 'light on' : 'light off';
    light.addEventListener('click', () => toggleLights(i));
    grid.appendChild(light);
  }
 
  document.getElementById('message').textContent = '';
}

function toggleLights(index) {
  const lights = document.querySelectorAll('.light');
  const row = Math.floor(index / 3);
  const col = index % 3;
 
  const positions = [
    index,
    index - 3,
    index + 3,
    index - 1,
    index + 1 
  ];
 
  positions.forEach(pos => {
    if (pos >= 0 && pos < 9) {
      const posRow = Math.floor(pos / 3);
      const posCol = pos % 3;
     
      if (Math.abs(pos - index) === 1) {
        if (posRow === row) {
          lights[pos].classList.toggle('on');
          lights[pos].classList.toggle('off');
        }
      } else {
        lights[pos].classList.toggle('on');
        lights[pos].classList.toggle('off');
      }
    }
  });
 
  checkWin();
}

function checkWin() {
  const onLights = document.querySelectorAll('.light.on');
  if (onLights.length === 0) {
    document.getElementById('message').textContent = 'Поздравляем! Вы победили! 🎉';
  }
}

function resetGame() {
  createGame();
}

// Начало игры
createGame();
</script>[/html]

[html]<div id="game">
  <div id="grid"></div>
  <button onclick="resetGame()">Новая игра</button>
  <p id="message"></p>
</div>

<style>
#game { text-align: center; }
#grid { display: grid; grid-template-columns: repeat(4, 50px); gap: 5px; margin: 20px 0; justify-content: center; }
.light { width: 50px; height: 50px; border: 1px solid #d2d1bb; cursor: pointer; border-radius: 5px; }
.light.on { background: url(https://forumstatic.ru/files/001b/7a/c4/55034.png) no-repeat #373625; box-shadow: 0 0 15px #5b5c56; background-size: cover; border: solid 1px #5b5c56;}
.light.off { background-color: #fefbf2; }
#message { margin-top: 10px; font-weight: bold; }
button {  padding: 3px 10px;
    text-transform: lowercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: solid 1px var(--button_line);
    background: var(--button);
    -webkit-transition: 0.25s;
    transition: 0.25s;
    border-radius: 20px;
    outline: none;}
button:hover {
background: var(--button_line);
</style>

<script>
function createGame() {
  const grid = document.getElementById('grid');
  grid.innerHTML = '';
 
  // Создаем случайную начальную конфигурацию для 4x4
  for (let i = 0; i < 16; i++) {
    const light = document.createElement('div');
    light.className = Math.random() > 0.5 ? 'light on' : 'light off';
    light.addEventListener('click', () => toggleLights(i));
    grid.appendChild(light);
  }
 
  document.getElementById('message').textContent = '';
}

function toggleLights(index) {
  const lights = document.querySelectorAll('.light');
  const row = Math.floor(index / 4);
  const col = index % 4;
 
  // Переключаем саму лампу и соседей
  const positions = [
    index, // сама лампа
    index - 4, // сверху
    index + 4, // снизу
    index - 1, // слева
    index + 1  // справа
  ];
 
  positions.forEach(pos => {
    // Проверяем границы и чтобы соседи были в той же строке
    if (pos >= 0 && pos < 16) {
      const posRow = Math.floor(pos / 4);
      const posCol = pos % 4;
     
      // Проверяем, что сосед находится в пределах одной строки для боковых
      if (Math.abs(pos - index) === 1) { // боковые соседи
        if (posRow === row) { // только если в той же строке
          lights[pos].classList.toggle('on');
          lights[pos].classList.toggle('off');
        }
      } else { // сама лампа, верхний и нижний сосед
        lights[pos].classList.toggle('on');
        lights[pos].classList.toggle('off');
      }
    }
  });
 
  checkWin();
}

function checkWin() {
  const onLights = document.querySelectorAll('.light.on');
  if (onLights.length === 0) {
    document.getElementById('message').textContent = 'Поздравляем! Вы победили! 🎉';
  }
}

function resetGame() {
  createGame();
}

// Начало игры
createGame();
</script>[/html]

[html]<div id="game">
  <div id="grid"></div>
  <button onclick="resetGame()">Новая игра</button>
  <p id="message"></p>
</div>

<style>
#game { text-align: center; }
#grid { display: grid; grid-template-columns: repeat(5, 50px); gap: 5px; margin: 20px 0; justify-content: center; }
.light { width: 50px; height: 50px; border: 1px solid #d2d1bb; cursor: pointer; border-radius: 5px; }
.light.on { background: url(https://forumstatic.ru/files/001b/7a/c4/55034.png) no-repeat #373625; box-shadow: 0 0 15px #5b5c56; background-size: cover; border: solid 1px #5b5c56;}
.light.off { background-color: #fefbf2; }
#message { margin-top: 10px; font-weight: bold; }
button {  padding: 3px 10px;
    text-transform: lowercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: solid 1px var(--button_line);
    background: var(--button);
    -webkit-transition: 0.25s;
    transition: 0.25s;
    border-radius: 20px;
    outline: none;}
button:hover {
background: var(--button_line);
</style>

<script>
function createGame() {
  const grid = document.getElementById('grid');
  grid.innerHTML = '';
 
  for (let i = 0; i < 25; i++) {
    const light = document.createElement('div');
    light.className = Math.random() > 0.5 ? 'light on' : 'light off';
    light.addEventListener('click', () => toggleLights(i));
    grid.appendChild(light);
  }
 
  document.getElementById('message').textContent = '';
}

function toggleLights(index) {
  const lights = document.querySelectorAll('.light');
  const positions = [index, index-1, index+1, index-5, index+5];
 
  positions.forEach(pos => {
    if (pos >= 0 && pos < 25 && !(index % 5 === 0 && pos === index-1) && !(index % 5 === 4 && pos === index+1)) {
      lights[pos].classList.toggle('on');
      lights[pos].classList.toggle('off');
    }
  });
 
  checkWin();
}

function checkWin() {
  const onLights = document.querySelectorAll('.light.on');
  if (onLights.length === 0) {
    document.getElementById('message').textContent = 'Поздравляем! Вы победили! 🎉';
  }
}

function resetGame() {
  createGame();
}

createGame();
</script>[/html]

0

Быстрый ответ

Напишите ваше сообщение и нажмите «Отправить»



Вы здесь » Test » One, Two, Buckle My Shoe » ивент 1


Рейтинг форумов | Создать форум бесплатно