About Refactoria

Refactoria is a video game that aims to teach high school and university-level computer science students the concepts and skills needed to properly refactor code.

Players play as an expert chef with their sidekick Watson the Whiskbot to refactor Watson's instructions into efficient, readable, and easily maintainable code. While making fun recipes like a fried egg burger, tomato soup, and chicken nuggets, players learn better coding etiquette!

In each of the 13 levels, players are presented with a code-based puzzle that, although it passes the test cases, contains a variety of code smells. They are then tasked with using refactoring techniques to ensure the code passes one or two other requirements designed to teach better coding practices.

A screenshot of one of Refactoria's levels. On the right two-thirds of the image, is the kitchen. Watson, a light blue whisk robot, stands in the middle surrounded by 3 stations. The kitchen has a door to the pantry, a door to exit, and a delivery window. The current order is one plate of chicken tenders. On the remaing third of the image, is the code edtior with the level's starter code. Above it are also buttons to run, stop, and reset the code, as well as to view the level instructions and refactoring dictionary. At the bottom is the line-number count and placeholder text for the chef's actions. A screenshot of one of Refactoria's level complete pop-ups. The pop-up explains that player used Code Deletion on Duplicate Code to solve the puzzle. There are also options to return to the level select and return to the current level.

Want to play Refactoria? Click on the link below to download for macOS or Windows.

Contributors

A photo of Christopher Engelbart

Christopher Engelbart

Programming

A photo of Nerissa Lundquist

Nerissa Lundquist

Art & UI

A photo of Stephen Pachucki

Stephen Pachucki

Puzzle Design

A photo of David Van Hise

David Van Hise

Programming


Eman Abdullah AlOmar

Project Client

Aaron Klappholz

Project Advisor

Puzzles

Refactoria features 13 distinct puzzles covering varying code smells and refactoring techniques. This section contains details about each puzzle and can get you started with solving the first puzzle in the game.

Welcome to Refactoria

Watson, how do you make tomato soup? No, not quite.

Task: Find the issue with the code, and refactor it to make it shorter and clearer.

Constraint

Maximum of 13 lines of code.

One Soup Two Soup

I ask Watson to make me some tomato soup. Next, potato soup. Right away, I see his instruction set is much larger than it needs to be.

Tip: The same code must be used for all orders!

Constraint

Maximum of 15 lines of code.

Future Recipes

The old owner frequently mentioned that he had intended to put new items on the menu including squash soup (yuck!). That explains why he decided to leave it in the recipe book, but that recipe isn’t going to help us now.

Constraint

Maximum of 15 lines of code.

A Method to the Madness

A tomato soup craze sweeps the nation. Realizing I can't type fast enough to keep up, I search for a better solution.

Constraint

Maximum of 16 lines of code.

R&D: Soup on Soup

I'm looking to test a new soup on the menu. How about mushroom? With a glance to the left and right, I scribble it onto the menu. Now, I just need to teach Watson how to make it.

Constraint

Maximum of 16 lines of code.

R&D: All Together Now

With customers finally pouring in, Watson is super nervous. Such cowardice has no place in a well-run kitchen: Watson needs to pull it together. With a click of embarrassment, he recovers and prepares to execute orders.

Constraint

Maximum of 20 lines of code.

R&D: One More Soup

Watson moves in a symphony of slicing and boiling. It nearly brings a tear to my eye. But our patrons insist on one more kind of soup. Can he handle it? I scratched down one idea, but we'll see...

Constraint

Maximum of 23 lines of code.

Take Two

"What do you do if someone orders two different kinds of soup?" I ask. Watson's face tells me that he's feeling bluer than usual. Oh, boy!

Constraint 1

Constraint 2

Maximum of 24 lines of code.

All if-statements must have no more than one comparison.

Build a Burger

The first time I ask Watson how he makes a burger, he prints out a main method so long it wrapped around the whole kitchen. Come now, we can do better than this.

Constraint 1

Constraint 2

Maximum of 32 lines of code.

Use at least 6 methods.

All Over the Place

Today, Watson, in a rush to cross the kitchen, knocked me onto the floor. After staggering to my feet, I realize I haven't been taking advantage of Refactoria's highly configurable kitchen modules.

Tip: Click on a station's module to change it.

Constraint

Maximum of 19 lines of code.

A Tight Shift

My heart sinks when I see energy bill at the end of the month. The horror! And then I find the recipe responsible for this the bill...

Constraint 1

Constraint 2

Maximum of 20 lines of code.

The kitchen must have no more than 3 modules.

Parameter Overload

The old chef went too far with parameterizing this recipe. Perhaps I can salvage it.

Constraint 1

Constraint 2

Maximum of 14 lines of code.

The program cannot contain more than 3 parameters.

An Industrial Kitchen

This is it, we're nearly back to full service. I'm proud of Watson. Without his hard work, we never would have reached this point. I survey the kitchen and realize that he has an awful lot on his plate.

Constraint

Maximum of 2 modules per station.