mastermind adaption in JavaScript
This is a simple adaption in JavaScript, an attempt to recreate MasterMind using HTML DOM, JavaScript and...CSS. I made this for a school project and the code has been made in 3 hours. I tried in optimizing the code as much as I could.
I am going to write comments in English, as for now they are in Italian.
If you want to try the game just follow this link:
https://dag7dev.github.io/MasterMindJS/
- at the beginning, a random colors sequence is generated.
- you need to guess what this random sequence is. Colors can repeat each other in a sequence.
- you should click on 1 2 3 or 4 to cycle the colors, then click "verify" button
- you could have three possibilities:
- white box: no colors guessed, no right position
- gray box: color guessed, no right position
- black box: color guessed, right position
For example: SEQUENCE GENERATED: red blue green violet YOUR INPUT: red yellow orange green RESULT:
- 1 black box
- 1 gray box
- 2 white boxes