3 ms·
This is awesome! I went to UConn, so I'll obviously hard-code a UConn win there. But I heard on NPR today that, historically, a 12 seed has a 50% chance of upse
by trg2 13y ago
This is awesome! I went to UConn, so I'll obviously hard-code a UConn win there. But I heard on NPR today that, historically, a 12 seed has a 50% chance of upsetting a 5 seed in the first round. If I'm biasing towards the higher seeds everywhere else, that means my code looks like this:
function (game, team1, team2) {
var winner_team = "Connecticut";
if (team1.name == winner_team) {
team1.winsGame();
} else if (team2.name == winner_team) {
team2.winsGame();
} else if (team1.seed > team2.seed) {
team2.winsGame();
} else if (team2.seed == "12") {
team2.winsGame();
} else {
team1.winsGame();
}
}
- deleted 13y ago[deleted]
- dy 13y agoThis is exactly the reason we built this - it's much harder to keep all these various rules in your head while you're making your bracket, but simple to execute in code. Thanks for the awesome example!
- selectout 13y agoWOuldn't this not take into account 12 seeds winning? Since you do team1.seed > team2.seed before checking if team2.seed is 12. Also, this would mean 12 seeds would go all the way anyway, you're not limiting it to the first round only.