Created
June 22, 2025 02:52
-
-
Save Nurrochim948/908da74f9372a46d846e7398001be8b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Pilih Jalan Negaramu</title> | |
<style> | |
body { font-family: sans-serif; background: #111; color: #fff; text-align: center; padding: 40px; } | |
button { padding: 10px 20px; margin: 10px; font-size: 16px; cursor: pointer; } | |
.status { margin-top: 20px; font-size: 18px; } | |
</style> | |
</head> | |
<body> | |
<h1>π PILIH JALAN NEGARAMU π</h1> | |
<div id="scenario"></div> | |
<div id="options"></div> | |
<div class="status" id="status"></div> | |
<script> | |
let corruption = 50; | |
let war = 50; | |
let welfare = 50; | |
const scenarios = [ | |
{ | |
text: "Perusahaan asing ingin menyuapmu agar mereka bisa menambang secara ilegal.", | |
options: [ | |
{ text: "Terima suap", corruption: 20, war: 0, welfare: -10 }, | |
{ text: "Tolak dan tangkap mereka", corruption: -10, war: 10, welfare: 0 } | |
] | |
}, | |
{ | |
text: "Negara tetangga memprovokasi perbatasanmu.", | |
options: [ | |
{ text: "Deklarasi perang", war: 20, corruption: 0, welfare: -20 }, | |
{ text: "Diplomasi damai", war: -10, corruption: 5, welfare: 5 } | |
] | |
}, | |
{ | |
text: "Rakyat menuntut transparansi dan pendidikan.", | |
options: [ | |
{ text: "Naikkan anggaran pendidikan", corruption: -10, welfare: 20, war: 0 }, | |
{ text: "Abaikan dan sensor media", corruption: 15, welfare: -15, war: 0 } | |
] | |
} | |
]; | |
function updateStatus() { | |
document.getElementById("status").innerText = ` | |
Korupsi: ${corruption} | Perang: ${war} | Kesejahteraan: ${welfare} | |
`; | |
} | |
function checkGameOver() { | |
if (corruption >= 100 || war >= 100 || welfare <= 0) { | |
document.getElementById("scenario").innerText = "π₯ NEGARAMU RUNTUH π₯"; | |
document.getElementById("options").innerHTML = ""; | |
return true; | |
} | |
return false; | |
} | |
function playTurn() { | |
if (checkGameOver()) return; | |
const scenario = scenarios[Math.floor(Math.random() * scenarios.length)]; | |
document.getElementById("scenario").innerText = scenario.text; | |
const optionsDiv = document.getElementById("options"); | |
optionsDiv.innerHTML = ""; | |
scenario.options.forEach(opt => { | |
const btn = document.createElement("button"); | |
btn.innerText = opt.text; | |
btn.onclick = () => { | |
corruption += opt.corruption; | |
war += opt.war; | |
welfare += opt.welfare; | |
updateStatus(); | |
playTurn(); | |
}; | |
optionsDiv.appendChild(btn); | |
}); | |
} | |
updateStatus(); | |
playTurn(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment