From 9b95c9663a01c614ab0867ff7dfca775d8a7d69e Mon Sep 17 00:00:00 2001 From: Apple Date: Sun, 21 Jun 2020 11:10:02 -0500 Subject: [PATCH] commit my changes --- main.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 64ca54b..0d80df4 100644 --- a/main.js +++ b/main.js @@ -29,11 +29,29 @@ const getRandomInt = (min, max) => { } const generateHint = () => { + for (let i=0; i < solution.length; i++) { + if (answer[i] == solution[i]) { + + solution[i] = "matched"; + answer[i] = "check"; + } + } // your code here } const mastermind = (guess) => { - solution = 'abcd'; // Comment this out to generate a random solution + + pick1 = colors[Math.floor(Math.random() * 8)]; + pick2 = colors[Math.floor(Math.random() * 8)]; + pick3= colors[Math.floor(Math.random() * 8)]; + pick4 = colors[Math.floor(Math.random() * 8)]; + + answer = [pick1, pick1, pick3, pick4]; + console.log(answer); + + + + // your code here }