?? what types of files will be needed?

Write a program that plays the game MasterMind. The program should create a list of 4 color; the available colors are (R)ed, (G)reen, (P)urple, (Y)ellow, (B)lack and (W)hite. The player must then guess your colors in the correct sequence; validate the list of colors entered. For each correct color guess in the correct position, display a black peg (just 'B'). For each correct color guess not in the correct position, display a white peg (just 'W'). Give the player 12 tries to guess your colors. If the player recieves 4 Black pegs, display a win message. If guess counter reaches 12, display a lose message and display your colors. See an example of the running program below. Functions should be used to create the initial color list, validate the entered list of colors and return guess matches. Include an SDM for the program and any other appropriate documentation.
Output:
Lets play MasterMind!

I am thinking of a series of 4 colors. You have 12 tries to guess the correct
colors in the correct order. After each of your guesses, I will display a B for
each guess correct color in the correct order and a W for each guess correct color
in the wrong order. The available colors are (R)ed, (G)reen, (P)urple, (Y)ellow,
(B)lack and (W)hite. Use only the first character of the color when guessing
(i.e. - RYBG). Duplicate colors are allowed (i.e. - BYGB).

Good Luck!

Guess 1: BBBB : BB
Guess 2: WWWW :
Guess 3: GGGG : B
Guess 4: YYYY :
Guess 5: PPPP :
Guess 6: RRRR : B
Guess 7: BBGR : BWWW
Guess 8: BGRB : WWWW
Guess 9: GBBR : BBWW
Guess 10: RBBG : BBBB

Congratulations!!!! You Guessed my color pattern!

Would you like to play again (Y or N)? N

Thanks for playing!

(if they had guessed 12 times you would display)

Too Bad! My color pattern was RBBG.
Please clarify what you need help on.
How many functions is needed for this?
closed account (o1vk4iN6)
There's no set number of functions, you could probably code that all without using a single function, though you will probably have a lot of duplicate code then. Not to mention a giant pile of mess.
Last edited on
Depends on what you want to do.

You might want to use 500, you might want to use 2. Those numbers are a bit extreme for your project, but you get the picture. It's all up to how you want to design the program, and how you want it to work.
Topic archived. No new replies allowed.