Skip to content

Commit

Permalink
Ad sanity test to function (goal ...), make hint in done button
Browse files Browse the repository at this point in the history
refer to goalprop english.  Don't make model for done button.
  • Loading branch information
bvds committed Dec 8, 2011
1 parent 8741bec commit 7a0eb6b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
9 changes: 6 additions & 3 deletions Help/NextStepHelp.cl
Expand Up @@ -1032,12 +1032,15 @@
(cond ((nsh-prompt-bodies?) (nsh-start-bodies))
((nsh-prompt-axis?) (nsh-new-start-axis))
((nsh-prompt-givens?) (nsh-new-start-givens))
((equal *nsh-problem-type* 'no-quant) (nsh-start-no-quant))
((equal *nsh-problem-type* 'mc-only) (nsh-mc-only-start))
((eql *nsh-problem-type* 'no-quant) (nsh-start-no-quant))
((eql *nsh-problem-type* 'mc-only) (nsh-mc-only-start))
((nsh-start-principle-free?) (nsh-start-principle-free))
;; At this point we know that an error has occured so we
;; need to signal that to the system for later use.
(t (error "Invalid problem setup supplied."))))
(t (warn 'webserver:log-warn
:tag (list 'nsh-prompt-start-invalid (problem-name *cp*)
*nsh-problem-type*)
:text "Invalid problem setup supplied."))))


;;;; -----------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion Help/SolutionGraph.cl
Expand Up @@ -374,7 +374,10 @@
:Sources (list Do)
:Prereqs (wrap-if (sg-collect-sysent-prereqs Entry Stack))
;; This doesn't give anything useful for axes, just the number.
:model (unless (member (car entry) '(choose-answer eqn implicit-eqn draw-axes))
;; Done button is a goalprop.
:model (unless (member (car entry)
'(done choose-answer
eqn implicit-eqn draw-axes))
(new-english-find (reduce-prop entry)))))

;;; Determination of what is and is not a prerequisite depends upon the problem
Expand Down
6 changes: 4 additions & 2 deletions KB/problem-solving.cl
Expand Up @@ -653,9 +653,11 @@
:effects ((choose-answer ?question-id ?correct-choice)))

(defoperator done-button (?activity)
;; no preconditions
;; Sanity test: ?activity must be a registered goalprop
:preconditions ((test (or (goalprop-exp-p ?activity)
(error "~A must be a goalprop." ?activity))))
:effects ((done ?activity))
:hint ((point (string "Are you finished ~A?" ?activity))
:hint ((point (string "Are you finished ~A?" (?activity goal)))
(teach (string "When you are finished, hit the \"Done\" button."))
(bottom-out (string "Hit the \"Done\" button now."))))

Expand Down
11 changes: 7 additions & 4 deletions Knowledge/nlg.cl
Expand Up @@ -278,10 +278,13 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
(defun goal (x &rest args)
(if (atom x)
(lower-case x args)
(or (nlg-find x *Ontology-GoalProp-Types* #'GoalProp-Form #'GoalProp-nlg-english)
(format nil "[GOAL: ~A]" x))))
(or
(nlg-find x *Ontology-GoalProp-Types* #'GoalProp-Form
#'GoalProp-nlg-english)
;; Want backtrace if this fails
(progn (warn "Goal ~A not found in *Ontology-GoalProp-Types*" x)
(format nil "[GOAL: ~A]" x))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
(defun psm-exp (x &rest args)
Expand Down

0 comments on commit 7a0eb6b

Please sign in to comment.