4.4.3 Bots
(require congame/components/bot) | package: congame-core |
Bots are scriptable automatons that traverse a study according to a bot model. A bot is made up of one or more bot steppers and a bot model is a mapping from locations in a study to bot behaviors. A bot stepper is an arbitrary procedure associated with a step that determines what the bot does when it reaches that step.
procedure
step : (or/c bot? bot-stepper?)
This is a primitive procedure used to implement study->bot. You should use study->bot unless you really know what you’re doing.
procedure
(bot-stepper? v) → boolean?
v : any/c
procedure
(make-bot-stepper step-id action) → bot-stepper?
step-id : symbol? action : (-> any/c)
As with make-bot, you shouldn’t normally need this procedure.
4.4.3.1 Making Bots
(require congame/components/bot-maker) | |
package: congame-core |
procedure
(study->bot s) → (-> model/c bot?)
s : study?
The model is called every time the bot lands on a step with the path to that step, represented as a list of symbols, and the default bot action for that step. The model can then decide whether to call the bot action or perform its own actions, or both.
At every step, the model can access instance and participant data through any study variables that it has access to. Within the dynamic extent of a model invocation, the current participant is the bot currently running the model.
4.4.3.2 Bot Actions
(require (submod congame/components/bot actions)) |
procedure
(run-bot b #:study-url url #:username username #:password password [ #:delay delay #:browser browser #:headless? headless? #:port port]) → void? b : bot? url : string? username : string? password : string? delay : real? = 0 browser : (or/c #f browser?) = #f headless? : boolean? = #t port : (or/c #f (integer-in 0 65535)) = #f
parameter
(current-page) → (or/c #f page?)
(current-page page) → void? page : (or/c #f page?)
procedure
(element-find elt selector) → (or/c #f element?)
elt : element? selector : string?
procedure
(element-find-all elt selector) → (listof element?)
elt : element? selector : string?
4.4.3.3 Running Bots From Studies
(require congame-web/components/study-bot) | |
package: congame-web |
Raises an exception if called outside of a step.