REMINDER
SUPPLIES ARE LIMITED  •  RATIONS ARE SMALL  •  RESTOCK IS NONVIABLE  •   SUPPLIES ARE LIMITED  •  RATIONS ARE SMALL  •  RESTOCK IS NONVIABLE  •  

let players = []; let zombies = []; function setup() { createCanvas(windowWidth, windowHeight); // load usernames let names = ["alice", "bob", "charlie", "dave"]; for (let name of names) { players.push(new Player(name)); } // infect 1 random person let start = random(players); start.isZombie = true; } function draw() { background(0); for (let p of players) { p.move(); p.display(); p.checkInfection(players); } let survivors = players.filter(p => !p.isZombie); if (survivors.length === 1) { noLoop(); fill(255, 0, 0); textSize(50); text(`WINNER: ${survivors[0].name}`, width/2, height/2); } } class Player { constructor(name) { this.name = name; this.x = random(width); this.y = random(height); this.isZombie = false; } move() { this.x += random(-2, 2); this.y += random(-2, 2); } display() { fill(this.isZombie ? 'red' : 'green'); ellipse(this.x, this.y, 40); fill(255); textSize(10); textAlign(CENTER); text(this.name, this.x, this.y - 25); } checkInfection(others) { if (!this.isZombie) { for (let o of others) { if (o.isZombie && dist(this.x, this.y, o.x, o.y) < 30) { this.isZombie = true; break; } } } } }