|
7 | 7 |
|
8 | 8 | ;; load ghost rules |
9 | 9 | (begin (display "Loading Ghost Scripts...") (newline)) |
10 | | -(ghost-parse-file (string-append TOPDIR "/ghost/concepts_1.ghost")) |
| 10 | +;(ghost-parse-file (string-append TOPDIR "/ghost/concepts_1.ghost")) |
11 | 11 | (ghost-parse-file (string-append TOPDIR "/ghost/character_1.ghost")) |
12 | 12 | (ghost-parse-file (string-append TOPDIR "/ghost/intro1.ghost")) |
| 13 | +(ghost-parse-file (string-append TOPDIR "/ghost/chitchat.ghost")) |
13 | 14 | (begin (display "Done Loading Ghost Scripts.") (newline)) |
14 | 15 |
|
15 | 16 |
|
|
22 | 23 |
|
23 | 24 | ; check if a face in sight |
24 | 25 | (define-public (sense-any-face? atom) |
| 26 | + (begin (display "** sensing for a face **") (newline)) |
25 | 27 | (set! no_faces (cog-value->exact (cog-value Afs Anof))) |
26 | 28 | (if (> no_faces 0) |
27 | 29 | (cog-new-stv 1 1) |
|
32 | 34 | ; is sensed. The sensors would set a floatvalue with |
33 | 35 | ; the arg node as the atom and the (PredicateNode "number_of") as key |
34 | 36 | (define-public (sense-any? atom) |
| 37 | + (begin (display "** generic sense any? **") (newline)) |
35 | 38 | (set! no_faces (cog-value->exact (cog-value atom Anof))) |
36 | 39 | (if (> no_faces 0) |
37 | 40 | (cog-new-stv 1 1) |
38 | 41 | (cog-new-stv 0 1))) |
39 | 42 |
|
40 | 43 |
|
41 | 44 | (define-public (sense-find-smiling-face) |
| 45 | + (begin (display "** sensing for smiling face **") (newline)) |
42 | 46 | (set! smiling_face_idx 0) |
43 | 47 | (if (> no_faces 0) |
44 | 48 | (do ((i 1 (+ 1 i))) ((> i no_faces)) |
|
47 | 51 |
|
48 | 52 | ; set the index of a non neutral face to nonneutral-face-idx |
49 | 53 | (define-public (sense-find-emotional-face) |
| 54 | + (begin (display "** sensing for an emotional face **") (newline)) |
50 | 55 | (set! nonneutral-face-idx 0) |
51 | 56 | (if (> no_faces 0) |
52 | 57 | (do ((i 2 (1+ i))) ((> i no_faces)) |
|
56 | 61 |
|
57 | 62 | ; before looking at face check if any faces first and return false if none |
58 | 63 | (define-public (look-face atom) |
| 64 | + (begin (display "** executing behave find face to look at **") (newline)) |
59 | 65 | (cog-evaluate! behave-find-face-to-look)) |
60 | 66 |
|
61 | 67 |
|
|
66 | 72 | ; look at a single face |
67 | 73 | ; first check if only one face in view |
68 | 74 | (define-public (look-single-face atom) |
| 75 | + (begin (display "**> look single face **") (newline)) |
69 | 76 | (if (eq? no_faces 1) |
70 | 77 | (begin |
71 | 78 | (act-face-a-point (cog-value->list (cog-value (ConceptNode "face_1") Apos_h))) |
|
75 | 82 |
|
76 | 83 | ; face a smiling face if any |
77 | 84 | (define-public (look-smiling-face atom) |
| 85 | + (begin (display "**> look smiling face **") (newline)) |
78 | 86 | (sense-find-smiling-face) |
79 | 87 | (if (eq? smiling_face_idx 0) ; if smiling_face_idx is zero, there is no smiling face |
80 | 88 | (cog-new-stv 0 1) ; so return failure |
|
90 | 98 | ; in general any face which isn't neutral |
91 | 99 | ; set something here to aid a ghost gambit in saying "why the _____ face" |
92 | 100 | (define-public (look-emotional-face atom) |
| 101 | + (begin (display "**> look emotional face **") (newline)) |
93 | 102 | (sense-find-emotional-face) |
94 | 103 | (if (eq? nonneutral-face-idx 0) |
95 | 104 | (cog-new-stv 0 1) |
|
102 | 111 |
|
103 | 112 | ; face one of the neutral faces just at random |
104 | 113 | (define-public (look-random-face atom) |
| 114 | + (begin (display "**> look random face **") (newline)) |
105 | 115 | (if (eq? no_faces 0) |
106 | 116 | (cog-new-stv 0 1) |
107 | 117 | (begin |
|
116 | 126 |
|
117 | 127 | ; look at a salient point |
118 | 128 | (define-public (look-salient-point atom) |
| 129 | + (begin (display "**> look at salient point **") (newline)) |
119 | 130 | (begin |
120 | 131 | (act-face-a-point (cog-value->list (cog-value Aey Apos_h))) |
121 | 132 | (cog-new-stv 1 1))) |
|
159 | 170 | (GroundedPredicateNode "scm: look-salient-point") |
160 | 171 | (PredicateNode "look")))) |
161 | 172 |
|
| 173 | +(define-public (oc-bt) |
| 174 | + (while #t |
| 175 | + (begin (display "** executing main BT **") (newline)) |
| 176 | + (cog-evaluate! behave-looking) |
| 177 | + (usleep 5000000))) |
162 | 178 |
|
163 | | -(cog-evaluate! behave-looking) |
| 179 | + |
| 180 | +(call-with-new-thread oc-bt) |
0 commit comments