Written by
Matt Bilyeu
on
on
Spreadsheet Jeopardy!
My girlfriend and I often watch Jeopardy! together, and we play along and keep score to make it more fun.
To avoid having to pause the show to wager, we have a house rule that “Daily Double”s are just worth twice their marked value. E.g., a D.D. on a $600 clue would be worth $1200. And we yell the answers (questions?) instead of buzzing in.
After tallying a number of games by hand, I decided to make a custom function in Google Sheets to keep score. Our scoring notation is:
- correct: first initial of first name
- incorrect: first initial of last name
- daily double: initial followed by asterisk
function score(results, level) {
mScore = 0;
kScore = 0;
results[0].forEach( function(cell) {
cell = cell.toLowerCase()
if (cell.match(/.*m\*.*/)) {
mScore += 2 * level;
} else if (cell.match(/.*m.*/) !== null) {
mScore += level;
} else if (cell.match(/.*b\*.*/)) {
mScore -= 2 * level;
} else if (cell.match(/.*b.*/)) {
mScore -= level;
}
if (cell.match(/.*k\*.*/)) {
kScore += 2 * level;
} else if (cell.match(/.*k.*/)) {
kScore += level;
} else if (cell.match(/.*c\*.*/)) {
kScore -= 2 * level;
} else if (cell.match(/.*c.*/)) {
kScore -= level;
}
})
return [[mScore, kScore]];
}
(Yes, I’m aware this could be refactored)
It just occurred to me that I could probably modify this function to gift me a stray hundred dollars every now and then. She probably wouldn’t notice… 😈