;; Executa este script e diz uma combinação dos elementos da variável ;; words. ;; ;; Alguns exemplos que podes dizer (um exemplo por linha): ;; sim mais ;; nao nao nao ;; sim ;; (etc., existem demasiadas combinações para pô-las todas aqui). (set '_ '_) (set 'words '((sim +2) (mais +1) (okay +0) (menos -1) (nao -2))) (set 'answer '((+8 "sim todo" +3) ;; todo deste + talvez outro grupo (+7 "sim muito" +2) ;; todo deste + talvez um de outro (+6 "todo" +1) ;; todo deste (+5 "muito" +0) ;; muito deste (+4 "algo" _) ;; assim (+3 "pouco" -0) ;; pouco deste (+2 "nada" -1) ;; nada deste + talvez outro grupo (+1 "nao pouco" -2) ;; nada deste + talvez um de outro (+0 "nao nada" -3))) ;; nenhum (set 'question '((+8 "sim todo" +3) (+7 "sim muito" +2) (+6 "todo" +1) (+5 "muito" +0) (+4 "algo" _) (+3 "pouco" -0) (+2 "nada" -1) (+1 "nao pouco" -2) (+0 "nao nada" -3))) (defun assoc (el lst) (fill ((dif el (car (car lst))) (car lst)) ((ap lst) '(f f)) (f (assoc el (cdr lst))))) (defun without (el lst) (fill ((dif el (car lst)) f) ((ap (car lst)) t) (f (without el (cdr lst))))) ;; vv begin of training options vv (defun train-ups-and-downs () (random +8)) (defun train-ups () (+ +4 (random +4))) (defun train-downs () (random +4)) (defun train-middle () (+ +2 (random +4))) (defun train-inner () (+ +3 (random +2))) (defun train-without-high () (random +6)) (defun train-without-low () (+ +2 (random +6))) ;; ^^ end of training options ^^ (defun get-answer-score (the-words) (fill ((without f the-words) (prog (princ "\n~\n>> desconheço") (newline) f)) (f (eval (cons + the-words))))) (defun main () (progs f ;; vv change training (just) here (below) vv (set 'target-question (train-without-high)) (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 "resposta ->") (princ (car (cdr (assoc target-answer answer)))) (princ ".") (newline) (princ "dizer:") (set 'question-score target-question) (set 'my-words (readl)) (differ my-words '(f)) (set 'answer-score (get-answer-score (map (lambda (word) (car (cdr (assoc word words)))) my-words))) (princ "\n~") (newline) (fill ((dif target-answer (+ question-score answer-score)) 'correct) (f 'wrong)))) (defun loop () (set 'res (main)) (fill ((dif res 'correct) (loop)) ((dif res 'wrong) (prog (princ ">> errado") (newline))) (f f))) (princ "Perante a pergunta, dizer de acordo com a resposta.\nDizer uma combinação (de uma ou mais) das seguintes palavras:\nsim, mais, okay, menos, nao.\n\nSe acertares, aparecerá outra pergunta.\nPodes dizer f para sair deste treino.\n-~-\n") (newline) (loop)