Skip to content
The Chat Archive
claude-opus-4-20250514· Anthropic LMArena Human Preference 140K

napisz w HTML grę "familiada", gdzie będzie można dodać swoje pytania i odpowiedzi wraz…

  1. User

    napisz w HTML grę "familiada", gdzie będzie można dodać swoje pytania i odpowiedzi wraz z ilością punktów, które będą sumowane, tak jak w oryginalnej wersji familiady

  2. Assistant

    Oto kompletna gra Familiada w HTML z możliwością dodawania własnych pytań i odpowiedzi:

    <!DOCTYPE html>
    <html lang="pl">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Familiada</title>
        <style>
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
            }
    
            body {
                font-family: Arial, sans-serif;
                background: linear-gradient(135deg, #1e3c72, #2a5298);
                color: white;
                min-height: 100vh;
                padding: 20px;
            }
    
            .container {
                max-width: 1200px;
                margin: 0 auto;
            }
    
            h1 {
                text-align: center;
                font-size: 3em;
                margin-bottom: 30px;
                text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
            }
    
            .game-section, .admin-section {
                background: rgba(255,255,255,0.1);
                border-radius: 15px;
                padding: 30px;
                margin-bottom: 30px;
                backdrop-filter: blur(10px);
            }
    
            .question-display {
                font-size: 1.5em;
                text-align: center;
                margin-bottom: 30px;
                padding: 20px;
                background: rgba(255,255,255,0.2);
                border-radius: 10px;
            }
    
            .answers-board {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
                gap: 15px;
                margin-bottom: 30px;
            }
    
            .answer-slot {
                background: #333;
                padding: 20px;
                border-radius: 10px;
                text-align: center;
                font-size: 1.2em;
                min-height: 80px;
                display: flex;
                align-items: center;
                justify-content: center;
                position: relative;
                transition: all 0.3s ease;
            }
    
            .answer-slot.revealed {
                background: #4CAF50;
                transform: scale(1.05);
            }
    
            .answer-slot.wrong {
                background: #f44336;
                animation: shake 0.5s;
            }
    
            @keyframes shake {
                0%, 100% { transform: translateX(0); }
                25% { transform: translateX(-10px); }
                75% { transform: translateX(10px); }
            }
    
            .points {
                position: absolute;
                top: 5px;
                right: 10px;
                font-size: 0.8em;
                background: rgba(0,0,0,0.3);
                padding: 2px 8px;
                border-radius: 5px;
            }
    
            .score-board {
                display: flex;
                justify-content: space-around;
                margin-bottom: 30px;
            }
    
            .team-score {
                text-align: center;
                padding: 20px;
                background: rgba(255,255,255,0.2);
                border-radius: 10px;
                min-width: 150px;
            }
    
            .team-score h3 {
                margin-bottom: 10px;
            }
    
            .team-score .score {
                font-size: 2em;
                font-weight: bold;
            }
    
            .controls {
                display: flex;
                gap: 10px;
                justify-content: center;
                flex-wrap: wrap;
                margin-bottom: 20px;
            }
    
            button {
                background: #2196F3;
                color: white;
                border: none;
                padding: 12px 24px;
                border-radius: 5px;
                font-size: 1em;
                cursor: pointer;
                transition: background 0.3s;
            }
    
            button:hover {
                background: #1976D2;
            }
    
            button:disabled {
                background: #666;
                cursor: not-allowed;
            }
    
            input[type="text"], input[type="number"], select {
                padding: 10px;
                border-radius: 5px;
                border: none;
                font-size: 1em;
                margin: 5px;
                background: rgba(255,255,255,0.9);
                color: #333;
            }
    
            .answer-input-section {
                text-align: center;
                margin: 20px 0;
            }
    
            .answer-input-section input {
                width: 300px;
                max-width: 90%;
            }
    
            .admin-form {
                display: grid;
                gap: 15px;
            }
    
            .admin-form input, .admin-form button {
                width: 100%;
            }
    
            .answers-list {
                margin-top: 15px;
            }
    
            .answer-item {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 10px;
                background: rgba(255,255,255,0.1);
                margin: 5px 0;
                border-radius: 5px;
            }
    
            .wrong-answers {
                display: flex;
                justify-content: center;
                gap: 20px;
                margin: 20px 0;
                font-size: 3em;
            }
    
            .wrong-answer {
                color: #f44336;
                text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
            }
    
            .hidden {
                display: none;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <h1>FAMILIADA</h1>
    
            <div class="game-section">
                <div class="score-board">
                    <div class="team-score">
                        <h3>Drużyna 1</h3>
                        <div class="score" id="team1Score">0</div>
                    </div>
                    <div class="team-score">
                        <h3>Drużyna 2</h3>
                        <div class="score" id="team2Score">0</div>
                    </div>
                </div>
    
                <div class="question-display" id="questionDisplay">
                    Wybierz pytanie, aby rozpocząć grę
                </div>
    
                <div class="wrong-answers" id="wrongAnswers"></div>
    
                <div class="answers-board" id="answersBoard"></div>
    
                <div class="answer-input-section">
                    <input type="text" id="answerInput" placeholder="Wpisz odpowiedź..." disabled>
                    <button onclick="checkAnswer()" id="checkButton" disabled>Sprawdź</button>
                </div>
    
                <div class="controls">
                    <select id="questionSelect" onchange="loadQuestion()">
                        <option value="">Wybierz pytanie</option>
                    </select>
                    <button onclick="assignPoints(1)">Przyznaj punkty Drużynie 1</button>
                    <button onclick="assignPoints(2)">Przyznaj punkty Drużynie 2</button>
                    <button onclick="resetRound()">Nowa runda</button>
                    <button onclick="resetGame()">Resetuj grę</button>
                </div>
            </div>
    
            <div class="admin-section">
                <h2>Dodaj własne pytanie</h2>
                <div class="admin-form">
                    <input type="text" id="newQuestion" placeholder="Treść pytania">
                    <div id="newAnswers">
                        <div class="answer-item">
                            <input type="text" placeholder="Odpowiedź 1" class="new-answer-text">
                            <input type="number" placeholder="Punkty" class="new-answer-points" min="1" max="100">
                        </div>
                    </div>
                    <button onclick="addAnswerField()">Dodaj kolejną odpowiedź</button>
                    <button onclick="saveQuestion()">Zapisz pytanie</button>
                </div>
            </div>
        </div>
    
        <script>
            let questions = [
                {
                    question: "Co ludzie robią w wolnym czasie?",
                    answers: [
                        { text: "Oglądają telewizję", points: 25 },
                        { text: "Czytają książki", points: 20 },
                        { text: "Uprawiają sport", points: 18 },
                        { text: "Spotykają się ze znajomymi", points: 15 },
                        { text: "Śpią", points: 12 },
                        { text: "Grają w gry", points: 10 }
                    ]
                },
                {
                    question: "Co można znaleźć w kuchni?",
                    answers: [
                        { text: "Lodówka", points: 30 },
                        { text: "Kuchenka", points: 25 },
                        { text: "Garnki", points: 20 },
                        { text: "Talerze", points: 15 },
                        { text: "Sztućce", points: 10 }
                    ]
                }
            ];
    
            let currentQuestion = null;
            let revealedAnswers = [];
            let currentRoundPoints = 0;
            let wrongAnswersCount = 0;
            let team1Score = 0;
            let team2Score = 0;
    
            function initGame() {
                loadQuestions();
                updateScores();
            }
    
            function loadQuestions() {
                const select = document.getElementById('questionSelect');
                select.innerHTML = '<option value="">Wybierz pytanie</option>';
                questions.forEach((q, index) => {
                    const option = document.createElement('option');
                    option.value = index;
                    option.textContent = q.question;
                    select.appendChild(option);
                });
            }
    
            function loadQuestion() {
                const select = document.getElementById('questionSelect');
                const index = select.value;
                
                if (index === '') return;
                
                currentQuestion = questions[index];
                revealedAnswers = [];
                currentRoundPoints = 0;
                wrongAnswersCount = 0;
                
                document.getElementById('questionDisplay').textContent = currentQuestion.question;
                document.getElementById('answerInput').disabled = false;
                document.getElementById('checkButton').disabled = false;
                document.getElementById('wrongAnswers').innerHTML = '';
                
                displayAnswers();
            }
    
            function displayAnswers() {
                const board = document.getElementById('answersBoard');
                board.innerHTML = '';
                
                currentQuestion.answers.forEach((answer, index) => {
                    const slot = document.createElement('div');
                    slot.className = 'answer-slot';
                    slot.id = `answer-${index}`;
                    
                    if (revealedAnswers.includes(index)) {
                        slot.classList.add('revealed');
                        slot.innerHTML = `
                            ${answer.text}
                            <span class="points">${answer.points} pkt</span>
                        `;
                    } else {
                        slot.textContent = `${index + 1}`;
                    }
                    
                    board.appendChild(slot);
                });
            }
    
            function checkAnswer() {
                const input = document.getElementById('answerInput');
                const answer = input.value.trim().toLowerCase();
                
                if (!answer) return;
                
                let found = false;
                
                currentQuestion.answers.forEach((ans, index) => {
                    if (ans.text.toLowerCase().includes(answer) && !revealedAnswers.includes(index)) {
                        revealedAnswers.push(index);
                        currentRoundPoints += ans.points;
                        found = true;
                        
                        const slot = document.getElementById(`answer-${index}`);
                        slot.classList.add('revealed');
                        slot.innerHTML = `
                            ${ans.text}
                            <span class="points">${ans.points} pkt</span>
                        `;
                    }
                });
                
                if (!found) {
                    wrongAnswersCount++;
                    updateWrongAnswers();
                    
                    // Animacja błędnej odpowiedzi
                    const slots = document.querySelectorAll('.answer-slot:not(.revealed)');
                    slots.forEach(slot => {
                        slot.classList.add('wrong');
                        setTimeout(() => slot.classList.remove('wrong'), 500);
                    });
                }
                
                input.value = '';
                
                if (revealedAnswers.length === currentQuestion.answers.length) {
                    alert('Wszystkie odpowiedzi odkryte! Przyznaj punkty jednej z drużyn.');
                }
            }
    
            function updateWrongAnswers() {
                const container = document.getElementById('wrongAnswers');
                container.innerHTML = '';
                
                for (let i = 0; i < wrongAnswersCount && i < 3; i++) {
                    const x = document.createElement('span');
                    x.className = 'wrong-answer';
                    x.textContent = 'X';
                    container.appendChild(x);
                }
            }
    
            function assignPoints(team) {
                if (team === 1) {
                    team1Score += currentRoundPoints;
                } else {
                    team2Score += currentRoundPoints;
                }
                updateScores();
                alert(`Drużyna ${team} otrzymuje ${currentRoundPoints} punktów!`);
            }
    
            function updateScores() {
                document.getElementById('team1Score').textContent = team1Score;
                document.getElementById('team2Score').textContent = team2Score;
            }
    
            function resetRound() {
                currentQuestion = null;
                revealedAnswers = [];
                currentRoundPoints = 0;
                wrongAnswersCount = 0;
                document.getElementById('questionSelect').value = '';
                document.getElementById('questionDisplay').textContent = 'Wybierz pytanie, aby rozpocząć grę';
                document.getElementById('answersBoard').innerHTML = '';
                document.getElementById('wrongAnswers').innerHTML = '';
                document.getElementById('answerInput').disabled = true;
                document.getElementById('checkButton').disabled = true;
            }
    
            function resetGame() {
                team1Score = 0;
                team2Score = 0;
                updateScores();
                resetRound();
            }
    
            function addAnswerField() {
                const container = document.getElementById('newAnswers');
                const div = document.createElement('div');
                div.className = 'answer-item';
                div.innerHTML = `
                    <input type="text" placeholder="Odpowiedź" class="new-answer-text">
                    <input type="number" placeholder="Punkty" class="new-answer-points" min="1" max="100">
                `;
                container.appendChild(div);
            }
    
            function saveQuestion() {
                const questionText = document.getElementById('newQuestion').value.trim();
                const answerInputs = document.querySelectorAll('.new-answer-text');
                const pointInputs = document.querySelectorAll('.new-answer-points');
                
                if (!questionText) {
                    alert('Wprowadź treść pytania!');
                    return;
                }
                
                const answers = [];
                for (let i = 0; i < answerInputs.length; i++) {
                    const text = answerInputs[i].value.trim();
                    const points = parseInt(pointInputs[i].value);
                    
                    if (text && points) {
                        answers.push({ text, points });
                    }
                }
                
                if (answers.length < 2) {
                    alert('Dodaj przynajmniej 2 odpowiedzi!');
    

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.