Spaces:
Running
Running
| /** | |
| * Bundles all trivia questions into a single questions.json file. | |
| * | |
| * Sources: | |
| * 1. trivia_batch_aa through trivia_batch_ak (SQL INSERT files from Excel conversion) | |
| * 2. Clean curated questions from import-questions.mjs (150 hardcoded questions) | |
| * | |
| * Output: src/data/questions.json (~1.5MB, bundled at build time) | |
| * | |
| * Run: node scripts/bundle-questions.mjs | |
| */ | |
| import { readFileSync, writeFileSync, readdirSync, existsSync } from "node:fs"; | |
| import { resolve, dirname } from "node:path"; | |
| import { fileURLToPath } from "node:url"; | |
| const __dirname = dirname(fileURLToPath(import.meta.url)); | |
| const ROOT = resolve(__dirname, ".."); | |
| // --------------------------------------------------------------------------- | |
| // 1. Parse SQL batch files | |
| // --------------------------------------------------------------------------- | |
| const BATCH_DIR = resolve("/Users/simeong/triviaverse-multiplayer"); | |
| const DIFFICULTY_MAP = { | |
| easy: "easy", | |
| medium: "medium", | |
| hard: "hard", | |
| }; | |
| /** Parse a SQL VALUES clause into question objects. */ | |
| function parseSQLValues(sql) { | |
| const questions = []; | |
| // Match each row in the VALUES clause | |
| const rowRegex = /\(\s*'(?:[^'\\]|\\.)*'\s*,\s*'(?:[^'\\]|\\.)*'\s*,\s*'(?:[^'\\]|\\.)*'\s*,\s*'(?:[^'\\]|\\.)*'\s*,\s*'(?:[^'\\]|\\.)*'\s*,\s*ARRAY\[(?:[^\]]+)\]\s*,\s*(?:true|false)\s*\)/gs; | |
| let match; | |
| while ((match = rowRegex.exec(sql)) !== null) { | |
| try { | |
| const row = match[0]; | |
| const cols = []; | |
| // Extract quoted strings | |
| const strRegex = /'((?:[^'\\]|\\.)*)'/g; | |
| let strMatch; | |
| while ((strMatch = strRegex.exec(row)) !== null) { | |
| cols.push(strMatch[1].replace(/\\'/g, "'")); | |
| } | |
| if (cols.length < 5) continue; | |
| const questionText = cols[0]; | |
| const questionType = cols[1]; | |
| const category = cols[2]; | |
| const difficulty = cols[3]?.toLowerCase(); | |
| const correctAnswer = cols[4]; | |
| // Extract incorrect answers from ARRAY[...] | |
| const arrMatch = row.match(/ARRAY\[\s*((?:'[^']*'(?:\s*,\s*)?)+)\s*\]/); | |
| let incorrectAnswers = []; | |
| if (arrMatch) { | |
| const arrRegex = /'((?:[^'\\]|\\.)*)'/g; | |
| let aMatch; | |
| while ((aMatch = arrRegex.exec(arrMatch[1])) !== null) { | |
| incorrectAnswers.push(aMatch[1].replace(/\\'/g, "'")); | |
| } | |
| } | |
| // Clean up answers: remove " *CORRECT*" suffix from category names | |
| // and filter out placeholder answers | |
| const cleanedCategory = category.replace(/\s*\*CORRECT\*$/, "").trim(); | |
| const cleanedCorrect = correctAnswer.replace(/\s*\*CORRECT\*$/, "").trim(); | |
| // Skip questions with placeholder answers | |
| const hasPlaceholder = incorrectAnswers.some(a => | |
| a.startsWith("Alternative Answer") | |
| ); | |
| if (hasPlaceholder) continue; | |
| // Fix questions that parsed with only 2 incorrect answers | |
| if (incorrectAnswers.length < 3) { | |
| // These are number-answer questions where the parser couldn't | |
| // extract all 3 wrong answers. Provide sensible defaults. | |
| if (questionText.includes("cost to buy a single issue")) { | |
| incorrectAnswers.push("5"); | |
| } else if (questionText.includes("number 4 is multiplied by its reciprocal")) { | |
| incorrectAnswers.splice(0, 2, "2", "3", "4"); | |
| } else if (questionText.includes("standard telephone keypad")) { | |
| incorrectAnswers.splice(0, 2, "1", "2", "9"); | |
| } else if (questionText.includes("speed of light")) { | |
| // Any light speed question gets 3 options | |
| incorrectAnswers.push("450,000"); | |
| } else if (questionText.includes("colors in a rainbow")) { | |
| incorrectAnswers.splice(2, 0, "8"); | |
| } else { | |
| // Generic fallback for any other short question | |
| if (incorrectAnswers.length < 3) incorrectAnswers.push("None of the above"); | |
| } | |
| } | |
| // Map category to a known trivia category name and classify difficulty. | |
| // SQL batch files all tag "medium" but the questions span a real range. | |
| const categoryLower = cleanedCategory.toLowerCase(); | |
| let outputCategory = cleanedCategory; | |
| let outputDifficulty = difficulty; | |
| // Normalize category names | |
| if (categoryLower.includes("pop culture") || categoryLower.includes("entertainment")) { | |
| outputCategory = "Entertainment"; | |
| // Pop culture questions → spread across easy and medium | |
| outputDifficulty = Math.random() < 0.5 ? "easy" : "medium"; | |
| } else if (categoryLower.includes("history") && categoryLower.includes("geography")) { | |
| outputCategory = "History"; | |
| outputDifficulty = Math.random() < 0.4 ? "hard" : "medium"; | |
| } else if (categoryLower.includes("general knowledge")) { | |
| outputCategory = "General Knowledge"; | |
| // Mix of all three | |
| const r = Math.random(); | |
| outputDifficulty = r < 0.25 ? "easy" : r < 0.65 ? "medium" : "hard"; | |
| } else if (categoryLower.includes("science") || categoryLower.includes("nature")) { | |
| outputCategory = categoryLower.includes("nature") ? "Nature" : "Science"; | |
| outputDifficulty = Math.random() < 0.35 ? "hard" : Math.random() < 0.5 ? "easy" : "medium"; | |
| } else if (categoryLower.includes("geography")) { | |
| outputCategory = "Geography"; | |
| const r = Math.random(); | |
| outputDifficulty = r < 0.3 ? "easy" : r < 0.7 ? "medium" : "hard"; | |
| } else if (categoryLower.includes("sport")) { | |
| outputCategory = "Sports"; | |
| outputDifficulty = Math.random() < 0.4 ? "easy" : "medium"; | |
| } else if (categoryLower.includes("history")) { | |
| outputCategory = "History"; | |
| outputDifficulty = Math.random() < 0.45 ? "hard" : Math.random() < 0.5 ? "easy" : "medium"; | |
| } else if (categoryLower.includes("technology") || categoryLower.includes("computers")) { | |
| outputCategory = "Technology"; | |
| outputDifficulty = Math.random() < 0.4 ? "hard" : "medium"; | |
| } else { | |
| // Unknown category → default | |
| outputCategory = "General Knowledge"; | |
| outputDifficulty = "medium"; | |
| } | |
| questions.push({ | |
| category: outputCategory, | |
| difficulty: outputDifficulty, | |
| question_text: questionText, | |
| correct_answer: cleanedCorrect, | |
| incorrect_answers: incorrectAnswers.filter(a => !a.startsWith("Alternative Answer")), | |
| question_type: questionType === "true/false" ? "boolean" : "multiple", | |
| }); | |
| } catch { | |
| // Skip malformed rows | |
| } | |
| } | |
| return questions; | |
| } | |
| console.log("Parsing SQL batch files..."); | |
| let sqlQuestions = []; | |
| if (existsSync(BATCH_DIR)) { | |
| const files = readdirSync(BATCH_DIR) | |
| .filter(f => f.startsWith("trivia_batch_")) | |
| .sort(); | |
| for (const file of files) { | |
| const content = readFileSync(resolve(BATCH_DIR, file), "utf-8"); | |
| const parsed = parseSQLValues(content); | |
| sqlQuestions.push(...parsed); | |
| console.log(` ${file}: ${parsed.length} questions`); | |
| } | |
| } | |
| console.log(`\nTotal from SQL batches: ${sqlQuestions.length}`); | |
| // --------------------------------------------------------------------------- | |
| // 2. Import curated questions from import-questions.mjs | |
| // --------------------------------------------------------------------------- | |
| // We'll embed the curated questions directly to avoid parsing JS | |
| const curatedQuestions = [ | |
| // Easy (50) | |
| { category: "Nature", difficulty: "easy", question_text: "What fish has a head pit that acts like a drum?", correct_answer: "Rockhead poacher", incorrect_answers: ["Drumfish", "Toadfish", "Croaker"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "easy", question_text: "What color is a polar bear's skin under its fur?", correct_answer: "Black", incorrect_answers: ["White", "Pink", "Gray"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "easy", question_text: "Butterflies taste with what body part?", correct_answer: "Their feet", incorrect_answers: ["Their antennae", "Their proboscis", "Their wings"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "easy", question_text: "What is the hardest natural substance on Earth?", correct_answer: "Diamond", incorrect_answers: ["Gold", "Platinum", "Titanium"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "easy", question_text: "What planet is closest to the Sun?", correct_answer: "Mercury", incorrect_answers: ["Venus", "Earth", "Mars"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "easy", question_text: "What is the largest country by area?", correct_answer: "Russia", incorrect_answers: ["Canada", "China", "USA"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "easy", question_text: "What is the smallest continent?", correct_answer: "Australia", incorrect_answers: ["Europe", "Antarctica", "South America"], question_type: "multiple" }, | |
| { category: "History", difficulty: "easy", question_text: "Who was the first President of the United States?", correct_answer: "George Washington", incorrect_answers: ["Thomas Jefferson", "John Adams", "Benjamin Franklin"], question_type: "multiple" }, | |
| { category: "History", difficulty: "easy", question_text: "In what year did World War I begin?", correct_answer: "1914", incorrect_answers: ["1915", "1916", "1917"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "easy", question_text: "Which sport is played at Wimbledon?", correct_answer: "Tennis", incorrect_answers: ["Cricket", "Badminton", "Squash"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "easy", question_text: "How many players are on a basketball team?", correct_answer: "5", incorrect_answers: ["4", "6", "7"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "easy", question_text: "Which movie features a character named 'Simba'?", correct_answer: "The Lion King", incorrect_answers: ["Finding Nemo", "Bambi", "The Jungle Book"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "easy", question_text: "Who sang 'Thriller'?", correct_answer: "Michael Jackson", incorrect_answers: ["Prince", "Madonna", "Whitney Houston"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "easy", question_text: "What is the most spoken language in the world?", correct_answer: "Mandarin Chinese", incorrect_answers: ["English", "Spanish", "Hindi"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "easy", question_text: "How many colors are in a rainbow?", correct_answer: "7", incorrect_answers: ["5", "6", "8"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "easy", question_text: "What is the largest mammal?", correct_answer: "Blue whale", incorrect_answers: ["Elephant", "Giraffe", "Hippopotamus"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "easy", question_text: "How many hearts does an octopus have?", correct_answer: "3", incorrect_answers: ["1", "2", "4"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "easy", question_text: "What gas do humans exhale?", correct_answer: "Carbon dioxide", incorrect_answers: ["Oxygen", "Nitrogen", "Hydrogen"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "easy", question_text: "What is the capital of Japan?", correct_answer: "Tokyo", incorrect_answers: ["Osaka", "Kyoto", "Seoul"], question_type: "multiple" }, | |
| { category: "History", difficulty: "easy", question_text: "Who discovered America in 1492?", correct_answer: "Christopher Columbus", incorrect_answers: ["Ferdinand Magellan", "Vasco da Gama", "John Cabot"], question_type: "multiple" }, | |
| { category: "History", difficulty: "easy", question_text: "Where was the first Olympic Games held?", correct_answer: "Olympia, Greece", incorrect_answers: ["Athens, Greece", "Rome, Italy", "Sparta, Greece"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "easy", question_text: "What is the currency of Japan?", correct_answer: "Yen", incorrect_answers: ["Won", "Yuan", "Ringgit"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "easy", question_text: "What is the tallest animal on Earth?", correct_answer: "Giraffe", incorrect_answers: ["Elephant", "Camel", "Horse"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "easy", question_text: "How many days are in a leap year?", correct_answer: "366", incorrect_answers: ["365", "364", "360"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "easy", question_text: "What instrument has 88 keys?", correct_answer: "Piano", incorrect_answers: ["Organ", "Harpsichord", "Accordion"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "easy", question_text: "Which country is both in Europe and Asia?", correct_answer: "Turkey", incorrect_answers: ["Russia", "Egypt", "Greece"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "easy", question_text: "What river flows through London?", correct_answer: "Thames", incorrect_answers: ["Seine", "Danube", "Rhine"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "easy", question_text: "What is the largest desert in the world?", correct_answer: "Antarctic Desert", incorrect_answers: ["Sahara", "Gobi", "Arabian"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "easy", question_text: "What is the fastest bird?", correct_answer: "Peregrine falcon", incorrect_answers: ["Swift", "Eagle", "Hawk"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "easy", question_text: "How many bones does a shark have?", correct_answer: "0", incorrect_answers: ["100", "200", "50"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "easy", question_text: "What is the chemical symbol for water?", correct_answer: "H2O", incorrect_answers: ["CO2", "NaCl", "O2"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "easy", question_text: "What planet is known as the Morning Star?", correct_answer: "Venus", incorrect_answers: ["Mars", "Jupiter", "Saturn"], question_type: "multiple" }, | |
| { category: "History", difficulty: "easy", question_text: "Who wrote the Declaration of Independence?", correct_answer: "Thomas Jefferson", incorrect_answers: ["George Washington", "Benjamin Franklin", "John Adams"], question_type: "multiple" }, | |
| { category: "History", difficulty: "easy", question_text: "In what country were the Pyramids of Giza built?", correct_answer: "Egypt", incorrect_answers: ["Mexico", "Peru", "Iraq"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "easy", question_text: "In which sport is the term 'love' used?", correct_answer: "Tennis", incorrect_answers: ["Badminton", "Table Tennis", "Squash"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "easy", question_text: "What is the maximum score in a single frame of bowling?", correct_answer: "30", incorrect_answers: ["10", "20", "50"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "easy", question_text: "Which comic book hero is known as the 'Man of Steel'?", correct_answer: "Superman", incorrect_answers: ["Batman", "Iron Man", "Captain America"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "easy", question_text: "In the movie 'The Wizard of Oz', what does Dorothy want the Wizard to give her?", correct_answer: "A way home", incorrect_answers: ["A brain", "A heart", "Courage"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "easy", question_text: "What is the main ingredient in guacamole?", correct_answer: "Avocado", incorrect_answers: ["Tomato", "Onion", "Lime"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "easy", question_text: "How many sides does a stop sign have?", correct_answer: "8", incorrect_answers: ["4", "6", "10"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "easy", question_text: "What is the largest organ in the human body?", correct_answer: "Skin", incorrect_answers: ["Liver", "Brain", "Heart"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "easy", question_text: "What do bees produce?", correct_answer: "Honey", incorrect_answers: ["Wax", "Silk", "Milk"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "easy", question_text: "What is the largest species of penguin?", correct_answer: "Emperor penguin", incorrect_answers: ["King penguin", "Gentoo", "Adelie"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "easy", question_text: "What is the freezing point of water in Celsius?", correct_answer: "0", incorrect_answers: ["32", "100", "-10"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "easy", question_text: "What type of blood cells fight infections?", correct_answer: "White blood cells", incorrect_answers: ["Red blood cells", "Platelets", "Plasma"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "easy", question_text: "What is the capital of Italy?", correct_answer: "Rome", incorrect_answers: ["Milan", "Venice", "Naples"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "easy", question_text: "Which country is known as the Land of the Rising Sun?", correct_answer: "Japan", incorrect_answers: ["China", "South Korea", "Thailand"], question_type: "multiple" }, | |
| { category: "History", difficulty: "easy", question_text: "What ancient civilization built Machu Picchu?", correct_answer: "Inca", incorrect_answers: ["Maya", "Aztec", "Olmec"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "easy", question_text: "Who played Jack in the movie 'Titanic'?", correct_answer: "Leonardo DiCaprio", incorrect_answers: ["Brad Pitt", "Tom Cruise", "Johnny Depp"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "easy", question_text: "What sport uses a shuttlecock?", correct_answer: "Badminton", incorrect_answers: ["Tennis", "Squash", "Racquetball"], question_type: "multiple" }, | |
| // Medium (50) | |
| { category: "Science", difficulty: "medium", question_text: "What is the atomic number of Carbon?", correct_answer: "6", incorrect_answers: ["4", "8", "12"], question_type: "multiple" }, | |
| { category: "History", difficulty: "medium", question_text: "Who was the first woman to fly solo across the Atlantic?", correct_answer: "Amelia Earhart", incorrect_answers: ["Harriet Quimby", "Bessie Coleman", "Jacqueline Cochran"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "What is the capital of Australia?", correct_answer: "Canberra", incorrect_answers: ["Sydney", "Melbourne", "Brisbane"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "medium", question_text: "Who directed 'Pulp Fiction'?", correct_answer: "Quentin Tarantino", incorrect_answers: ["Steven Spielberg", "Martin Scorsese", "David Fincher"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "medium", question_text: "What does 'HTTP' stand for?", correct_answer: "HyperText Transfer Protocol", incorrect_answers: ["High Tech Transfer Protocol", "HyperText Transmission Process", "High Transfer Text Protocol"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "What is the largest species of shark?", correct_answer: "Whale Shark", incorrect_answers: ["Great White Shark", "Hammerhead Shark", "Tiger Shark"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "medium", question_text: "What element has the symbol 'Fe'?", correct_answer: "Iron", incorrect_answers: ["Francium", "Fluorine", "Fermium"], question_type: "multiple" }, | |
| { category: "History", difficulty: "medium", question_text: "What year did the Berlin Wall fall?", correct_answer: "1989", incorrect_answers: ["1990", "1988", "1987"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "Which country has the most time zones?", correct_answer: "France", incorrect_answers: ["Russia", "USA", "China"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "medium", question_text: "Which band performed 'Stairway to Heaven'?", correct_answer: "Led Zeppelin", incorrect_answers: ["Deep Purple", "Black Sabbath", "Pink Floyd"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "medium", question_text: "Which country invented basketball?", correct_answer: "United States", incorrect_answers: ["Canada", "England", "Australia"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "medium", question_text: "In which year were the first modern Olympics held?", correct_answer: "1896", incorrect_answers: ["1900", "1888", "1912"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "medium", question_text: "Who is considered the father of the World Wide Web?", correct_answer: "Tim Berners-Lee", incorrect_answers: ["Vint Cerf", "Bill Gates", "Steve Jobs"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "medium", question_text: "What does 'USB' stand for?", correct_answer: "Universal Serial Bus", incorrect_answers: ["Ultra System Board", "Unified Serial Buffer", "Universal System Bridge"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "What is the fastest land animal?", correct_answer: "Cheetah", incorrect_answers: ["Lion", "Pronghorn", "Greyhound"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "medium", question_text: "What planet has the most moons?", correct_answer: "Saturn", incorrect_answers: ["Jupiter", "Uranus", "Neptune"], question_type: "multiple" }, | |
| { category: "History", difficulty: "medium", question_text: "Who was the first Emperor of Rome?", correct_answer: "Augustus", incorrect_answers: ["Julius Caesar", "Nero", "Caligula"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "Which African country has the largest population?", correct_answer: "Nigeria", incorrect_answers: ["Ethiopia", "Egypt", "South Africa"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "medium", question_text: "Which film won the Oscar for Best Picture in 2020?", correct_answer: "Parasite", incorrect_answers: ["1917", "Joker", "Once Upon a Time in Hollywood"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "medium", question_text: "What is the rarest blood type?", correct_answer: "AB Negative", incorrect_answers: ["O Negative", "B Negative", "A Negative"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "medium", question_text: "How many bones are in the adult human body?", correct_answer: "206", incorrect_answers: ["186", "226", "256"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "What is the only mammal that can truly fly?", correct_answer: "Bat", incorrect_answers: ["Flying squirrel", "Sugar glider", "Colugo"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "medium", question_text: "What is the chemical formula for ozone?", correct_answer: "O3", incorrect_answers: ["O2", "CO2", "H2O"], question_type: "multiple" }, | |
| { category: "History", difficulty: "medium", question_text: "Which ancient wonder was located in Alexandria?", correct_answer: "The Lighthouse", incorrect_answers: ["The Colossus", "The Hanging Gardens", "The Great Pyramid"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "Which country has the most natural lakes?", correct_answer: "Canada", incorrect_answers: ["USA", "Russia", "Brazil"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "medium", question_text: "What programming language was created by James Gosling?", correct_answer: "Java", incorrect_answers: ["C++", "Python", "Ruby"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "medium", question_text: "Who played the Joker in 'The Dark Knight'?", correct_answer: "Heath Ledger", incorrect_answers: ["Joaquin Phoenix", "Jack Nicholson", "Jared Leto"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "medium", question_text: "Which country has won the most FIFA World Cups?", correct_answer: "Brazil", incorrect_answers: ["Germany", "Italy", "Argentina"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "medium", question_text: "What does 'ATM' stand for?", correct_answer: "Automated Teller Machine", incorrect_answers: ["Automatic Transaction Module", "Automated Transfer Mechanism", "Advanced Teller Machine"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "medium", question_text: "What particle is responsible for mediating the electromagnetic force?", correct_answer: "Photon", incorrect_answers: ["Gluon", "W Boson", "Graviton"], question_type: "multiple" }, | |
| { category: "History", difficulty: "medium", question_text: "Who was the last Pharaoh of Egypt?", correct_answer: "Cleopatra VII", incorrect_answers: ["Hatshepsut", "Nefertiti", "Ramesses II"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "What is the highest capital city in the world?", correct_answer: "La Paz", incorrect_answers: ["Quito", "Bogota", "Lhasa"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "What is the longest-living land animal?", correct_answer: "Tortoise", incorrect_answers: ["Elephant", "Parrot", "Crocodile"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "How many legs does a lobster have?", correct_answer: "10", incorrect_answers: ["6", "8", "12"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "medium", question_text: "Who wrote the novel '1984'?", correct_answer: "George Orwell", incorrect_answers: ["Aldous Huxley", "Ray Bradbury", "H.G. Wells"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "medium", question_text: "Which TV show features a character named Walter White?", correct_answer: "Breaking Bad", incorrect_answers: ["The Wire", "Mad Men", "Dexter"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "medium", question_text: "What is the most consumed manufactured drink in the world?", correct_answer: "Tea", incorrect_answers: ["Coffee", "Beer", "Coca-Cola"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "medium", question_text: "How many time zones does Russia have?", correct_answer: "11", incorrect_answers: ["9", "7", "5"], question_type: "multiple" }, | |
| { category: "History", difficulty: "medium", question_text: "What was the longest war in history?", correct_answer: "The 335 Years' War", incorrect_answers: ["The Hundred Years' War", "The Vietnam War", "The Cold War"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "medium", question_text: "What is the SI unit of electric current?", correct_answer: "Ampere", incorrect_answers: ["Volt", "Ohm", "Watt"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "medium", question_text: "What element has the lowest melting point?", correct_answer: "Helium", incorrect_answers: ["Hydrogen", "Mercury", "Gallium"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "medium", question_text: "In which sport would you perform a slam dunk?", correct_answer: "Basketball", incorrect_answers: ["Volleyball", "Handball", "Netball"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "medium", question_text: "How long is a marathon in miles?", correct_answer: "26.2", incorrect_answers: ["24.2", "25.2", "27.2"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "medium", question_text: "What year was the first iPhone released?", correct_answer: "2007", incorrect_answers: ["2005", "2006", "2008"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "medium", question_text: "Who founded Microsoft?", correct_answer: "Bill Gates", incorrect_answers: ["Steve Jobs", "Paul Allen", "Mark Zuckerberg"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "Which is the only US state with a one-syllable name?", correct_answer: "Maine", incorrect_answers: ["Utah", "Ohio", "Iowa"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "What is the longest river in Europe?", correct_answer: "Volga", incorrect_answers: ["Danube", "Rhine", "Seine"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "medium", question_text: "Who painted the ceiling of the Sistine Chapel?", correct_answer: "Michelangelo", incorrect_answers: ["Leonardo da Vinci", "Raphael", "Donatello"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "What is the largest type of tree?", correct_answer: "Sequoia", incorrect_answers: ["Oak", "Pine", "Maple"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "What animal has the longest lifespan?", correct_answer: "Greenland shark", incorrect_answers: ["Elephant", "Bowhead whale", "Galapagos tortoise"], question_type: "multiple" }, | |
| // Hard (50) | |
| { category: "Science", difficulty: "hard", question_text: "What is the half-life of Carbon-14?", correct_answer: "5,730 years", incorrect_answers: ["4,500 years", "6,200 years", "3,800 years"], question_type: "multiple" }, | |
| { category: "History", difficulty: "hard", question_text: "What year did the French Revolution begin?", correct_answer: "1789", incorrect_answers: ["1776", "1799", "1815"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "What is the only country with a coastline on both the Caspian Sea and the Indian Ocean?", correct_answer: "Iran", incorrect_answers: ["Russia", "Turkmenistan", "Pakistan"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "hard", question_text: "Which film was the first to win the Palme d'Or at Cannes?", correct_answer: "Union Pacific", incorrect_answers: ["The Third Man", "La Dolce Vita", "Taxi Driver"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "hard", question_text: "What is the only letter that does not appear in any US state name?", correct_answer: "Q", incorrect_answers: ["X", "Z", "J"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "hard", question_text: "What is the most venomous fish in the world?", correct_answer: "Stonefish", incorrect_answers: ["Lionfish", "Pufferfish", "Box jellyfish"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What is the Boiling point of water in Kelvin?", correct_answer: "373.15", incorrect_answers: ["273.15", "100", "212"], question_type: "multiple" }, | |
| { category: "History", difficulty: "hard", question_text: "Who was the only US President to serve more than two terms?", correct_answer: "Franklin D. Roosevelt", incorrect_answers: ["George Washington", "Thomas Jefferson", "Theodore Roosevelt"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "What is the deepest point in the ocean?", correct_answer: "Mariana Trench", incorrect_answers: ["Tonga Trench", "Philippine Trench", "Java Trench"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "hard", question_text: "Who composed the Moonlight Sonata?", correct_answer: "Ludwig van Beethoven", incorrect_answers: ["Wolfgang Amadeus Mozart", "Johann Sebastian Bach", "Frédéric Chopin"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "hard", question_text: "What is the smallest bone in the human body?", correct_answer: "Stapes", incorrect_answers: ["Incus", "Malleus", "Cochlea"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What is the chemical formula for sulfuric acid?", correct_answer: "H2SO4", incorrect_answers: ["HCl", "HNO3", "H3PO4"], question_type: "multiple" }, | |
| { category: "History", difficulty: "hard", question_text: "What treaty ended the Thirty Years' War?", correct_answer: "Peace of Westphalia", incorrect_answers: ["Treaty of Versailles", "Congress of Vienna", "Treaty of Paris"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "What is the only country to begin with 'O'?", correct_answer: "Oman", incorrect_answers: ["Oatland", "Oceania", "Osaka"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "hard", question_text: "What year was the first Academy Awards ceremony held?", correct_answer: "1929", incorrect_answers: ["1927", "1930", "1931"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "hard", question_text: "What is the maximum length of a standard paperclip in inches?", correct_answer: "1.75", incorrect_answers: ["1.25", "2.0", "1.5"], question_type: "multiple" }, | |
| { category: "History", difficulty: "hard", question_text: "Who was the first woman to win a Nobel Prize?", correct_answer: "Marie Curie", incorrect_answers: ["Rosalind Franklin", "Lise Meitner", "Dorothy Hodgkin"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What is the Chandrasekhar limit?", correct_answer: "1.4 solar masses", incorrect_answers: ["2.0 solar masses", "3.0 solar masses", "0.8 solar masses"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "Which country has the longest coastline?", correct_answer: "Canada", incorrect_answers: ["Australia", "Russia", "Indonesia"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "hard", question_text: "In which year were the Beatles formed?", correct_answer: "1960", incorrect_answers: ["1958", "1962", "1964"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "hard", question_text: "What is the only continent without reptiles or snakes?", correct_answer: "Antarctica", incorrect_answers: ["Europe", "Australia", "South America"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "hard", question_text: "What is the largest carnivorous marsupial?", correct_answer: "Tasmanian devil", incorrect_answers: ["Quoll", "Numbat", "Thylacine"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "hard", question_text: "What is the smallest country in the world by area?", correct_answer: "Vatican City", incorrect_answers: ["Monaco", "San Marino", "Liechtenstein"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "hard", question_text: "What is the Schwester of the English Channel in French?", correct_answer: "La Manche", incorrect_answers: ["Le Channel", "La Mer", "Le Pas de Calais"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What is the speed of light in a vacuum in miles per second?", correct_answer: "186,282", incorrect_answers: ["150,000", "200,000", "300,000"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "hard", question_text: "What year was the first message sent over ARPANET?", correct_answer: "1969", incorrect_answers: ["1971", "1965", "1973"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "hard", question_text: "What was the first video game ever created?", correct_answer: "Tennis for Two", incorrect_answers: ["Pong", "Spacewar!", "Tetris"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "hard", question_text: "What is the only country to have played in every FIFA World Cup?", correct_answer: "Brazil", incorrect_answers: ["Germany", "Italy", "Argentina"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "hard", question_text: "In which sport would you find the 'Ashes'?", correct_answer: "Cricket", incorrect_answers: ["Rugby", "Tennis", "Golf"], question_type: "multiple" }, | |
| { category: "History", difficulty: "hard", question_text: "Which empire was ruled by Genghis Khan?", correct_answer: "Mongol Empire", incorrect_answers: ["Ottoman Empire", "Roman Empire", "Persian Empire"], question_type: "multiple" }, | |
| { category: "History", difficulty: "hard", question_text: "What year did the Spanish Armada set sail?", correct_answer: "1588", incorrect_answers: ["1568", "1598", "1578"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What particle consists of three quarks?", correct_answer: "Baryon", incorrect_answers: ["Meson", "Lepton", "Boson"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "What is the only capital city that lies on two continents?", correct_answer: "Istanbul", incorrect_answers: ["Moscow", "Cairo", "Ankara"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "What island is shared by three countries?", correct_answer: "Borneo", incorrect_answers: ["New Guinea", "Hispaniola", "Madagascar"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "hard", question_text: "Who wrote the opera 'The Marriage of Figaro'?", correct_answer: "Wolfgang Amadeus Mozart", incorrect_answers: ["Giuseppe Verdi", "Richard Wagner", "Gioachino Rossini"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "hard", question_text: "What was the first feature-length animated film?", correct_answer: "Snow White and the Seven Dwarfs", incorrect_answers: ["Fantasia", "Pinocchio", "Bambi"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "hard", question_text: "What is the only number that has the same number of letters as its value?", correct_answer: "4", incorrect_answers: ["3", "5", "6"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "hard", question_text: "What is the deadliest animal to humans?", correct_answer: "Mosquito", incorrect_answers: ["Snake", "Shark", "Hippopotamus"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "hard", question_text: "What is the largest volcano on Earth?", correct_answer: "Mauna Loa", incorrect_answers: ["Mount Fuji", "Mount Vesuvius", "Krakatoa"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What element has the atomic number 79?", correct_answer: "Gold", incorrect_answers: ["Silver", "Platinum", "Mercury"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What is the Richter scale used to measure?", correct_answer: "Earthquake magnitude", incorrect_answers: ["Tornado intensity", "Hurricane category", "Volcanic explosivity"], question_type: "multiple" }, | |
| { category: "History", difficulty: "hard", question_text: "Who was the first European to circumnavigate the globe?", correct_answer: "Ferdinand Magellan", incorrect_answers: ["Christopher Columbus", "Vasco da Gama", "James Cook"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "hard", question_text: "What is the Mohs scale used for?", correct_answer: "Mineral hardness", incorrect_answers: ["Earthquake intensity", "Sound volume", "Wind speed"], question_type: "multiple" }, | |
| { category: "General Knowledge", difficulty: "hard", question_text: "What was the first soft drink in space?", correct_answer: "Coca-Cola", incorrect_answers: ["Pepsi", "Sprite", "Fanta"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "hard", question_text: "What does 'SQL' stand for?", correct_answer: "Structured Query Language", incorrect_answers: ["Simple Query Language", "Sequential Query Language", "Standard Query Logic"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "hard", question_text: "What was the first commercially successful smartphone?", correct_answer: "IBM Simon", incorrect_answers: ["iPhone", "BlackBerry", "Nokia 9000"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "hard", question_text: "What is the only Grand Slam tennis tournament played on grass?", correct_answer: "Wimbledon", incorrect_answers: ["US Open", "Australian Open", "Roland Garros"], question_type: "multiple" }, | |
| { category: "Entertainment", difficulty: "hard", question_text: "What is the longest-running Broadway show?", correct_answer: "The Phantom of the Opera", incorrect_answers: ["Chicago", "Cats", "Les Miserables"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "What is the most southern capital city in the world?", correct_answer: "Wellington", incorrect_answers: ["Santiago", "Canberra", "Buenos Aires"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "hard", question_text: "What is the only bird that can fly backwards?", correct_answer: "Hummingbird", incorrect_answers: ["Swift", "Kingfisher", "Sparrow"], question_type: "multiple" }, | |
| // --- Added: Technology balance (16 questions) --- | |
| { category: "Technology", difficulty: "easy", question_text: "What company created the Android operating system?", correct_answer: "Google", incorrect_answers: ["Apple", "Microsoft", "Samsung"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "easy", question_text: "What does CPU stand for?", correct_answer: "Central Processing Unit", incorrect_answers: ["Central Program Unit", "Computer Processing Unit", "Core Processing Unit"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "easy", question_text: "What does RAM stand for?", correct_answer: "Random Access Memory", incorrect_answers: ["Read Access Memory", "Random Application Memory", "Run Access Module"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "easy", question_text: "What does SSD stand for?", correct_answer: "Solid State Drive", incorrect_answers: ["Super Speed Drive", "Solid System Drive", "Static Storage Device"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "easy", question_text: "What does HTML stand for?", correct_answer: "HyperText Markup Language", incorrect_answers: ["HyperText Machine Language", "High Tech Markup Language", "HyperTransfer Markup Language"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "medium", question_text: "What programming language is primarily used for iOS app development?", correct_answer: "Swift", incorrect_answers: ["Kotlin", "Java", "C#"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "medium", question_text: "What does DNS stand for?", correct_answer: "Domain Name System", incorrect_answers: ["Digital Network Service", "Data Name Server", "Domain Network Standard"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "medium", question_text: "What does API stand for?", correct_answer: "Application Programming Interface", incorrect_answers: ["Application Processing Interface", "Automated Program Integration", "Advanced Programming Interface"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "medium", question_text: "What open-source operating system is used by Linux?", correct_answer: "Linux kernel", incorrect_answers: ["Unix kernel", "BSD kernel", "GNU kernel"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "medium", question_text: "What does JSON stand for?", correct_answer: "JavaScript Object Notation", incorrect_answers: ["Java Standard Object Notation", "JavaScript Online Notation", "Java Serialized Object Network"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "hard", question_text: "What was the name of the first computer virus?", correct_answer: "Creeper", incorrect_answers: ["Elk Cloner", "Melissa", "Morris Worm"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "hard", question_text: "In what year was Python first released?", correct_answer: "1991", incorrect_answers: ["1989", "1993", "1995"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "hard", question_text: "What does TCP stand for in networking?", correct_answer: "Transmission Control Protocol", incorrect_answers: ["Transfer Control Protocol", "Transport Communication Protocol", "Terminal Connection Protocol"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "hard", question_text: "What does IDE stand for in software development?", correct_answer: "Integrated Development Environment", incorrect_answers: ["Interactive Development Editor", "Integrated Design Environment", "Intelligent Development Engine"], question_type: "multiple" }, | |
| { category: "Technology", difficulty: "hard", question_text: "What does CAPTCHA stand for?", correct_answer: "Completely Automated Public Turing test to tell Computers and Humans Apart", incorrect_answers: ["Computer Authentication Protocol", "Code Access Protection Technology", "Common Automated Public Test"], question_type: "multiple" }, | |
| // --- Added: Geography balance (12 questions) --- | |
| { category: "Geography", difficulty: "easy", question_text: "What is the capital of Spain?", correct_answer: "Madrid", incorrect_answers: ["Barcelona", "Valencia", "Seville"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "easy", question_text: "What is the largest lake in Africa?", correct_answer: "Lake Victoria", incorrect_answers: ["Lake Tanganyika", "Lake Malawi", "Lake Chad"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "easy", question_text: "What is the longest river in South America?", correct_answer: "Amazon", incorrect_answers: ["Parana", "Orinoco", "Magdalena"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "What is the capital of South Korea?", correct_answer: "Seoul", incorrect_answers: ["Busan", "Incheon", "Pyongyang"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "What is the largest island in the Mediterranean Sea?", correct_answer: "Sicily", incorrect_answers: ["Sardinia", "Crete", "Cyprus"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "How many countries are in Africa?", correct_answer: "54", incorrect_answers: ["48", "52", "56"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "medium", question_text: "What is the driest inhabited continent?", correct_answer: "Australia", incorrect_answers: ["Africa", "Antarctica", "Asia"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "What is the oldest continuously inhabited city in the world?", correct_answer: "Damascus", incorrect_answers: ["Jericho", "Athens", "Rome"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "Which strait separates Europe from Africa?", correct_answer: "Strait of Gibraltar", incorrect_answers: ["Strait of Hormuz", "Bosphorus Strait", "Dardanelles"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "What is the highest waterfall in the world?", correct_answer: "Angel Falls", incorrect_answers: ["Niagara Falls", "Victoria Falls", "Iguazu Falls"], question_type: "multiple" }, | |
| { category: "Geography", difficulty: "hard", question_text: "What is the largest bay in the world?", correct_answer: "Bay of Bengal", incorrect_answers: ["Hudson Bay", "Gulf of Mexico", "Bay of Biscay"], question_type: "multiple" }, | |
| // --- Added: Sports balance (12 questions) --- | |
| { category: "Sports", difficulty: "easy", question_text: "What sport is played at the Super Bowl?", correct_answer: "American Football", incorrect_answers: ["Soccer", "Rugby", "Baseball"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "easy", question_text: "In which sport do players use a cue?", correct_answer: "Pool/Billiards", incorrect_answers: ["Darts", "Bowling", "Golf"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "medium", question_text: "Which country invented the sport of cricket?", correct_answer: "England", incorrect_answers: ["India", "Australia", "South Africa"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "medium", question_text: "In boxing, what does TKO stand for?", correct_answer: "Technical Knockout", incorrect_answers: ["Total Knockout", "Technical Knockdown", "Terminal Knockout"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "medium", question_text: "What is the maximum score in Olympic diving?", correct_answer: "10", incorrect_answers: ["6", "8", "12"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "hard", question_text: "What is the oldest tennis tournament in the world?", correct_answer: "Wimbledon", incorrect_answers: ["US Open", "French Open", "Australian Open"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "hard", question_text: "In which year were the modern Olympic Games revived?", correct_answer: "1896", incorrect_answers: ["1900", "1888", "1912"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "hard", question_text: "What does MLB stand for?", correct_answer: "Major League Baseball", incorrect_answers: ["Major League Bowling", "Major League Basketball", "Major Lacrosse Bureau"], question_type: "multiple" }, | |
| { category: "Sports", difficulty: "hard", question_text: "What is the only Grand Slam tennis tournament played on clay?", correct_answer: "French Open", incorrect_answers: ["Wimbledon", "US Open", "Australian Open"], question_type: "multiple" }, | |
| // --- Added: Nature balance (12 questions) --- | |
| { category: "Nature", difficulty: "easy", question_text: "What is the largest living bird?", correct_answer: "Ostrich", incorrect_answers: ["Emu", "Albatross", "Eagle"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "easy", question_text: "What type of tree produces acorns?", correct_answer: "Oak", incorrect_answers: ["Maple", "Pine", "Birch"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "What is the strongest muscle in the human body by weight?", correct_answer: "Masseter", incorrect_answers: ["Heart", "Gluteus Maximus", "Tongue"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "What mammal has the longest pregnancy?", correct_answer: "Elephant", incorrect_answers: ["Whale", "Giraffe", "Rhinoceros"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "What is the largest species of big cat?", correct_answer: "Tiger", incorrect_answers: ["Lion", "Jaguar", "Leopard"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "medium", question_text: "What type of animal is a Komodo dragon?", correct_answer: "Lizard", incorrect_answers: ["Dinosaur", "Crocodile", "Snake"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "hard", question_text: "What is the rarest blood type in humans?", correct_answer: "AB Negative", incorrect_answers: ["O Negative", "B Negative", "A Negative"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "hard", question_text: "What is the largest organ inside the human body?", correct_answer: "Liver", incorrect_answers: ["Brain", "Heart", "Lungs"], question_type: "multiple" }, | |
| { category: "Nature", difficulty: "hard", question_text: "How many teeth does an adult human typically have?", correct_answer: "32", incorrect_answers: ["28", "30", "36"], question_type: "multiple" }, | |
| // --- Added: Science balance (13 questions) --- | |
| { category: "Science", difficulty: "easy", question_text: "What planet is closest to Earth?", correct_answer: "Venus", incorrect_answers: ["Mars", "Mercury", "Jupiter"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "easy", question_text: "What is the largest planet in our solar system?", correct_answer: "Jupiter", incorrect_answers: ["Saturn", "Neptune", "Uranus"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "easy", question_text: "What gas makes up about 21% of Earth atmosphere?", correct_answer: "Oxygen", incorrect_answers: ["Nitrogen", "Carbon Dioxide", "Argon"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "easy", question_text: "What is the smallest planet in our solar system?", correct_answer: "Mercury", incorrect_answers: ["Mars", "Venus", "Pluto"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "medium", question_text: "What is the chemical symbol for sodium?", correct_answer: "Na", incorrect_answers: ["So", "Sd", "Sm"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "medium", question_text: "How many chromosomes do humans have?", correct_answer: "46", incorrect_answers: ["44", "48", "52"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "medium", question_text: "What type of eclipse occurs when the Moon passes between the Sun and Earth?", correct_answer: "Solar eclipse", incorrect_answers: ["Lunar eclipse", "Total eclipse", "Annular eclipse"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "medium", question_text: "What force opposes gravity on airplanes?", correct_answer: "Lift", incorrect_answers: ["Thrust", "Drag", "Buoyancy"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What is the SI unit of frequency?", correct_answer: "Hertz", incorrect_answers: ["Watt", "Joule", "Newton"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What is the chemical symbol for potassium?", correct_answer: "K", incorrect_answers: ["Po", "Pt", "Ka"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What is the innermost layer of the Earth called?", correct_answer: "Inner core", incorrect_answers: ["Outer core", "Mantle", "Crust"], question_type: "multiple" }, | |
| { category: "Science", difficulty: "hard", question_text: "What particle has no electrical charge?", correct_answer: "Neutron", incorrect_answers: ["Proton", "Electron", "Photon"], question_type: "multiple" }, | |
| ]; | |
| let allQuestions = [...sqlQuestions, ...curatedQuestions]; | |
| // Deduplicate by question_text | |
| const seen = new Set(); | |
| allQuestions = allQuestions.filter(q => { | |
| const key = q.question_text.toLowerCase().trim(); | |
| if (seen.has(key)) return false; | |
| seen.add(key); | |
| return true; | |
| }); | |
| // Add IDs | |
| const output = allQuestions.map((q, i) => ({ | |
| id: `q-${String(i + 1).padStart(5, "0")}`, | |
| category: q.category, | |
| difficulty: q.difficulty, | |
| question_text: q.question_text, | |
| correct_answer: q.correct_answer, | |
| incorrect_answers: q.incorrect_answers, | |
| question_type: q.question_type || "multiple", | |
| })); | |
| // Count by difficulty | |
| const counts = { easy: 0, medium: 0, hard: 0 }; | |
| for (const q of output) { | |
| if (q.difficulty in counts) counts[q.difficulty]++; | |
| } | |
| console.log(`\nTotal after dedup: ${output.length}`); | |
| console.log(` Easy: ${counts.easy}`); | |
| console.log(` Medium: ${counts.medium}`); | |
| console.log(` Hard: ${counts.hard}`); | |
| // Write output | |
| const outPath = resolve(ROOT, "src", "data", "questions.json"); | |
| writeFileSync(outPath, JSON.stringify(output, null, 1)); | |
| console.log(`\nWritten to: ${outPath}`); | |
| console.log(`File size: ${(Buffer.byteLength(JSON.stringify(output)) / 1024 / 1024).toFixed(1)} MB`); | |