blob: 9deb0b0a3854128ba4f8c2d17d97b9f4e73c7aae (
plain)
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
|
;; Execute this script an say the proper combo found in the elements
;; of the words variable.
;;
;; A say may be the following examples (one example per line):
;; okay
;; no no
;; yes
;; (etc., there are more combos).
(set '_ '_)
(set 'words '((yes +1)
(okay +0)
(no -1)))
(set 'answer '((+2 "positival / wanting" +1)
(+1 "neutral / be" _)
(+0 "negatival / let-it" -1)))
(set 'question '((+2 "do irie" +1)
(+1 "do" _)
(+0 "do not" -1)))
(defun assoc (el lst)
(fill
((diff el (car (car lst))) (car lst))
((algo lst) '(f f))
(f (assoc el (cdr lst)))))
(defun without (el lst)
(fill
((diff el (car lst)) f)
((algo (car lst)) t)
(f (without el (cdr lst)))))
;; vv begin of training options vv
(defun train-ups-and-downs ()
(random +2))
(defun train-ups ()
(+ +1 (random +1)))
(defun train-downs ()
(random +1))
;; ^^ end of training options ^^
(defun get-answer-score (the-words)
(fill
((without f the-words)
(prog
(princ "\n~\n>> unrecognized answer")
(newline)
f))
(f (eval (cons + the-words)))))
(defun main ()
(progs
f
;; vv change training (just) here (below) vv
(set 'target-question (train-ups-and-downs))
(set 'it-quest (assoc target-question question))
(princ (car (cdr it-quest)))
(princ "\b?\n")
(newline)
;; vv change training (just) here (below) vv
(set 'target-answer (train-ups-and-downs))
(princ "answer ->")
(princ (car (cdr (assoc target-answer answer))))
(princ ".")
(newline)
(princ "say:")
(set 'question-score target-question)
(set 'my-words (readl))
(diff my-words '(f))
(set 'answer-score (get-answer-score
(map
(lambda (word)
(car (cdr (assoc word words))))
my-words)))
(princ "\n~")
(newline)
(fill
((diff target-answer
(+ question-score answer-score))
'correct)
(f 'wrong))))
(defun loop ()
(set 'res (main))
(fill
((diff res 'correct) (loop))
((diff res 'wrong) (prog (princ ">> wrong") (newline)))
(f f)))
(princ "Reply to the question, according to the answer.\nSay a combination (one or more) of the following words:\nyes, okay, no.\n\nAnother question will appear, if you say correctly.\nYou may say f to quit training.\n-~-\n")
(newline)
(loop)
|