Ticket to Ride

BJ is down in Florida this week with his family visiting Disney and the beach. He’s a big kid and really gets along with his nieces and nephew. They all have rides they want to go on while at Disney but don’t like standing in line. We’re going to help them choose which rides to get Fast Pass tickets on.

The Challenge

For this challenge the family will be at Disney for 2 days. Each person gets 4 Fast Passes to skip the lines and they want to all ride together as much as possible.

Each of the kids and the big kid (BJ) have listed out their favorite rides in the table below. They have prioritized the rides (1 being top priority).

Name Ride Priority Park
BJ Space Mountain 1 Magic Kingdom
BJ Mad Tea Party 3 Magic Kingdom
BJ Peter Pan 4 Magic Kingdom
BJ Kali River Rapids 2 Animal Kingdom
John Peter Pan 1 Magic Kingdom
John Triceritop Spin 2 Animal Kingdom
John Wildlife Express Train 3 Animal Kingdom
John Dumbo 4 Magic Kingdom
Addie Small World 3 Magic Kingdom
Addie Kali River Rapids 2 Animal Kingdom
Addie Finding Nemo 1 Animal Kingdom
Addie Splash Mountain 4 Magic Kingdom
Kinley Small World 1 Magic Kingdom
Kinley Kilimanjaro Safaris 2 Animal Kingdom
Kinley Dumbo 3 Magic Kingdom
Kinley Wildlife Express Train 4 Magic Kingdom

Creating a Test Case

Like in past challenges we’ll be using our tests to drive our development. No matter the level you choose to work with write a test case before you start your code. Then write just enough code to pass the test. Once you have passing code refactor to pass other test cases.

Level 1

From the table of everyone’s favorite rides create a list of rides to get fast pass tickets so that each person gets to ride at least one from their list.

A Step Further

For each ride on the list of fast pass rides also print the names of the people wanting to go on that ride.

Level 2

Prioritize the rides based on how many people want to go on that ride. If more than one person wants to go on a ride it becomes a higher priority. Make sure everyone gets to go on at least one from their list.

A Step Further

If only one person wants to go on a ride they can go through the single rider line and not spend a fast pass ticket. Create a list of single rider rides and exclude these from the list of fast pass rides.

Level 3

The rides are spread between two parks. The family is spending two days at Disney going to one park each day. Create a list of 3 rides per park so that all members get to ride at least one on their list of rides.