A perfect score on Jeopardy!

What is a perfect score on Jeopardy!? All great sports fun activities have perfect scores: bowling is 300, batting average is 1.00, golf (I suppose) is 18. Okay, 18 in mini-golf is more likely and has actually been achieved twice in competitive history. That shouldn’t really surprise you. What should surprise you is that there’s a competitive mini-golf putt-putt scene. But I digress, so let’s get back to Jeopardy!.

This question was posed by FiveThirtyEight as one of their Friday Riddler questions. I quickly wrote and answer for that and thought it might be fun to post it here. Not because the code is in any way difficult, but just because it’s fun. And its Friday. And I can handle reviewing two more papers until I finish this coffee, so I’m procrastinating.

First, see if you can figure this out on your own. For those three of you millennials who don’t know the rules to Jeopardy!, they’re simple. But the trick to getting the perfect score is as much luck as it is skill.

First, you pretty much have to be playing against Sean Connery and Turd Furguson, because you have answer every question correctly and either buzz in first every time or rely on your competitors to answer incorrectly. So that’s skill. But you also have to

  1. find all the Daily Doubles,
  2. find them on the last clues of the round,
  3. find them all under the lowest dollar value clues,
  4. make them all true Daily Doubles.
# The dollar values for all the clues in each column in both rounds.
j <- seq(200,1000,200)
j2 <- j*2

Calculate the max score for the first round:

# Answer all clues correctly (6 columns), minus the daily double clue (the lowest value on the board, since you don't get the clue $$ for the daily double clue, even if you get it right)
j.sum <- sum(j*6)-j[1]
# Then, you get the daily double under the last clue and win a true Daily Double (double your $$)
j.sum.dd <- j.sum*2
[1] 35600

So you can take $35,600 in the first round. Now calculate the max score for the Double Jeopardy! round:

 # Answer all clues correctly except for *two* of the lowest value clues, which contain the Daily Doubles.
j2.sum <- sum(j2*6)-2*j2[1]
# Add this to your total from the first round
j2.sum.total <- j2.sum + j.sum.dd
# You now have $70,800 when you hit the Daily Doubles
# Make the last and second last clue true Daily Doubles (double your $$)
j2.sum.dd.1 <- j2.sum.total*2
j2.sum.dd.2 <- j2.sum.dd.1*2
[1] 283200

So you leave Double Jeopardy! with $283,200. Now, we have to assume that the show would actually let you play Final Jeopardy! with both your competitors at $0. I’m not sure this has ever happened, though there have been some weird scenarios. I can imagine the uproar if they didn’t let you try to double your money again, so let’s assume they would.

# You wager everything (for some reason) and get it right, doubling your $$
final.sum <- j2.sum.dd.2*2
[1] 566400

So you take home $566,400. Not bad.

Posted in R | Tagged , , | 1 Comment

The literal IKEA learning curve

So, we’re in the process of replacing our kitchen with an IKEA Euro-trash kitchen. This means that I have a lot of IKEA to build. It occurred to me as I built SEKTION cabinet after cabinet, each faster than the last, that it might be interesting to log my progression in IKEA building: an IKEA learning curve in the most literal sense. Continue reading

Posted in R, Sports | Tagged , , , , , , , , , | 2 Comments

Ecologists: what we do vs. what we want people to think that we do

This occurred to me the other day while out working in the field for a day. I think back on all the photos I’ve posted of me doing rad stuff outside for work, like skiing through northern forests, flying around in helicopters, building cool stuff on glaciers, and the like. And then I think about all the photos I haven’t posted of me sitting at my desk (the number is non-zero, but just)…

Ecologist Pie Chart

Continue reading

Posted in graphics, R | Leave a comment

R code your Secret Santa exchange

WordPress has issues with the code sometimes. Full working code here.

Remember when everyone in the office/family would gather around and pull little pieces of paper out of a hat with names on them to decide who buys a secret Christmas gift for whom? Remember when people used to write on paper? And wear fancy hats? Ah, the good ol’ days.

These days, we use sophisticated algorithms for just about everything, so why not for making our Secret Santa lists?  Continue reading

Posted in R, Uncategorized | Tagged , , , | 8 Comments

Space Invaders in R

space_invaders_flyer_1978So, for no particular reason except that it was kinda fun, I made some Space Invaders graphics in R. I even made the cool ‘Game Over’ text. Side note: this might be the first time that I’ve actually found the “green” colour useful.

There’s no analysis here, no fancy statistics, not even any real key message. Just some number lists that make some pixelated images to remind you of your 80s upbringing.

If there’s one redeeming feature here, it’s the (brute force) code to get a vector of pixel values to convert to a matrix and plot properly. This was a bit trickier than expected (not using the raster package) and involves some odd reversing and transposing of the values. I’m open to a better solution, as I need to do this now and then for, you know, actual work. Continue reading

Posted in graphics, R | Tagged , , , , , , , | Leave a comment

Some of my favourite infographics

I have a real love of “infographics” (aside: probably the best new word of the last decade…or, uh, five decades), which are basically the “pop” version of scientific figures with no peer review (and no journal colour charges!). Here are some of my favourites. I’ll add to it as I find more.

Continue reading

Posted in graphics, Uncategorized | Tagged | Leave a comment

Cycling gear ratio calculator for R (or why you should just go buy a SRAM Eagle 1×12 group right now)

Don’t care about R functions? Fine then. Jump past all the code to my analysis of single ring cyclocross setups or to my analysis of SRAM’s new 1×2 Eagle group.

It took the end of a bottle of Jägermeister Winterkräuter to finish this off, but here it is. In the spirit of the incogitable Sheldon Brown (whose name will come up anytime I need an authoritative word) I offer a simple gear ratio calculator function for the R programming environment. I also include two case studies at the end that look at 1) single vs. double ring cyclocross setups and 2) SRAMs new Eagle 12-speed group. Continue reading

Posted in R, Sports | Tagged , , , , , , , , , , , , , , | 8 Comments