zwickypedia

musings, puzzles & programming

Van: Update #1

Everyone is long overdue for a van update, so here we go!

Last time we talked, I was in the tear-down phase, removing the old floor and interior construction from the previous owner. It’s safe to say that I’m past that phase and fully into construction at this point. I was able to successfully remove the old floor, grind off the old adhesive holding it down, and remove the metal wall separating the cabin from the cargo area. In addition to the adhesive, the floor was also bolted down, so I ended up doing a lot of manual work cutting old those old rusted bolts out.

Van: The Start

I’ve been sitting on some exciting news for a little while, and I finally got around to writing this up to share with everyone. About a month ago, I bought a 2010 Sprinter van to convert into an RV!

This project has been stewing in my brain for a long time, and it was high time to take some action. Apologies to anyone who has listened to me wax poetic about how awesome traveling around in a van would be. Now you get to endure listening to me talk about the gory details instead.

Speeding Commuters

This week’s riddler express was a great level of difficulty, not too tough, but still a challenge! I thought it was worthy of a write-up. One of my goals is to make these posts enjoyable for everyone, not just the people who are puzzle crazy like I am. If you have tips for things you thought were confusing or difficult to understand, let me know. Hope you enjoy!

From Jerry Meyers, a careening commute problem:

Our co-workers carpool to work each day. A driver is selected randomly for the drive to work and again randomly for the drive home. Each of the drivers has a lead foot, and each has a chance of being ticketed for speeding. Driver A has a 10 percent chance of getting a ticket each time he drives, Driver B a 15 percent chance, Driver C a 20 percent chance, and Driver D a 25 percent chance. The state will immediately revoke the license of a driver after his or her third ticket, and a driver will stop driving in the carpool once his license is revoked. Since there is only one police officer on the carpool route, a maximum of one ticket will be issued per morning and a max of one per evening.

Assuming that all four drivers start with no tickets, how many days can we expect the carpool to last until all the drivers have lost their licenses?

What do we know?

First, let’s make some observations about the problem. At the beginning of each trip, each driver will have some amount of tickets. I’m going to refer to these amounts as a state. For example, if Drivers A & B each had 1 ticket, I’ll write that state as [1, 1, 0, 0]. The intial state is [0, 0, 0, 0] and the end state is [3, 3, 3, 3] (all drivers are suspended).

Supreme Gridlock

Last week I won the FiveThityEight Riddler! (don’t get too excited, the winner is randomly selected 😉)

I don’t share every riddler I work on, but this one is straightforward yet interesting, politically applicable, and was fun to work on.

Imagine that U.S. Supreme Court nominees are only confirmed if the same party holds the presidency and the Senate. What is the expected number of vacancies on the bench in the long run?
You can assume the following:

• There are two parties, and each has a 50 percent chance of winning the presidency and a 50 percent chance of winning the Senate in each election.
• The outcomes of Senate elections and presidential elections are independent.
• The length of time for which a justice serves is uniformly distributed between zero and 40 years.

• President elected every 4 years, Senate every 2 years.
• Judicial terms will be integers (whole years), and if a judge leaves on an election year, the seat will be potentially filled by the incoming government.

I have omitted some of the code for brevity. Full code here

Dollars to Doughnuts

Today’s post is a (relatively) quick one to do some visualization on my financial data. Specifically, I was interested in whether some concious changes I had made in my dietary habits have materialized into measurable savings.

To date, I haven’t really focused too much on reducing my food spending. I keep a budget for it, but pretty regularly exceed it. However, in February I took a close look at how much I was actually spending and tried to take some steps to reduce my spending. The main areas that I looked to cut were eating take-out and getting breakfast & lunch at work every day. I’ve been making some concious efforts in those areas over the past ~4 weeks or so, including cooking large batch meals to bring for lunches at work.

In the post I’m going to run through the analysis I did to determine whether my changes had a financial impact.