Skip to content

Instantly share code, notes, and snippets.

@ZTRdiamond
Created October 20, 2025 12:41
Show Gist options
  • Select an option

  • Save ZTRdiamond/380f0d622236d2774fef5c5fd1b1cec1 to your computer and use it in GitHub Desktop.

Select an option

Save ZTRdiamond/380f0d622236d2774fef5c5fd1b1cec1 to your computer and use it in GitHub Desktop.
Sistem judi pacuan kuda, simpel dan mudah untuk dikreasikan dengan bot.
/**
* Credit
* - ZTRdiamond
* - Source: https://whatsapp.com/channel/0029VbC6NKM96H4ZW9Q5az2R
* - Source: https://whatsapp.com/channel/0029VagFeoY9cDDa9ulpwM0T
*/
function startRace(betHorses = []) {
if (!Array.isArray(betHorses)) throw new Error("Taruhan harus berupa array.");
if (betHorses.length === 0) throw new Error("Minimal pasang 1 kuda untuk taruhan.");
if (betHorses.length > 3) throw new Error("Maksimal pasang 3 kuda untuk taruhan.");
const horseName = [
"Special Week",
"Silence Suzuka",
"Tokai Teio",
"Mejiro McQueen",
"Gold Ship",
"Daiwa Scarlet",
"Vodka",
"Grass Wonder",
"T.M. Opera O"
];
const randomRange = (min, max) => Math.random() * (max - min) + min;
const results = horseName.map(name => {
const speed = randomRange(80, 100);
const stamina = randomRange(75, 100);
const mood = randomRange(0.8, 1.2);
const performance = ((speed * 0.6) + (stamina * 0.4)) * mood;
return { horse: name, performance };
});
results.sort((a, b) => b.performance - a.performance);
const output = results.map((r, index) => ({
horse: r.horse,
win: index === 0,
finished: index + 1,
bet: betHorses.includes(r.horse)
}));
const winnerHorse = output.find(h => h.win).horse;
const betWin = betHorses.includes(winnerHorse);
return output.map(o => ({ ...o, betWin }));
}
// Contoh penggunaan
const result = startRace(["Gold Ship"]);
console.table(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment