2022-01-21 21:48:05 +03:00
|
|
|
:: %khan, thread runner
|
|
|
|
!:
|
|
|
|
!? 164
|
|
|
|
::
|
|
|
|
|= our=ship
|
|
|
|
=> |%
|
|
|
|
+$ move [p=duct q=(wite note gift:khan)]
|
|
|
|
+$ note :: out request $->
|
2022-01-26 02:37:48 +03:00
|
|
|
$~ [%g %deal *sock *term *deal:gall]
|
2022-01-22 04:46:59 +03:00
|
|
|
$% $: %g :: to %gall
|
|
|
|
$>(%deal task:gall) :: full transmission
|
|
|
|
== == ::
|
2022-01-21 21:48:05 +03:00
|
|
|
+$ sign :: in response $<-
|
2022-01-26 04:43:48 +03:00
|
|
|
$% $: %gall
|
|
|
|
$>(%unto gift:gall)
|
|
|
|
==
|
|
|
|
$: %khan
|
|
|
|
$>(%avow gift:khan)
|
|
|
|
== ==
|
2022-01-21 21:48:05 +03:00
|
|
|
+$ khan-state
|
|
|
|
$: %0
|
|
|
|
unix-duct=duct
|
2022-01-27 04:41:01 +03:00
|
|
|
out-dais=(map duct dais:clay)
|
2022-01-21 21:48:05 +03:00
|
|
|
==
|
|
|
|
--
|
2022-01-22 04:46:59 +03:00
|
|
|
=>
|
|
|
|
|%
|
2022-01-27 04:41:01 +03:00
|
|
|
++ get-dais
|
|
|
|
|= [=beak =mark rof=roof]
|
|
|
|
^- dais:clay
|
|
|
|
?~ ret=(rof ~ %cb beak /[mark])
|
|
|
|
~|(%mark-unknown !!)
|
|
|
|
?~ u.ret
|
|
|
|
~|(%mark-invalid !!)
|
|
|
|
?> =(%dais p.u.u.ret)
|
|
|
|
!<(dais:clay q.u.u.ret)
|
2022-01-22 04:46:59 +03:00
|
|
|
++ start-spider
|
2022-01-26 02:37:48 +03:00
|
|
|
|= [our=@p =cage]
|
|
|
|
^- note
|
|
|
|
[%g %deal [our our] %spider %poke cage]
|
2022-01-22 04:46:59 +03:00
|
|
|
++ watch-spider
|
2022-01-26 02:37:48 +03:00
|
|
|
|= [our=@p =path]
|
|
|
|
^- note
|
|
|
|
[%g %deal [our our] %spider %watch path]
|
2022-01-22 04:46:59 +03:00
|
|
|
--
|
2022-01-21 21:48:05 +03:00
|
|
|
=| khan-state
|
|
|
|
=* state -
|
|
|
|
|= [now=@da eny=@uvJ rof=roof]
|
|
|
|
=* khan-gate .
|
|
|
|
^?
|
|
|
|
|%
|
|
|
|
:: +call: handle a +task:khan request
|
|
|
|
::
|
|
|
|
++ call
|
|
|
|
|= $: hen=duct
|
|
|
|
dud=(unit goof)
|
|
|
|
wrapped-task=(hobo task:khan)
|
|
|
|
==
|
|
|
|
^- [(list move) _khan-gate]
|
|
|
|
::
|
|
|
|
=/ =task:khan ((harden task:khan) wrapped-task)
|
2022-01-26 08:28:45 +03:00
|
|
|
?+ -.task [~ khan-gate]
|
2022-01-22 01:09:01 +03:00
|
|
|
%born
|
2022-01-27 04:41:01 +03:00
|
|
|
:- ~
|
|
|
|
%= khan-gate
|
|
|
|
unix-duct hen
|
|
|
|
out-dais *(map duct dais:clay)
|
|
|
|
==
|
2022-01-22 01:09:01 +03:00
|
|
|
%fyrd
|
2022-01-26 08:28:45 +03:00
|
|
|
=/ wir=wire (head hen)
|
|
|
|
=/ rid=@ta (rear wir)
|
2022-01-27 03:26:30 +03:00
|
|
|
=* fyd p.task
|
2022-01-27 04:41:01 +03:00
|
|
|
?: (~(has by out-dais) hen)
|
|
|
|
~|(%fyrd-duplicate-rid !!)
|
2022-01-22 04:46:59 +03:00
|
|
|
=/ tid=@ta
|
|
|
|
(cat 3 'khan-fyrd--' rid)
|
2022-01-27 03:26:30 +03:00
|
|
|
=/ =beak
|
|
|
|
?@(bear.fyd [our bear.fyd %da now] [our bear.fyd])
|
2022-01-27 04:41:01 +03:00
|
|
|
=/ =dais:clay (get-dais beak p.data.fyd rof)
|
2022-01-26 02:37:48 +03:00
|
|
|
=/ args
|
2022-01-27 03:26:30 +03:00
|
|
|
:* ~ `tid beak name.fyd
|
|
|
|
(vale.dais q.data.fyd)
|
2022-01-22 04:46:59 +03:00
|
|
|
==
|
2022-01-26 02:37:48 +03:00
|
|
|
=/ start-moves=(list move)
|
|
|
|
%+ turn
|
2022-01-26 08:28:45 +03:00
|
|
|
:~ (watch-spider our /thread-result/[tid])
|
|
|
|
(start-spider our %spider-start !>(args))
|
2022-01-26 02:37:48 +03:00
|
|
|
==
|
|
|
|
|=(=note ^-(move [hen %pass //g note]))
|
2022-01-27 04:41:01 +03:00
|
|
|
=. out-dais
|
|
|
|
%+ ~(put by out-dais) hen
|
|
|
|
(get-dais beak mark.fyd rof)
|
2022-01-22 04:46:59 +03:00
|
|
|
[start-moves khan-gate]
|
2022-01-22 01:09:01 +03:00
|
|
|
==
|
2022-01-21 21:48:05 +03:00
|
|
|
:: +load: migrate an old state to a new khan version
|
|
|
|
::
|
|
|
|
++ load
|
|
|
|
|= old=khan-state
|
|
|
|
^+ khan-gate
|
|
|
|
khan-gate(state old)
|
2022-01-26 08:28:45 +03:00
|
|
|
:: +scry: nothing to see as yet
|
2022-01-21 21:48:05 +03:00
|
|
|
::
|
|
|
|
++ scry
|
|
|
|
^- roon
|
|
|
|
|= [lyc=gang car=term bem=beam]
|
|
|
|
^- (unit (unit cage))
|
|
|
|
~
|
|
|
|
++ stay state
|
2022-01-26 08:28:45 +03:00
|
|
|
:: +take: handle responses.
|
|
|
|
::
|
2022-01-21 21:48:05 +03:00
|
|
|
++ take
|
|
|
|
|= [tea=wire hen=duct dud=(unit goof) hin=sign]
|
|
|
|
^- [(list move) _khan-gate]
|
|
|
|
?^ dud
|
|
|
|
~|(%khan-take-dud (mean tang.u.dud))
|
2022-01-27 04:41:01 +03:00
|
|
|
?. ?=(%gall -.hin)
|
|
|
|
[~ khan-gate]
|
|
|
|
?+ -.p.hin [~ khan-gate]
|
|
|
|
?(%poke-ack %watch-ack)
|
|
|
|
?~ p.p.hin [~ khan-gate]
|
|
|
|
%- (slog u.p.p.hin)
|
|
|
|
:_ khan-gate
|
|
|
|
[hen %give %avow %| -.p.hin u.p.p.hin]~
|
|
|
|
::
|
|
|
|
%fact
|
|
|
|
=* cag cage.p.hin
|
|
|
|
?+ p.cag ~&(bad-fact+p.cag !!)
|
|
|
|
%thread-fail
|
|
|
|
=/ =tang !<(tang q.cag)
|
|
|
|
%- (slog tang)
|
2022-01-26 08:28:45 +03:00
|
|
|
:_ khan-gate
|
2022-01-27 04:41:01 +03:00
|
|
|
[hen %give %avow %| p.cag tang]~
|
2022-01-26 04:43:48 +03:00
|
|
|
::
|
2022-01-27 04:41:01 +03:00
|
|
|
%thread-done
|
|
|
|
:_ khan-gate
|
|
|
|
=/ =dais:clay (~(got by out-dais) hen)
|
|
|
|
=/ res=vase (vale:dais !<(* q.cag))
|
|
|
|
:: XX store and reflect back mark?
|
|
|
|
[hen %give %avow %& form.dais q.res]~
|
2022-01-26 04:43:48 +03:00
|
|
|
==
|
2022-01-27 04:45:25 +03:00
|
|
|
%kick
|
|
|
|
[~ khan-gate(out-dais (~(del by out-dais) hen))]
|
2022-01-26 04:43:48 +03:00
|
|
|
==
|
2022-01-21 21:48:05 +03:00
|
|
|
--
|