other stuff


games

Mastermind

My first program that I wrote in Eiffel. There’s a bug which I didn’t notice until after I had handed it up to my lecturer and which remains to this day, it occurs if there is a pair of numbers the same. Will possibly fix it.

Instructions

The aim of the mastermind game is to guess a codegiven appropriate clues. The code is a 4-digit number, drawn from 1 to 6. The code can be any number in the range 1111 to 6666.

The computer interrogates the user for a guess of a hidden code (that is generated by the computer). The computer should return the correct clues to each guess.

The clues return are evaluated as follows:

  • If the user has a correct number in the right postion the guess scores a ‘bull’
  • If the user has a correct guess in the wrong position the guess scores a ‘cow’

If one gets 4 bulls then one has got the correct code.

files