import { useState, useEffect } from "react"; export default function HitlerOrKanyeGame() { // Game state const [gameStarted, setGameStarted] = useState(false); const [gameOver, setGameOver] = useState(false); const [currentQuoteIndex, setCurrentQuoteIndex] = useState(0); const [score, setScore] = useState(0); const [showAnswer, setShowAnswer] = useState(false); const [selectedAnswer, setSelectedAnswer] = useState(null); const [fadeIn, setFadeIn] = useState(true); // Quotes database const quotes = [ { text: "I am God's vessel. My greatest pain in life is that I will never be able to see myself perform live.", author: "Kanye", }, { text: "The victor will never be asked if he told the truth.", author: "Hitler", }, { text: "I am Warhol. I am the No. 1 most impactful artist of our generation. I am Shakespeare in the flesh.", author: "Kanye", }, { text: "If you tell a big enough lie and tell it frequently enough, it will be believed.", author: "Hitler", }, { text: "I feel like I'm too busy writing history to read it.", author: "Kanye", }, { text: "Great liars are also great magicians.", author: "Hitler", }, { text: "My greatest pain in life is that I will never be able to see myself perform live.", author: "Kanye", }, { text: "Words build bridges into unexplored regions.", author: "Hitler", }, { text: "I'm a creative genius and there's no other way to word it.", author: "Kanye", }, { text: "Strength lies not in defense but in attack.", author: "Hitler", }, ]; // Handle answer selection const handleAnswer = (answer) => { if (showAnswer) return; setSelectedAnswer(answer); setShowAnswer(true); if (answer === quotes[currentQuoteIndex].author) { setScore(score + 1); } // Delay before moving to next quote setTimeout(() => { setFadeIn(false); setTimeout(() => { if (currentQuoteIndex < quotes.length - 1) { setCurrentQuoteIndex(currentQuoteIndex + 1); setShowAnswer(false); setSelectedAnswer(null); } else { setGameOver(true); } setFadeIn(true); }, 300); }, 1500); }; // Start a new game const startNewGame = () => { setGameStarted(true); setGameOver(false); setCurrentQuoteIndex(0); setScore(0); setShowAnswer(false); setSelectedAnswer(null); setFadeIn(true); }; // Restart the game const restartGame = () => { startNewGame(); }; return (
Test your knowledge! Can you tell who said these controversial quotes? Was it Adolf Hitler or Kanye West?
{score === quotes.length ? "Perfect score! You're an expert!" : score >= quotes.length / 2 ? "Not bad! You know your quotes." : "Better luck next time!"}
"{quotes[currentQuoteIndex].text}"
Who said this?
{selectedAnswer === quotes[currentQuoteIndex].author ? "Correct!" : "Wrong!"}
This was said by {quotes[currentQuoteIndex].author}