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

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.

• A Python version - no UI, focus on creating the game and programming a computer strategy. Suitable for CS1
• A Java version - UI provided, computer strategy provided. Requires usage of classes to complete the assignment. Suitable for CS2

## 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

• To start the game, shuffle the deck, both the user and the computer pick a card from the deck. Let the computer pick first. The person who gets to play first is the person who has the higher number.
• The cards then get shuffled again and both the user and the computer gets dealt 10 cards. As a player receives each card, they must place it in the highest available slot in his rack, starting at slot 10, without rearranging any of them. The goal of each game is to create a sequence of numbers in ascending order, starting at slot 1.
• The top card of the deck is turned over to start the discard pile. A player takes a turn by taking the top card from either the deck or the discard pile, then discarding one from their rack and inserting the new card in its place. If the player draws a card from the deck, they may immediately discard it; if they takes the top discard, though, they must put it into their rack.
• The first player to get their 10 cards in ascending order wins the game.

## 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

• Download this zip file to get the template code that we want you to complete.
• The only file that you will need to edit is Racko.java.
• The file that contains the main function that needs to be run is RackoGame.java.

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.