Add sine operation
John Smith

John Smith commited on 2022-360 17:33:26
Showing 1 changed files, with 9 additions and 1 deletions.


Player may opt to be challenged to mentally compute sine-values
for inputs from 0 to 1.5
... ...
@@ -23,10 +23,18 @@ local TYPES = {
23 23
         -- check quality of guess g for problem p
24 24
         score = function(p, g) return -(math.log(math.abs(math.log(p) - g), 10) + 1.5)^3 end,
25 25
     },
26
+    sin = {
27
+        gen = function()
28
+            return 1.5 * math.random()
29
+        end,
30
+        disp = "sin(%.3f)",
31
+        func = math.sin,
32
+        score = function(p, g) return -(math.log(math.abs(math.sin(p) - g), 10) + 1.5)^3 end
33
+    },
26 34
 }
27 35
 
28 36
 -- ideally, configure these parameters with options/inputs
29
-local TYPE = TYPES.ln
37
+local TYPE = TYPES.sin
30 38
 local TIME = 30
31 39
 
32 40
 local ts = 0
33 41