Skip to content

Instantly share code, notes, and snippets.

View renfri897's full-sized avatar

Arthur Bowen renfri897

View GitHub Profile
@renfri897
renfri897 / generator-slot-game.js
Created February 3, 2025 14:49 — forked from perjo927/generator-slot-game.js
Generator-based slot machine game
const getRandomInt = (range) => Math.floor(Math.random() * range);
// Create an array of symbols for the slot machine
const symbols = ['πŸ’', 'πŸ‹', 'πŸ””', '7️⃣', '🎱'];
// Define a generator function that will yield a random symbol
// from the array when iterated over
function* getReels(noOfReels = 3) {
let i = 0;
while (i++ < noOfReels) {