Rock Paper Scissors (Lizard Spock)

Problem Description

This is a refactoring kata built around Chapter 21 of “Working Effectively With Legacy Code” by Martin Fowler. Fowler focuses on the problem of having to make changes in many places. While the exercise laid out in the chapter is a great one, it’s a pretty involved refactor and I needed something for a shorter event.

The Problem

In Season Five, Episode 17 of the Big Bang Theory, Sheldon and Barry Kripke are fighting over Professor Rothman’s office. While the dispute is canonically solved by seeing who can bounce a basketball higher, the first proposed contest is a friendly game of “Rock Paper Scissors Lizard Spock.”

Let us imagine an alternate reality in which this game determines who wins the office. Since both Sheldon and Kripke will only ever pick “Spock,” the pair agree to automate the playing of the game and abide by the result. Unfortunately, they can’t find any implementations of RPSLS and the only RPS game on the network is some old Python code Wolowitz side-loaded onto his mechanical hand.

Assignment

SOURCE FILES ARE HERE!

Refactor Wolowitz’s horrific code into an implementation of Rock, Paper, Scissors, Lizard, Spock, adding appropriate text outputs to incorporate the additional choices.

Hints