Share Files

Mastermind Game for Mathstudio

This is a implementation of the famous mastermind game for mathstudio
You start the game with the function mstart which creates a random array of digits stored in the init variable

means you have to guess 4 different digits out of 6 digits (1,2,3,4,5,6)

;0 at the end hides the Output

alternatively you can call mstart with a third Parameter

means two or more same digits are allowed

You input your guesses by calling the function mtry until the solution is found

mtry([1,2,3,4],init) gives the output
means that 3 digits are right but no digit has the right Position

1.2 as output
means 3 digits are right and one has the right Position

If all digits are right and in the right Position the game is over

If you are not patient you can
see the solution by typing the content of the variable

Enjoy the game!