{ q: "Apa nama teks resmi kemerdekaan Indonesia?", choices: ["Trikora", "Supersemar", "Proklamasi", "Dekrit Presiden"], answer: 2 },
{ q: "Siapa presiden kedua Indonesia?", choices: ["Habibie", "Soeharto", "Soekarno", "Megawati"], answer: 1 },
{ q: "Apa nama organisasi pemuda 1928 yang mengikrarkan Sumpah Pemuda?", choices: ["Boedi Oetomo", "Perhimpunan Indonesia", "PPPI", "Pemuda Pancasila"], answer: 2 },
{ q: "Kapan G30S terjadi?", choices: ["1965", "1966", "1978", "1955"], answer: 0 },
{ q: "Apa nama konfrontasi militer Indonesia dengan Malaysia?", choices: ["Agresi", "Konfrontasi", "Perang Saudara", "Operasi Trikora"], answer: 1 },
{ q: "Siapa jenderal yang gugur dalam G30S/PKI?", choices: ["Soedirman", "Nasution", "Ahmad Yani", "Gatot Subroto"], answer: 2 },
{ q: "Apa nama kabinet pertama RI?", choices: ["Kabinet Indonesia Merdeka", "Kabinet Gotong Royong", "Kabinet Pembangunan", "Kabinet Sjahrir"], answer: 0 },
{ q: "Siapa tokoh pendiri Nahdlatul Ulama?", choices: ["KH Hasyim Asy'ari", "KH Ahmad Dahlan", "Buya Hamka", "Sukarno"], answer: 0 },
{ q: "Apa tujuan utama Kongres Pemuda 1928?", choices: ["Mengusir penjajah", "Membentuk tentara", "Menyatukan pemuda Indonesia", "Mendirikan partai"], answer: 2 },
{ q: "Apa isi Dekrit Presiden 5 Juli 1959?", choices: ["Membubarkan DPR", "Kembali ke UUD 1945", "Mengganti presiden", "Menyatakan darurat militer"], answer: 1 },
{ q: "Siapa pencetus Pancasila?", choices: ["Moh. Yamin", "Soekarno", "Soeharto", "Tan Malaka"], answer: 1 },
{ q: "Apa nama gerakan politik DI/TII?", choices: ["Islam Moderat", "Demokrasi Terpimpin", "Negara Islam Indonesia", "Komunisme"], answer: 2 },
{ q: "Kapan Indonesia menjadi anggota PBB?", choices: ["1945", "1950", "1966", "1965"], answer: 2 }
];
const rewards = [
"Rp 100.000", "Rp 250.000", "Rp 500.000", "Rp 1.000.000", "Rp 2.000.000",
"Rp 5.000.000", "Rp 10.000.000", "Rp 25.000.000", "Rp 50.000.000", "Rp 100.000.000",
"Rp 200.000.000", "Rp 300.000.000", "Rp 500.000.000", "Rp 750.000.000", "Rp 1.000.000.000"
];
let currentQuestion = 0;
function startQuiz() {
document.getElementById("start-screen").style.display = "none";
document.getElementById("quiz-box").style.display = "block";
showQuestion();
}
function speak(text) {
const utterance = new SpeechSynthesisUtterance(text);
utterance.lang = 'id-ID';
speechSynthesis.speak(utterance);
}
function showQuestion() {
const q = questions[currentQuestion];
document.getElementById("question-number").innerText = currentQuestion + 1;
document.getElementById("question-text").innerText = q.q;
document.getElementById("current-reward").innerText = rewards[currentQuestion];
speak(`Soal nomor ${currentQuestion + 1}. ${q.q}`);
const choicesContainer = document.getElementById("choices");
choicesContainer.innerHTML = "";
q.choices.forEach((choice, index) => {
const btn = document.createElement("button");
btn.className = "btn btn-outline-light col-md-5 mx-auto";
btn.innerText = choice;
btn.onclick = () => checkAnswer(index);
choicesContainer.appendChild(btn);
});
document.getElementById("feedback").innerText = "";
}
function checkAnswer(selectedIndex) {
const correctIndex = questions[currentQuestion].answer;
if (selectedIndex === correctIndex) {
speak("Jawaban Anda benar!");
currentQuestion++;
if (currentQuestion < questions.length) {
setTimeout(showQuestion, 800);
} else {
showSuccess();
}
} else {
speak("Jawaban Anda salah!");
showFail();
}
}
function showSuccess() {
document.getElementById("quiz-box").style.display = "none";
document.getElementById("result-screen").classList.remove("hidden");
document.getElementById("applause").play();
speak("Selamat! Anda menjawab semua soal dengan benar!");
}
function showFail() {
document.getElementById("quiz-box").style.display = "none";
document.getElementById("fail-screen").classList.remove("hidden");
}