Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Day 9 - Halloween Coding Challenges 2023 - JavaScript, HTML, and CSS

simong1993

Gold Coder
Staff Team
Guardian
🎃 Spooky Challenge - Day 9 🎃

The Spirits' Cipher

As the clock nears the witching hour, the spirits present a final test. The numbers you've gathered are scattered among impostors in a spectral cipher. Can you decipher the true sequence amidst the distractions?


The spirits sing:

"Among the ghosts and shadow's glee,
Numbers hidden, you must see.
Pick them out, with careful glance,
To reveal the spectral dance."

HTML:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>The Spirits' Cipher</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="cipher-grid" onclick="selectNumber(event)">
        <!-- Numbers will be dynamically added here by JavaScript -->
    </div>
    <div class="deciphered-code"></div>
</body>
</html>

CSS:
body {
    font-family: 'Arial', sans-serif;
    background: url('https://png.pngtree.com/thumb_back/fh260/background/20230617/pngtree-halloween-wallpapers-and-backgrounds-for-laptop-or-desktop-image_2968567.jpg') no-repeat center center fixed;
    background-size: cover;
    color: red;
    text-align: center;
    padding-top: 50px;
    overflow: hidden;
}

.cipher-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
    cursor: pointer;
    width: 90%;
    margin: 0 auto;
}

.deciphered-code {
    margin-top: 30px;
    font-size: 3em;
    user-select: none;
}

JavaScript:
let trueNumbers = ["2", "8", "1", "0", "2", "0", "1", "8"];
let allNumbers = trueNumbers.concat(["3", "4", "5", "6", "7", "9", "3", "4", "5", "6", "7", "9"]);
allNumbers.sort(() => Math.random() - 0.5);

allNumbers.forEach(num => {
    let numberElement = document.createElement('div');
    numberElement.classList.add('cipher-number');
    numberElement.textContent = num;
    document.querySelector('.cipher-grid').appendChild(numberElement);
});

function selectNumber(event) {
    let selectedNumber = event.target.textContent;
    if (trueNumbers.includes(selectedNumber)) {
        document.querySelector('.deciphered-code').textContent += selectedNumber;
        trueNumbers = trueNumbers.filter(num => num !== selectedNumber);
    } else {
        document.querySelector('.deciphered-code').textContent = '';
        trueNumbers = ["2", "8", "1", "0", "2", "0", "1", "8"];
    }
}

Your tasks:

  1. Select the correct sequence of numbers from the grid. Picking an incorrect number will reset your progress.
  2. Decipher the spirits' code and complete your journey.
🔗 Useful Resource: W3Schools' JavaScript Array Methods might help you understand the spirits' cipher.
🔗 Platform Suggestion: Use CodePen to decrypt the spirits' cipher with JavaScript, HTML, and CSS.

Incredible! With a discerning eye, you've picked out the true sequence "28102018" from amidst the spectral distractions.

The spirits, impressed by your unwavering focus and determination, grant you the complete code. Brace yourself for tomorrow, when the vault's secrets will be yours to uncover. The climax of your journey in the Web Manor is near.
 
Last edited:
It accepts any combination of 1 of each of 0, 1, 2, and 8. I get feeling 2810 though is code.
Are we supposed to use previous numbers found or what? I have a with previous numbers try, should I show that? X E.
 
It accepts any combination of 1 of each of 0, 1, 2, and 8. I get feeling 2810 though is code.
Are we supposed to use previous numbers found or what? I have a with previous numbers try, should I show that? X E.
yes mate, so the numbers from the last challenge are random and in this challenge we make them into a code and your ever so close to the correct answer :D
 
Back
Top Bottom