About

You will be recreating the game of 'Racko,' which is a game that involves rearranging your hand of cards in order to have an increasing sequence. Each card just has a number. We will be making a user versus computer version of the game. The user's moves are decided by the user's input, while the computer's moves will be decided by you. You will be using a combination of linked lists and arrays for doing this assignment.

To make this interactive and fun, we have written a user interface. We also have the computer play using a relatively medium level strategy. When your assignment is completely done, you should be able to actually play the game. The final interface looks like

final user interface
The user (the student) can click to choose a card from either the discard pile or the deck and then click to choose the card in their hand that they want to replace.

There are 2 versions of this assignment.

Rules of Racko

Racko is a game whose primary component is a deck of cards numbered 1 through 60.

The order in which the game is played out is as follows

Python version

The Python version of the above assignment has no graphical user interface. The emphasis in the Python version is to learn how to manipulate lists. Also, in order to write a strategy, students have to learn to think computationally; their strategy has to broken down into some sequence of list operations.
Click Python handout for an example handout (in pdf) or handout as a word doc.

Java version

Racko.java has the complete structure of the program that will allow you to play a game of Racko against the computer. Your goal is to fill in the methods that are currently completely empty. These areas of the code can be easily found by searching for the words 'fill this'.

You do not have to change any of the code that is already supplied to you.

If you are working on the extra credit part of the assignment, you will be required to change the computer strategy. In this case, you have to write your own version of the computer's move method.

Click list of functions to get a word document that describes each of the functions that you need to fill.
We do provide a significant amount of code that makes the user interface for you. You are not required to change that code.

Metadata

Summary Build a version of the simple card game Racko. Create the ability to play against the computer.
Topics
A neat application of linked list and arrays to simulate a card game.
Helps students understand the concept of abstraction by thinking of a deck of cards as simply an ordered collection of numbers.
Audience
The Python version is appropriate for CS1. It involves lots of list manipulation. The Java version relies on the ability to use a pre defined class and is more of a CS2 assignment.
Difficulty
This is an intermediate assignment and generally students are given 1 week to 10 days to do it.
Strengths
The biggest strength of the assignment is that it shows an application of two data structures to produce a game that the students can play against the computer. If the students do the version which requires them to come with their own strategy for the computer's move, it shows them how concepts seen in courses like discrete math/probability can be used in their programming assignments.
Weaknesses
The version that requires the student to come up with computer strategy has the usual weakness of strategies being tough to evaluate. Also students always want to know if their strategy is good enough. The version where the computer strategy is already provided suffers from the weakness of the inquisitive student spending too much time trying to understand exactly what the provided code does.
Dependencies
If done in Java, the assignment uses both Linked Lists and Arrays. If the Python version is used, the assignment only needs understanding of lists.
Variants
The assignment can be done using either Python or Java. Students can also build their own user interface if they have seen Swing (or any other graphics toolkit).