


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Fu; Class: Architc&Assembly Lng; Subject: Computer Science; University: University of Massachusetts - Amherst; Term: Spring 2009;
Typology: Assignments
1 / 4
This page cannot be seen from the preview
Don't miss anything!



UMass Amherst Department of Computer Science Handout 12 CMPSCI 201: Architecture and Assembly Language April 23, 2009 Instructor: Prof. Kevin Fu
This programming assignment has two parts:
The game is played by two players: a codemaker and a codebreaker. The codemaker sets up a hidden code, which contains 4 arbitrary pegs drawn from 6 colors (repetition is allowed). Then the codebreaker makes repeated guesses (4 pegs) of the hidden code until the guessed code matches the hidden code or the number of guesses reaches the limit. At each round, the codebreaker makes a guess (putting 4 pegs into the 4 center holes in a row). After each guess, the codemaker provides feedback regarding that guess by placing key pegs into the smaller holes at the right hand side of that row. A black key peg indicates that one guessed peg matches one hidden peg at the same position and in the same color. A white key peg indicates that one guessed peg matches one hidden peg in color but not in the same position. The key pegs have no order information (the positions of key pegs do not matter). In this assignment, you will simulate the game using a program that interacts with the user (the codebreaker) on the console. The computer acts as the codemaker. The rules are as follows:
Preliminary Submission Due May 1st The purpose of the Preliminary Submission is to ensure you have designed correct abstractions for your functions. By May 1 st , you should submit a partial program that: