79817251

Date: 2025-11-12 00:56:10
Score: 0.5
Natty:
Report link

<script>

    const output = document.getElementById('output');

    const userInput = document.getElementById('userInput');

    let gameState = 0;

    function print(text, type = 'narration') {

        const p = document.createElement('p');

        p.className = 'message ' + type;

        p.innerHTML = text;

        output.appendChild(p);

        // Hacer scroll hasta abajo para ver el nuevo texto

        output.scrollTop = output.scrollHeight;

    }

    function startGame() {

        print("Te despiertas en una habitación oscura. No recuerdas cómo llegaste aquí.");

        print("1. \*\*Levantarte\*\* y buscar un interruptor.", 'action');

        print("2. Quedarte \*\*quieto\*\* y escuchar.", 'action');

        gameState = 1;

    }

    function processInput() {

        const input = userInput.value.trim();

        userInput.value = ''; // Limpiar el input

        if (gameState === 1) {

            if (input === '1') {

                print("Te levantas. Tientas la pared hasta que tus dedos encuentran un interruptor frío.", 'narration');

                print("Una luz tenue ilumina una puerta de metal. El juego termina aquí por ahora.", 'narration');

                gameState = 99; // Final

            } else if (input === '2') {

                print("Permaneces quieto. Solo escuchas el latido de tu propio corazón y un goteo constante.", 'narration');

                print("Has perdido mucho tiempo. Fin de la demo.", 'narration');

                gameState = 99; // Final

            } else {

                print("Opción no válida. Escribe 1 o 2.", 'action');

            }

        }

        if (gameState === 0) {

             startGame();

        }

        if (gameState === 99) {

             print("--- FIN DE LA DEMO ---", 'narration');

        }

    }

    // Iniciar el juego al cargar la página

    startGame();

    

    // Permite presionar Enter para enviar la entrada

    userInput.addEventListener('keyup', function(event) {

        if (event.key === 'Enter') {

            processInput();

        }

    });

\</script\>
Reasons:
  • Blacklisted phrase (1): cómo
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Kristopher Pinto