;;; toplevel stuff
(clear-all)
(pm-reset)
;(pm-add-types-and-chunks)
;;; ACT-R parameters
(sgp :era t :er t)
(sgp :egs 0.1)
(sgp :v nil)
;;; RPM parameters
(pm-set-params :auto-dequeue t)
(pm-set-params :randomize-time t)
(pm-set-params :optimize-visual nil)
(pm-set-params :motor-proc-events t)
(pm-set-params :visual-source-activation 2.0)
(pm-set-char-feature-set :BRIGGS-HOCEVAR)
(pm-start-hand-at-mouse)
;;; initialization
(chunk-type do-menu target state feat move-to)
(add-dm (topgoal isa do-menu))
(goal-focus topgoal)
;;;; ---------------------------------------------------------------------- ;;;;
;;;; Acquire the target
(p look-label
=goal>
isa do-menu
target nil
=loc>
isa visual-location
time now
screen-x LOWEST
attended nil
=vis>
isa module-state
module :vision
modality free
=mot>
isa module-state
module :motor
modality free
==>
!send-command! :VISION move-attention :location =loc :scale WORD
!send-command! :MOTOR move-cursor :loc =loc
)
(p see-label
=goal>
isa do-menu
target nil
=obj>
isa visual-object
time now
value "target"
=loc>
isa visual-location
time now
attended nil
screen-x HIGHEST
value =feat
=vis>
isa module-state
module :vision
modality free
==>
!send-command! :VISION move-attention :location =loc :scale letter
=goal>
feat =feat
)
(p grab-target-char
=goal>
isa do-menu
target nil
- feat nil
=obj>
isa visual-object
time now
value =val
=mot>
isa module-state
module :motor
modality free
==>
=goal>
target =val
state "initial"
!send-command! :MOTOR click-mouse
)
;;;; ---------------------------------------------------------------------- ;;;;
;;;; Checking for a match
(p found-match
=goal>
isa do-menu
target =char
state "looking"
=obj>
isa visual-object
time now
value =char
=mot>
isa module-state
module :motor
processor free
==>
!send-command! :MOTOR move-cursor :object =obj
=goal>
state "found"
)
(p click-the-match
=goal>
isa do-menu
state "found"
=mot>
isa module-state
module :motor
processor free
last-command move-cursor
==>
!send-command! :MOTOR click-mouse
)
(p done
=goal>
isa do-menu
state "found"
=mot>
isa module-state
module :motor
modality free
last-command click-mouse
==>
!pop!
)
;;;; ---------------------------------------------------------------------- ;;;;
;;;; First shift
(p attend-first-position
=goal>
isa do-menu
target =val
state "initial"
=obj>
isa visual-object
time now
value =val
=loc>
isa visual-location
time now
attended nil
screen-y (WITHIN 53 106)
=vis>
isa module-state
module :vision
modality free
==>
!send-command! :VISION move-attention :location =loc
=goal>
state "looking"
move-to =loc
)
(p attend-second-position
=goal>
isa do-menu
target =val
state "initial"
=obj>
isa visual-object
time now
value =val
=loc>
isa visual-location
time now
attended nil
screen-y (WITHIN 106 159)
=vis>
isa module-state
module :vision
modality free
==>
!send-command! :VISION move-attention :location =loc
=goal>
state "looking"
move-to =loc
)
(p attend-third-position
=goal>
isa do-menu
target =val
state "initial"
=obj>
isa visual-object
time now
value =val
=loc>
isa visual-location
time now
attended nil
screen-y (WITHIN 159 212)
=vis>
isa module-state
module :vision
modality free
==>
!send-command! :VISION move-attention :location =loc
=goal>
state "looking"
move-to =loc
)
(p attend-fourth-position
=goal>
isa do-menu
target =val
state "initial"
=obj>
isa visual-object
time now
value =val
=loc>
isa visual-location
time now
attended nil
screen-y (WITHIN 212 265)
=vis>
isa module-state
module :vision
modality free
==>
!send-command! :VISION move-attention :location =loc
=goal>
state "looking"
move-to =loc
)
(p attend-fifth-position
=goal>
isa do-menu
target =val
state "initial"
=obj>
isa visual-object
time now
value =val
=loc>
isa visual-location
time now
attended nil
screen-y (WITHIN 265 318)
=vis>
isa module-state
module :vision
modality free
==>
!send-command! :VISION move-attention :location =loc
=goal>
state "looking"
move-to =loc
)
;;;; ---------------------------------------------------------------------- ;;;;
;;;; Going down.
(p down-nearest-hit
=goal>
isa do-menu
target =char
feat =feat
=obj>
isa visual-object
time now
screen-pos =current
value =val
!eval! (not (equal =char =val))
=newloc>
isa visual-location
time now
attended nil
value =feat
screen-y GREATER-THAN-CURRENT
nearest =current
=vis>
isa module-state
module :vision
modality free
==>
!send-command! :VISION move-attention :location =newloc
=goal>
current nil
move-to =newloc
)
;;;; ---------------------------------------------------------------------- ;;;;
;;;; Going anywhere
(p anywhere
=goal>
isa do-menu
target =char
feat =feat
=obj>
isa visual-object
time now
screen-pos =current
value =val
!eval! (not (equal =char =val))
=newloc>
isa visual-location
time now
attended nil
=vis>
isa module-state
module :vision
modality free
==>
!send-command! :VISION move-attention :location =newloc
=goal>
current nil
move-to =newloc
)
|