diff --git a/app.zip b/app.zip new file mode 100644 index 0000000..979c406 Binary files /dev/null and b/app.zip differ diff --git a/code.js b/code.js index b4c8460..ad565b7 100644 --- a/code.js +++ b/code.js @@ -2,6 +2,9 @@ const right = 0; const left = 1; const non = 2; +const hyst = 2; +const toll = 2; + var code = [3, 14, 25, 9, 26]; var input = new Array(); @@ -21,9 +24,9 @@ var handleAngle = function(angle) { dir = left; else if (num - oldNum > countOfNumbers * 2 / 3) dir = right; - else if (oldNum > num) + else if (oldNum - num > hyst) dir = right; - else if (num > oldNum) + else if (num - oldNum > hyst) dir = left; else dir = oldDir; @@ -49,10 +52,19 @@ var handleAngle = function(angle) { var check = function() { if (code.length != input.length) + { + + alert("Tjo "+ input.join(" ")); + input = new Array(); return false; + } for (var i = 0; i < code.length; i++) { - if (code[i] != input[i]) + if (Math.abs(code[i] < input[i]) < toll) { + + alert("Tjo2 "+ input.join(" ")); + input = new Array(); return false; + } } window.location.href = "http://www.youtube.com/watch?v=aObeQUNELm4"; } \ No newline at end of file diff --git a/index.html b/index.html index 4682744..424520d 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@
- +