Introduction: Mastermind - Logik - Via Arduino and LCD
Hi, I'd like to introduce today my implementation for Mastermind, also known as Logik. In this implementation, the player does not guess the colors and their order as in the original - table version played by two players, but guesses the numbers and their order. It should be stressed that numbers cannot be repeated. The task of determining numbers and their order is Arduino, which generates them.
Step 1: Mastermind - Funcionality
Arduino continues to serve as an experiment counter and receives logic inputs via 5 buttons that switch against the ground (INPUT_PULLUP). Use the buttons to enter the user input in the form of numbers for positions. The last button confirms the entry and sends it to Arduino. In addition to the current user input, the LCD also shows the result.
If the user does not guess the number or the position, the display will show the corresponding position - if he guesses the number with the position, = will be displayed; if he guesses the number but not the position, C will be displayed. uncomment. In principle, it only displays the searched number on the display if the developer wants to test the functionality of the individual elements and to verify whether the game ends after attempting or guessing the searched number.
The game is limited to 10 player attempts. If the number of attempts is exceeded, the game is terminated with a message about the player's loss. If the player guesses the target number, the game ends with a statement of the player's winnings. The game is not limited in time. In the game, it is recommended to use pencil and paper to write entries, which can lead to a statistical advantage in finding the target number.
Step 2: Schematics + Source Codes
Source codes available at: https://arduino.php5.sk/mastermind-arduino.php?lang=en or ask for them at: firstname.lastname@example.org