[SEAV Softwares Logo]



Home Page
Program Nook
Instructional
Open Forum
Portfolio
Visitor's Area
Connections
About the Site

Case Study Problem C1
Mastermind Game
Game Programming / Novice level

Remember that pocket game, called Mastermind™, where you guess a color pattern by fixing tiny colored pegs onto a box with holes? Well, it's very, very easy to make a simple clone of that game.
Make a text mode program that creates a random 4-letter pattern (use the letters A to F, repetitions allowed) and let the user try to guess that pattern. The player must enter his 4-letter guess by inputting a string. Then the program must analyze his or her guess and give feedback: the program must show how many letters are in the correct position and how many letters are in the wrong position (do not tell which letter). The game keeps on accepting the player's guess and showing the result until the player finds the correct pattern. Another 4-letter pattern may be generated at this point, if desired.

DFFC

ABCD 0 2
EFEF 1 1
EEEE 0 0
ABFF 1 1
FCDF 0 4
CFFD 2 2
DFFC 4 0

ESTIMATE COST = TOP AREA x WIDTH x $20 + WIDTH x $10

Show this estimate plus the estimate for the whole table (recall that the 90% of a table's cost lies in the table top). Afterwards, the whole program should repeat unless the user presses Esc.



Go back to the Case Study page.

Home Page | Program Nook | Instructional | Open Forum
Portfolio | Visitor's Area | Connections | About the Site

Copyright © 1997-1999, SEAV Softwares. All rights reserved.
Webmaster: Eugene Villar (SEAV); e-mail: [email protected]