diff --git a/index.html b/index.html new file mode 100644 index 0000000..6bdce6e --- /dev/null +++ b/index.html @@ -0,0 +1,34 @@ + + + + The Pattern Guessing Game + + + +

Guess the Pattern

+ + +
+ +
+ +
+
+
+
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..98a869d --- /dev/null +++ b/script.js @@ -0,0 +1,153 @@ +var sequence = []; +var colSequence = []; +var colors = []; +var circles = document.querySelectorAll(".circle"); +var startBtn = document.querySelector("#start"); +var h1 = document.querySelector("h1"); +var body = document.querySelector("body"); +var modes = document.querySelectorAll(".mode"); +var play = document.querySelector("#play"); + +var numCircles = 6; +var cur = 0; +var curToBeClicked = 0; +var numModes = 3; +var interval = 1000; +var animInterval = 200; +init(); +function init(){ + reset(); + addEventListenerToAll(); +} + +function reset(){ + cur = 0; + curToBeClicked = 0; + sequence = []; + colSequence = []; + colors = []; + generateRandomColors(); + AssignColors(); + generateRandomSequence(); +} +function generateRandomColors(){ + for(var i =0;i