MasterMind

by Nicholas on May 31, 2009

in software

Being a computer engineering student, I have had lots of exposure to both hardware and software.  One software project I did was with the Altera DE1 Board using NIOS assembly code.  Our last project in that course was one that was open to any program, so my friend and I decided to do MasterMind.  Although there were many challenges, we finished the project and I have attached the code so those who would like to play mastermind on their DE1 (or DE2) boards.  The DE1 board plays “We are the Champions” by Queen when you win but you will need to know how to incorporate a Wave file in order to make that work.

Download here.

The instructions are as follows.

Rules:

To start:

  1. Key 1 is the store answer key
  2. Key 3 is the start key

After started:

  1. Switch 2 to 9 are in pairs, each pair represent 1 digit of guess in binary numbers, so the answer is 4 digits (Possible answers include 0,1,2,3)
  2. You have 10 guesses until you lose, the red LED will keep count of the number of guesses.
  3. Hints will be displayed after each guess.
  4. It will also tell you if you’re closer or further from the correct answer.
  5. Key 1 to give up.
  6. If 1 digit of your guess is the same number and same place as the answer, 1 black hint will be displayed; If 1 digit of your guess is the same number but different place as the answer, 1 white answer will be displayed.
  7. When you win, it will tell you.  Then the green LED will tell you how long you took.
  8. It will also play “We are the Champions” by Queen.
  9. It then waits for the user to either store another code or start the game.

{ 2 comments… read them below or add one }

jackchen August 19, 2009 at 7:39 pm

thanks a lot for your articles,haha…..it help me a lot ……
I also have a DE1 board,but I always confused about it without anyone helping me,would you like make friends with me ?

Nicholas August 20, 2009 at 1:13 am

I’m glad you like it, I do a whole bunch of projects in University, I will try to keep this website updated.

Leave a Comment