Mastermind- Logik - Arduino + LCD 20x4

14/08/2020

Today I will present my implementation for the game Mastermind, which is also known as Logic. In this implementation, the player does not guess the colors and their order as in the original - table version, which is played by two players, but guesses the numbers and their order. It must be emphasized that the numbers cannot be repeated. The task of determining the numbers and their order is Arduino, which generates them.

The Arduino also serves as an attempt counter and receives logic inputs via 5 buttons that switch to ground (INPUT_PULLUP). The keys are used to enter user input in the form of position numbers. The last button confirms the entry and sends it to Arduino. In addition to the current user input, the LCD display also shows the result.

If the user does not guess the number or the position, the display will show - if he guesses the number with the position, = will appear, if he guesses the number but not the position, C will be displayed for development purposes. must be uncommented. In principle, it only displays the searched number on the display if the developer wants to test the functionality of individual elements and verify whether the game ends after exceeding the attempts or guessing the searched number.

The game is limited to 10 player attempts. If the number of attempts is exceeded, the game ends with a message about the player losing. If the player guesses the target number, the game ends with a statement of the player's win. The game is not limited in time. When playing the game, it is also recommended to use a pencil and paper to write down your entries, which can lead to a statistical advantage when searching for a target number.

Wiring diagram for Mastermind:

 LCD display library: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library

Program for Mastermind: https://arduino.php5.sk/mastermind-arduino.php?lang=en
© 2021 Martin Chlebovec - Arduino Blog - . All rights reserved
Powered by Webnode Cookies
Create your website for free! This website was made with Webnode. Create your own for free today! Get started