Six Degrees of Kevin Bacon CLI Application

Tom Hansen
4 min readMay 2, 2019

--

If you’re a movie buff, you can see that there are thousands of different actors and actresses appearing in thousands of different movies. What if there were a way to connect them all?

As it turns out, a game exists that was invented by a few college students called “Six Degrees of Kevin Bacon”.

History

Back in 1994, at Albright College in Reading, Pennsylvania a few friends dreamt up an idea over cocktails and a few Kevin Bacon movies. Brian Turtle, Craig Fass, and Mike Ginelli were watching the Kevin Bacon movie “Footloose” on TV. Afterward “Quicksilver”, another Kevin Bacon movie, came on. Even during the commercial break there was a promotion for yet another Kevin Bacon movie.

Based on the amount of movies and promotions Bacon was appearing in, they decided to make a game of it. Let’s see how we can connect Hugh Jackman to Kevin Bacon.

Hugh Jackman was in the movie…

“Pan” with

Amanda Seyfried who was in the movie…

“You Should Have Left” with

Kevin Bacon

The object would be to see who can link the actor or actress to Kevin Bacon in less moves. “Six Degrees” is based on the “Six Degrees of Separation” stating that: “all people are six, or fewer, social connections away from each other”.

The CLI Application

Six degrees of Kevin Bacon, the game, has been designed as a command line interface (CLI) application using TTY-Prompt and can be downloaded from GitHub here: https://github.com/ctrhansen/six_degrees_of_kevin_bacon

When you click the link, instructions to get the game up and running are in the readme at the bottom of the page.

The program was coded in the Ruby Programming language. Please note: In order for this application to work, the user must sign up for their ***very own API Key*** by signing up for an account on TMDB. https://www.themoviedb.org/account/signup

There are four different places specified in the code where the key needs to go. The key I use has 32 digits.

If you have performed everything correctly you should see this prompt in your terminal.

Playing the Game

Once you have the game up and running there are a few options you can choose from:

Play — Play the Game (more on this below!)

How to Play — Information on how the game is played.

Difficulty Settings — Easy: Link to Kevin Bacon in 7 moves or less; Medium: Link to Kevin Bacon in 6 moves or less; Hard: Link to Kevin Bacon in 5 moves or less.

Realistically, many of the well-known actors and actresses in Hollywood today can be linked to Kevin Bacon in 4 moves or less. Much of your success playing the game depends on your working knowledge of the film industry.

You can begin by typing any actor or actress. Let’s begin by typing Hugh Jackman…

This brings up a list of all of Hugh Jackman’s movies. The data here was pulled using an application programming interface (API) from The Movie DB (TMDB) https://www.themoviedb.org/. As of the day of this post, TMDB has 456,630 movies and 1,362,051 people!

Now, on to our next prompt…

By selecting from a list of movies, this action brings up a separate list of actors and actresses from the movie selected. This counts as the first move. Be extra careful to not select actors you have already selected as you will waste a move.

We’ve found bacon! Congratulations!

Here are some bacon roses.

--

--