spec4 - CSE 143 Winter 2010 Programming Assignment#4...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 of 4 CSE 143, Winter 2010 Programming Assignment #4: Assassin (20 points) Due Thursday, February 4, 2010, 11:30 PM This program focuses on implementing a linked list. Turn in a file named AssassinManager.java from the Homework section of the course web site. You will need the support files AssassinNode.java , AssassinMain.java , and names.txt from the Homework section of the course web site; place them in the same folder as your class. Program Description: "Assassin" is a real-life game often played on college campuses. Each person playing has a particular target that he/she is trying to "assassinate." Generally "assassinating" a person means finding them on campus in public and acting on them in some way, such as saying, "You're dead," or squirting them with a water gun, or touching them. One of the things that makes the game more interesting to play in real life is that initially each person knows only who they are assassinating; they don't know who is trying to assassinate them, nor do they know whom the other people are trying to assassinate. The game of assassin is played as follows: You start out with a group of people who want to play the game. For example, let's say that there are five people playing named Carol, Chris, Jim, Joe, Sally. A circular chain of assassination targets (called the "kill ring" in this program) is randomly established. For example, we might decide Joe should stalk Sally, Sally should stalk Jim, Jim should stalk Carol, Carol should stalk Chris, and Chris should stalk Joe. (In the actual linked list that implements this kill ring, Chris's next reference would be null . But conceptually we can think of it as though the next person after Chris is Joe, the front person in the list.) Here is a picture of this "kill ring": When someone is assassinated, the links need to be changed to "skip" that person. For example, suppose that Jim is assassinated by Sally. Sally needs a new target, so we give her Jim's target: Carol. The kill ring becomes: If the first person in the kill ring is assassinated, the front of the list must adjust. If Chris kills Joe, the list becomes: You will write a class AssassinManager that keeps track of who is stalking whom and the history of who killed whom. You will maintain two linked lists: a list of people currently alive (the "kill ring") and a list of those who are dead (the "graveyard"). As people are killed, you will move them from the kill ring to the graveyard by rearranging links between nodes. The game ends when only one node remains in the kill ring, representing the winner. A client program has been written for you called AssassinMain . It reads a file of names, shuffles the names, and constructs an object of your class AssassinManager . This main program then asks the user for the names of each victim to kill until there is just one player left alive (at which point the game is over and the last remaining player wins). AssassinMain
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/04/2011 for the course CSE 143 taught by Professor Sr during the Spring '08 term at University of Washington.

Page1 / 4

spec4 - CSE 143 Winter 2010 Programming Assignment#4...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online