shrub/ape/oct1.hoon

85 lines
5.5 KiB
Plaintext
Raw Normal View History

2015-05-19 07:27:39 +03:00
:: :: ::
2015-06-10 21:08:49 +03:00
:::: /hoon/oct1/ape :::::: dependencies
2015-05-19 07:27:39 +03:00
:: :: ::
2015-05-21 02:54:49 +03:00
/? 310 :: arvo version
2015-05-30 01:24:34 +03:00
/- *sole, *oct1 :: structures
/+ sole, oct1 :: libraries
2015-05-19 07:27:39 +03:00
:: :: ::
2015-05-29 11:36:23 +03:00
:::: :::::: interfaces
2015-05-19 07:27:39 +03:00
!: :: ::
2015-05-29 11:36:23 +03:00
=> |% ::
2015-06-03 00:30:00 +03:00
++ axon ,[%0 eye=face gam=game] :: agent state
2015-05-31 10:19:35 +03:00
++ card ,[%diff %sole-effect sole-effect] :: update
2015-05-26 05:15:08 +03:00
++ face (map bone sole-share) :: console state
2015-05-08 20:56:30 +03:00
++ move (pair bone card) :: cause and action
2015-05-21 02:54:49 +03:00
-- ::
2015-05-29 11:36:23 +03:00
:: :: ::
:::: :::::: parsers
:: :: ::
=> |% ::
2015-05-08 20:56:30 +03:00
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
-- ::
2015-05-29 11:36:23 +03:00
:: :: ::
:::: :::::: process core
2015-05-26 05:15:08 +03:00
:: :: ::
2015-05-31 10:19:35 +03:00
|_ $: bowl :: system state
2015-05-29 11:36:23 +03:00
moz=(list move) :: pending actions
2015-06-03 00:30:00 +03:00
axon :: server state, v0
2015-05-29 11:36:23 +03:00
== ::
:: :: ::
:::: :::::: process tools
2015-05-26 05:15:08 +03:00
:: :: ::
2015-05-29 11:36:23 +03:00
++ abet [(flop moz) .(moz ~)] :: resolve
++ bike $+(_. _+>) :: self-transformer
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
++ eels (~(tap by sup)) :: all clients
2015-05-31 10:19:35 +03:00
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- ::
2015-05-29 22:45:05 +03:00
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
2015-05-31 10:19:35 +03:00
=. ost p.i.all ::
2015-05-29 22:45:05 +03:00
$(all t.all, +>.^$ (fun +>.^$)) ::
++ flap |=(con=bike (echo eels con)) :: update all clients
2015-05-31 10:19:35 +03:00
++ here ~(. go gam) :: game core
2015-05-29 11:36:23 +03:00
:: :: ::
2015-06-03 00:30:00 +03:00
:::: :::::: process logic
2015-05-26 05:15:08 +03:00
:: :: ::
2015-05-31 10:19:35 +03:00
++ fail (fect %bel ~) :: user error
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
2015-05-29 11:36:23 +03:00
++ kick |= point =^ dud gam ~(m at:here +<) ::
2015-05-31 10:19:35 +03:00
?.(dud fail wild:kind) ::
2015-05-29 11:36:23 +03:00
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
2015-05-31 10:19:35 +03:00
++ prom (fect %pro %& %oct1 voy:here) :: update prompt
2015-05-29 11:36:23 +03:00
++ rend (turn `wall`tab:here |=(tape txt/+<)) :: table print
2015-05-31 10:19:35 +03:00
++ sawn .(eye (~(del by eye) ost)) :: console unsubscribe
++ seen .(eye (~(put by eye) ost *sole-share)) :: console subscribe
2015-05-29 11:36:23 +03:00
++ show prom:(fect %mor rend) :: update console
2015-05-31 10:19:35 +03:00
++ tame (flap |=(_. prom:+<)) :: light update
++ wild (flap |=(_. show:+<)) :: full update
++ word |=(tape (flap |=(_+> (fect:+< txt/+>+<)))) ::
2015-05-29 11:36:23 +03:00
:: :: ::
2015-06-03 00:30:00 +03:00
:::: :::::: process UI
2015-05-26 05:15:08 +03:00
:: :: ::
2015-05-29 11:36:23 +03:00
++ work :: console action
|= act=sole-action ::
=+ say=(~(got by eye) ost) ::
|^ ?:(?=(%det -.act) (delt +.act) dive) ::
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
++ delt |= cal=sole-change :: edit command line
=^ cul say (~(remit cs say) cal good) ::
?~(cul abet fail:(fect:abet det/u.cul)) ::
2015-05-31 10:19:35 +03:00
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
?~(- fail ?~(-> show (kick:wipe ->+))) ::
++ good |=((list ,@c) -:(rose (tufa +<) come)) :: validate input
2015-05-29 11:36:23 +03:00
++ wipe =^ cal say (~(transmit cs say) set/~) :: clear line
(fect:abet %det cal) ::
2015-05-08 20:56:30 +03:00
-- ::
2015-05-21 02:54:49 +03:00
:: :: ::
2015-05-29 11:36:23 +03:00
:::: :::::: arvo handlers
2015-05-21 02:54:49 +03:00
:: :: ::
2015-05-29 11:36:23 +03:00
++ peer-sole |=(* abet:show:seen) :: console subscribe
2015-06-03 00:30:00 +03:00
++ prep |= (unit (pair (list move) axon)) :: update self
abet:?~(+< +> wild(+<+ +<+)) ::
2015-05-29 11:36:23 +03:00
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
++ pull-sole |=(* abet:sawn) :: console unsubscribe
2015-05-08 20:56:30 +03:00
--