mipstermind.c: Mipstermind
mipstermind.c is an implementation of the classic board game Mastermind!
An example game of Mastermind can be seen to the right. A game of
Mastermind takes place over a number of turns, as you battle the
Copyright By PowCoder代写 加微信 powcoder
computer to guess its secret codeword!
Each turn, you are allowed to make a single guess of the codeword. If your
guess is correct, you win the game! However, if you run out of turns, you
lose the game.
In order to aid you in your task, after each guess, you are given some
puzzling information to help guide your further guesses. In particular, you
are told how many of your guesses were correct in the correct place, and
how many were correct, but in the incorrect place.
Using this information, you can (hopefully) make a guess that is somewhat
closer to the secret codeword.
To get a feel for this game, try it out in a terminal:
$ dec mipstermind.c -o mipstermind
$ ./mipstermind
You should read through mipstermind.c. There are comments throughout it
that should help you understand what the program is doing citation needed
– which you’ll need for the next part of the assignment.
$ 1521 mipsy normal.s mipstermind.s
Guess length:
Valid guesses:
How many turns: 10
Enter a random seed: e
— Turn 1 –
Enter your guess: 1 2 3 4
Correct guesses in correct place:
Correct guesses in incorrect place: 3
-[ Turn 2 ]-
Enter your guess: 4 3 2 1
Correct guesses in correct place:
Correct guesses in incorrect place: 2
—[ Turn 3 1–.
Enter your guess: 4 4 3 1
Correct guesses in correct place:
Correct guesses in incorrect place: 3
–[ Turn 4 ] –
Enter your guess: 4 1 3 4
Correct guesses in correct place:
Correct guesses in incorrect place: 2
—[ Turn 5 1- —
Enter your guess: 4 1 4 3
You win, congratulations!
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com