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
|
2022-02-08 01:46:02 +03:00
|
|
|
$> ?(%arow %avow)
|
|
|
|
gift:khan
|
2022-01-26 04:43:48 +03:00
|
|
|
== ==
|
2022-01-21 21:48:05 +03:00
|
|
|
+$ khan-state
|
2022-02-08 01:46:02 +03:00
|
|
|
$: %1
|
2022-01-27 07:09:36 +03:00
|
|
|
hey=duct :: current unix duct
|
|
|
|
run=(map duct thread-state) :: running threads
|
2022-01-21 21:48:05 +03:00
|
|
|
==
|
2022-02-08 01:46:02 +03:00
|
|
|
+$ thread-state
|
|
|
|
[tid=@ta p=(unit [mak=mark bek=beak])]
|
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-02-08 01:46:02 +03:00
|
|
|
|= [our=@p =vase]
|
2022-01-26 02:37:48 +03:00
|
|
|
^- note
|
2022-02-08 01:46:02 +03:00
|
|
|
[%g %deal [our our] %spider %poke %spider-start vase]
|
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
|
2022-01-27 07:09:36 +03:00
|
|
|
hey hen
|
|
|
|
run *(map duct thread-state)
|
2022-01-27 04:41:01 +03:00
|
|
|
==
|
2022-02-08 01:46:02 +03:00
|
|
|
::
|
|
|
|
%fard
|
|
|
|
=* fad p.task
|
|
|
|
=/ tid=@ta
|
|
|
|
(cat 3 'khan-fard--' (scot %uv (sham eny)))
|
|
|
|
=/ =beak
|
|
|
|
?@(bear.fad [our bear.fad %da now] bear.fad)
|
|
|
|
=/ args
|
|
|
|
[~ `tid beak name.fad data.fad]
|
|
|
|
=/ start-moves=(list move)
|
|
|
|
%+ turn
|
|
|
|
:~ (watch-spider our /thread-result/[tid])
|
|
|
|
(start-spider our !>(args))
|
|
|
|
==
|
|
|
|
|=(=note ^-(move [hen %pass //g note]))
|
|
|
|
=. run (~(put by run) hen tid ~)
|
|
|
|
[start-moves khan-gate]
|
2022-01-27 07:09:36 +03:00
|
|
|
::
|
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 07:09:36 +03:00
|
|
|
?: (~(has by run) hen)
|
2022-01-27 04:41:01 +03:00
|
|
|
~|(%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
|
2022-01-28 09:28:30 +03:00
|
|
|
?@(bear.fyd [our bear.fyd %da now] 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])
|
2022-02-08 01:46:02 +03:00
|
|
|
(start-spider our !>(args))
|
2022-01-26 02:37:48 +03:00
|
|
|
==
|
|
|
|
|=(=note ^-(move [hen %pass //g note]))
|
2022-02-08 01:46:02 +03:00
|
|
|
=. run (~(put by run) hen tid `[out-mark.fyd beak])
|
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
|
2022-02-08 01:46:02 +03:00
|
|
|
|= $= old
|
|
|
|
$% $: %0
|
|
|
|
hey=duct
|
|
|
|
run=(map duct [tid=@ta mak=mark bek=beak])
|
|
|
|
==
|
|
|
|
khan-state
|
|
|
|
==
|
2022-01-21 21:48:05 +03:00
|
|
|
^+ khan-gate
|
2022-02-08 01:46:02 +03:00
|
|
|
=/ new=khan-state
|
|
|
|
?: ?=(%0 -.old)
|
|
|
|
:+ %1
|
|
|
|
hey.old
|
|
|
|
%- ~(urn by run.old)
|
|
|
|
|= [a=duct b=[tid=@ta mak=mark bek=beak]]
|
|
|
|
[tid.b `[mak.b bek.b]]
|
|
|
|
old
|
|
|
|
khan-gate(state new)
|
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
|
2022-01-27 07:09:36 +03:00
|
|
|
=. run (~(del by run) hen)
|
2022-01-21 21:48:05 +03:00
|
|
|
~|(%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]
|
2022-01-27 07:09:36 +03:00
|
|
|
=. run (~(del by run) hen)
|
2022-01-28 09:20:31 +03:00
|
|
|
%- (slog 'khan-ack' u.p.p.hin)
|
2022-01-27 04:41:01 +03:00
|
|
|
:_ khan-gate
|
2022-02-08 01:46:02 +03:00
|
|
|
=/ tad (~(got by run) hen)
|
|
|
|
?~ p.tad
|
|
|
|
[hen %give %arow %| -.p.hin u.p.p.hin]~
|
2022-01-27 04:41:01 +03:00
|
|
|
[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)
|
2022-01-28 09:20:31 +03:00
|
|
|
%- (slog 'khan-fact' tang)
|
2022-01-26 08:28:45 +03:00
|
|
|
:_ khan-gate
|
2022-02-08 01:46:02 +03:00
|
|
|
=/ tad (~(got by run) hen)
|
|
|
|
?~ p.tad
|
|
|
|
[hen %give %arow %| p.cag tang]~
|
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
|
2022-02-08 01:46:02 +03:00
|
|
|
=/ tad (~(got by run) hen)
|
|
|
|
?~ p.tad
|
|
|
|
[hen %give %arow %& q.cag]~
|
|
|
|
=/ mak mak.u.p.tad
|
|
|
|
=/ bek bek.u.p.tad
|
|
|
|
=/ =dais:clay (get-dais bek mak rof)
|
2022-01-27 07:09:36 +03:00
|
|
|
=/ =vase (vale:dais q.q.cag)
|
2022-02-08 01:46:02 +03:00
|
|
|
[hen %give %avow %& mak q.vase]~
|
2022-01-26 04:43:48 +03:00
|
|
|
==
|
2022-01-27 04:45:25 +03:00
|
|
|
%kick
|
2022-01-27 07:09:36 +03:00
|
|
|
[~ khan-gate(run (~(del by run) hen))]
|
2022-01-26 04:43:48 +03:00
|
|
|
==
|
2022-01-21 21:48:05 +03:00
|
|
|
--
|