-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlearning.html
138 lines (137 loc) · 3.66 KB
/
learning.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html>
<head><meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>Learning to estimate</title>
</head>
<body><input type="range" min="0" max="200" value="100" class="slider" id="slider">
<div id="starttext">Welcome! In this website, you will be learning to estimate semi-random processes. To do this, make sure your sound is enabled. Your goal is to move the handle on the slider to make the number of clicks per second maximized. Do this as quickly as possible and when you feel that you have suceeded, click Done! when you want to start, click the StartSound button. </div>
<style type="text/css">
#starttext{
position:fixed;
left:25%;
width: 50%;
top:20%;
height:40%;
}
#slider{
position:fixed;
-webkit-appearance: none;
width:50%;
height:100px;
background-color: blue;
left:25%;
top:87%;
}
#slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
border-radius:50px;
width: 100px;
height: 100px;
background: grey;
}button{
font-size: 28pt;
width:30%;
height:10%;
}#done{position:fixed;
left:70%;
}
</style>
<button onclick="w = setInterval(formula,1); run()"> StartSound</button>
<button id = "done" onclick="stop()"> Done!</button>
<script>
var a = Math.floor(Math.random()*200)
var w;
var ins;
var val;
var i=0;
var rd = 0;
var x = 0;
var blip = new Audio('blip.mp3');
var tensec=0;
var sec=0;
var min=0;
var z=2;
var time="";
var y;
var name;
var r=[];
var s;
var u = 1
var p=0;
var ntime;
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "theo is kool";
}
if(getCookie("avg")>50){
if(getCookie("max")!=="100"){
var qs=parseInt(getCookie("max"))-2.5
}else{var qs=100}
if(getCookie("dr")!==".98"){
var q=parseFloat(getCookie("dr"))+0.005
};
}else if(getCookie("avg")<=50){
var qs=parseInt(getCookie("max"))+2.5
var q=parseFloat(getCookie("dr"))-0.01
}else{
var q = .97;
var qs = 100;
}
function runclock(){
if(z!==1){
tensec++
}
if(tensec>60){tensec=00
sec++
}time = String(sec)+"."+String(tensec)
z++
};
function run() {
y=setInterval(runclock, (16+(2/3)))
s=setInterval(record, 500)
};
function formula(λ) {
x = Math.abs(document.getElementById("slider").value);
rd = Math.ceil(Math.random()*(qs-(100*(Math.pow(q, Math.abs(a-x))))))
if(rd == 1){i++
//console.log(average())
blip.play();
}
}function record(){
r.push(String(Math.abs(a-x)))
}function average(){
for (var i = r.length - 1; i >= 0; i--) {
parseFloat(r[i])+p
p=parseFloat(r[i])+p
}return p/r.length;
}
function stop(){
clearInterval(y);
clearInterval(w);
clearInterval(s);
document.cookie='dr='+String(q)+';expires=Wed, 18 Dec 2023 12:00:00 GMT';
document.cookie='max='+String(qs)+';expires=Wed, 18 Dec 2023 12:00:00 GMT';
document.cookie='avg='+String(average())+';expires=Wed, 18 Dec 2023 12:00:00 GMT';
if(average()>50){
alert("better luck next time")
}else if(average()<=50){
alert("success")
}
alert("This page will redirect you to the next step.")
location.reload()
}
</script>
</body>
</html>