Skip to content

Instantly share code, notes, and snippets.

function getWinPosition(joins, winner) {
var spots = joins.length;
var winningSpot;
var lockDistance = Math.floor(spots / 4);
if (lockDistance < 1) { lockDistance = 1;}
for (winningSpot = 0; winningSpot < lockDistance; winningSpot++) {
if (!joins[winningSpot]) {
break;
}