2015-05-19 07:27:39 +03:00
|
|
|
:: :: ::
|
|
|
|
:::: /hook/core/acto/ape :: :: dependencies
|
|
|
|
:: :: ::
|
2015-05-21 02:54:49 +03:00
|
|
|
/? 310 :: arvo version
|
|
|
|
/- *sole, *octo :: structures
|
|
|
|
/+ sole, octo :: libraries
|
2015-05-19 07:27:39 +03:00
|
|
|
:: :: ::
|
2015-05-23 20:03:02 +03:00
|
|
|
:::: :: :: server
|
2015-05-19 07:27:39 +03:00
|
|
|
!: :: ::
|
2015-05-08 20:56:30 +03:00
|
|
|
=> |% :: arvo structures
|
2015-05-23 20:03:02 +03:00
|
|
|
++ axle ,[eye=face rem=(unit ship) gam=game] :: agent state
|
2015-05-08 20:56:30 +03:00
|
|
|
++ card $% [%diff lime] :: update
|
|
|
|
[%quit ~] :: cancel
|
|
|
|
[%peer wire dock path] :: subscribe
|
2015-05-21 02:54:49 +03:00
|
|
|
[%poke wire dock pear] :: send move
|
|
|
|
[%pull wire dock ~] :: unsubscribe
|
2015-05-08 20:56:30 +03:00
|
|
|
== ::
|
2015-05-26 05:15:08 +03:00
|
|
|
++ face (map bone sole-share) :: console state
|
2015-05-08 20:56:30 +03:00
|
|
|
++ lime $% [%sole-effect sole-effect] :: :sole update
|
2015-05-26 05:15:08 +03:00
|
|
|
[%octo-update (each game tape)] :: :octo update
|
2015-05-08 20:56:30 +03:00
|
|
|
== ::
|
|
|
|
++ move (pair bone card) :: cause and action
|
2015-05-23 20:03:02 +03:00
|
|
|
++ pear ,[%octo-move point] :: outgoing move
|
2015-05-21 02:54:49 +03:00
|
|
|
-- ::
|
|
|
|
=> |% :: historical state
|
|
|
|
++ axon $%([%1 axle] [%0 axle-0]) ::
|
|
|
|
++ axle-0 ,[eye=face gam=game-0] ::
|
|
|
|
++ game-0 ,[who=? box=board boo=board] ::
|
2015-05-08 20:56:30 +03:00
|
|
|
-- ::
|
|
|
|
=> |% :: parsers
|
|
|
|
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
|
|
|
|
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
|
2015-05-21 02:54:49 +03:00
|
|
|
++ comb (pick come ;~(pfix sig (punt fed:ag))) :: all command input
|
2015-05-08 20:56:30 +03:00
|
|
|
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
|
|
|
|
-- ::
|
2015-05-28 06:48:25 +03:00
|
|
|
|_ [hid=bowl moz=(list move) %1 axle] :: per agent
|
2015-05-26 05:15:08 +03:00
|
|
|
++ ce :: per client
|
2015-05-28 09:51:32 +03:00
|
|
|
|_ [ost=bone src=ship] ::
|
2015-05-26 05:15:08 +03:00
|
|
|
:: :: ::
|
2015-05-28 05:00:53 +03:00
|
|
|
:::: :: :: common logic
|
2015-05-26 05:15:08 +03:00
|
|
|
:: :: ::
|
|
|
|
++ abet [(flop moz) +>(moz ~)] :: resolve core
|
2015-05-26 07:00:34 +03:00
|
|
|
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
|
|
|
|
++ echo |= [pre=path fun=$+(_. _+>)] :: broadcast
|
2015-05-26 05:15:08 +03:00
|
|
|
=+ [all=(pale hid (prix pre)) los=+>+<] ::
|
|
|
|
|- ^+ +>.^$ ?~ all +>.^$(+< los) ::
|
|
|
|
=> .(ost p.i.all, src p.q.i.all) ::
|
|
|
|
$(all t.all, +>.^$ (fun +>.^$)) ::
|
2015-05-26 07:00:34 +03:00
|
|
|
++ emit |=(lime (dish %diff +<)) :: publish
|
2015-05-26 05:15:08 +03:00
|
|
|
:: :: ::
|
2015-05-28 05:00:53 +03:00
|
|
|
:::: :: :: custom logic
|
2015-05-26 05:15:08 +03:00
|
|
|
:: :: ::
|
|
|
|
++ fail ?:(soul (fect %bel ~) ~|(%invalid-move !!)) :: user error
|
2015-05-26 07:00:34 +03:00
|
|
|
++ fect |=(sole-effect (emit %sole-effect +<)) :: update console
|
|
|
|
++ fact |=((each game tape) (emit %octo-update +<)) :: update partner
|
2015-05-26 05:15:08 +03:00
|
|
|
++ flap |= [net=$+(_. _+>) con=$+(_. _+>)] :: update all
|
2015-05-26 07:00:34 +03:00
|
|
|
=. +> (echo /octo net) (echo /sole con) ::
|
2015-05-23 20:03:02 +03:00
|
|
|
++ here ~(. go src gam) :: game core
|
2015-05-26 05:15:08 +03:00
|
|
|
++ kick |= a=point :: try move
|
|
|
|
=^ dud gam ~(m at:here a) ::
|
|
|
|
?.(dud fail ?~(rem kind (send a))) ::
|
|
|
|
++ kind =+ res:here :: move result
|
|
|
|
?~(- wild (word:wild(gam new:here) ->)) ::
|
|
|
|
++ plan |= (unit ship) :: link/unlink
|
|
|
|
?~ +< wild:stop(gam *game) ::
|
|
|
|
?^(rem fail (link u.+<)) ::
|
|
|
|
++ plot |= (each point (unit ship)) :: apply command
|
|
|
|
?-(+<- & (kick +<+), | (plan +<+)) ::
|
|
|
|
++ like |=(ship |*(* [/octo [+>+< %octo] +<])) :: message to friend
|
|
|
|
++ link |= ship :: subscribe to friend
|
|
|
|
(dish(rem `+<) peer/((like +<) /octo)) ::
|
|
|
|
++ lose ?^(rem . tame(gam out:here)) :: lost subscriber
|
|
|
|
++ meet ?^(rem . tame(gam inn:here)) :: gained subscriber
|
2015-05-26 07:00:34 +03:00
|
|
|
++ prom (fect %pro %& %octo stat) :: update prompt
|
|
|
|
++ rend (turn `wall`tab:here |=(tape txt/+<)) :: table print
|
|
|
|
++ sawn lose(eye (~(del by eye) ost)) :: console unsubscribe
|
|
|
|
++ seen meet(eye (~(put by eye) ost *sole-share)) :: console subscribe
|
|
|
|
++ send |= a=point ::
|
|
|
|
(dish poke/((like +.rem) %octo-move +<)) ::
|
|
|
|
++ show (fect %mor rend) :: update board
|
|
|
|
++ soul =(%sole -:q:(~(got by sup.hid) ost)) :: is console
|
|
|
|
++ stat ^- tape =+ ike=~[(icon who.gam)] :: status line
|
|
|
|
%- zing :~ ::
|
|
|
|
?~(rem "" "@{(scow %p u.rem)}") ::
|
|
|
|
?~(aud.gam "" vew:here) ::
|
|
|
|
?: !ept:here " ({ike}'s turn) " ::
|
|
|
|
": {ike} (row/col): " ::
|
|
|
|
== ::
|
2015-05-26 05:15:08 +03:00
|
|
|
++ stop ?~(rem . (dish pull/((like +.rem) ~))) ::
|
2015-05-26 07:00:34 +03:00
|
|
|
++ tame %+ flap |=(_. (fact:+< &/gam)) :: mild update
|
|
|
|
|=(_. prom:+<) ::
|
|
|
|
++ wild %+ flap |=(_. (fact:+< &/gam)) :: full update
|
|
|
|
|=(_. prom:show:+<) ::
|
2015-05-26 05:15:08 +03:00
|
|
|
++ word |= txt=tape %+ flap :: game message
|
|
|
|
|=(_+> (fact:+< |/txt)) ::
|
|
|
|
|=(_+> (fect:+< txt/txt)) ::
|
|
|
|
:: :: ::
|
2015-05-26 07:00:34 +03:00
|
|
|
:::: :: :: console UI
|
2015-05-26 05:15:08 +03:00
|
|
|
:: :: ::
|
2015-05-28 10:56:08 +03:00
|
|
|
++ work :: console action
|
2015-05-26 07:00:34 +03:00
|
|
|
|= act=sole-action ::
|
|
|
|
=+ say=(~(got by eye) ost) ::
|
|
|
|
|^ ?:(?=(%det -.act) (delt +.act) dive) ::
|
|
|
|
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
2015-05-26 05:15:08 +03:00
|
|
|
++ cusp (cope !ept:here) :: parsing rule
|
2015-05-26 07:00:34 +03:00
|
|
|
++ delt |= cal=sole-change :: edit command line
|
|
|
|
=^ cul say (~(remit cs say) cal good) ::
|
2015-05-28 05:00:53 +03:00
|
|
|
?~(cul abet fail:(fect:abet det/u.cul)) ::
|
2015-05-26 07:00:34 +03:00
|
|
|
++ dive =+ (rust (tufa buf.say) (punt comb)) :: apply command line
|
|
|
|
?~(- fail ?~(-> show (plot:wipe ->+))) ::
|
|
|
|
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
|
|
|
|
++ wipe =^ cal say (~(transmit cs say) set/~) :: clear line
|
|
|
|
(fect:abet %det cal) ::
|
2015-05-26 05:15:08 +03:00
|
|
|
-- ::
|
|
|
|
:: :: ::
|
2015-05-26 07:00:34 +03:00
|
|
|
:::: :: :: arvo handlers
|
2015-05-26 05:15:08 +03:00
|
|
|
:: :: ::
|
|
|
|
++ reap-octo :: linked to friend
|
2015-05-26 07:00:34 +03:00
|
|
|
|= [* saw=(unit)] ::
|
|
|
|
?~ saw (word "linked to {<src>}") ::
|
|
|
|
(word(rem ~) "blocked by {<src>}") ::
|
|
|
|
:: ::
|
2015-05-26 05:15:08 +03:00
|
|
|
++ coup-octo :: move acknowledge
|
2015-05-26 07:00:34 +03:00
|
|
|
|= [* saw=(unit)] ::
|
|
|
|
?~(saw +> (word "move failed")) ::
|
|
|
|
:: ::
|
2015-05-28 05:00:53 +03:00
|
|
|
++ diff-octo-update :: friend update
|
|
|
|
|= [way=wire mex=(each game tape)] ::
|
|
|
|
?- -.mex ::
|
|
|
|
| (word p.mex) ::
|
|
|
|
& ?:(=(gam p.mex) +> wild(gam p.mex)) ::
|
|
|
|
== ::
|
2015-05-26 07:00:34 +03:00
|
|
|
:: ::
|
2015-05-28 05:00:53 +03:00
|
|
|
++ peer-octo :: urbit peer
|
2015-05-26 07:00:34 +03:00
|
|
|
|= pax=path ::
|
|
|
|
tame:meet ::
|
|
|
|
:: ::
|
2015-05-26 05:15:08 +03:00
|
|
|
++ peer-sole :: console subscribe
|
2015-05-26 07:00:34 +03:00
|
|
|
|= pax=path ::
|
|
|
|
prom:show:seen ::
|
|
|
|
:: ::
|
2015-05-26 05:15:08 +03:00
|
|
|
++ poke-sole-action :: console input
|
2015-05-26 07:00:34 +03:00
|
|
|
|= act=sole-action ::
|
|
|
|
(work act) ::
|
|
|
|
:: ::
|
2015-05-26 05:15:08 +03:00
|
|
|
++ poke-octo-move ::
|
2015-05-26 07:00:34 +03:00
|
|
|
|= point ::
|
2015-05-28 05:00:53 +03:00
|
|
|
wild:(kick +<) ::
|
2015-05-26 07:00:34 +03:00
|
|
|
:: ::
|
|
|
|
++ prep ::
|
|
|
|
|= [old=(unit ,[(list move) axon])] :: initialize
|
2015-05-28 20:04:24 +03:00
|
|
|
+>
|
|
|
|
:: ::
|
2015-05-26 05:15:08 +03:00
|
|
|
++ pull-octo :: unsubscribe
|
2015-05-28 20:04:24 +03:00
|
|
|
|= pax=path ::
|
2015-05-26 07:00:34 +03:00
|
|
|
^+ +>
|
|
|
|
lose ::
|
|
|
|
::
|
2015-05-26 05:15:08 +03:00
|
|
|
++ pull-sole :: disconnect console
|
2015-05-26 07:00:34 +03:00
|
|
|
|= pax=path ::
|
|
|
|
^+ +>
|
|
|
|
sawn
|
|
|
|
::
|
2015-05-26 05:15:08 +03:00
|
|
|
++ quit-octo :: unlinked by friend
|
2015-05-26 07:00:34 +03:00
|
|
|
|= way=wire
|
|
|
|
^+ +>
|
|
|
|
?~(rem +> (link +.rem)) ::
|
2015-05-08 20:56:30 +03:00
|
|
|
-- ::
|
2015-05-21 02:54:49 +03:00
|
|
|
:: :: ::
|
|
|
|
:::: :: :: handlers
|
|
|
|
:: :: ::
|
|
|
|
++ coup-octo :: move acknowledge
|
2015-05-28 10:56:08 +03:00
|
|
|
|= [way=wire saw=(unit tang)] ::
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(coup-octo ce ost.hid src.hid) way saw) ::
|
2015-05-28 05:00:53 +03:00
|
|
|
++ diff-octo-update :: friend update
|
2015-05-28 10:56:08 +03:00
|
|
|
|= [way=wire mex=(each game tape)] ::
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(diff-octo-update ce ost.hid src.hid) way mex) ::
|
2015-05-28 05:00:53 +03:00
|
|
|
++ peer-octo :: urbit peer
|
2015-05-28 09:51:32 +03:00
|
|
|
|= path ::
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(peer-octo ce ost.hid src.hid) +<) ::
|
2015-05-08 20:56:30 +03:00
|
|
|
++ peer-sole :: console subscribe
|
2015-05-28 09:51:32 +03:00
|
|
|
|= path ::
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(peer-sole ce ost.hid src.hid) +<) ::
|
2015-05-08 20:56:30 +03:00
|
|
|
++ poke-sole-action :: console input
|
2015-05-28 09:51:32 +03:00
|
|
|
|= sole-action ::
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(poke-sole-action ce ost.hid src.hid) +<) ::
|
2015-05-19 07:27:39 +03:00
|
|
|
++ poke-octo-move ::
|
2015-05-28 09:51:32 +03:00
|
|
|
|= point ::
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(poke-octo-move ce ost.hid src.hid) +<) ::
|
2015-05-28 09:51:32 +03:00
|
|
|
++ prep |= (unit ,[(list move) axon]) :: initialize
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(prep ce ost.hid src.hid) +<) ::
|
2015-05-23 20:03:02 +03:00
|
|
|
++ pull-octo :: unsubscribe
|
2015-05-28 09:51:32 +03:00
|
|
|
|= path ::
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(pull-octo ce ost.hid src.hid) +<) ::
|
2015-05-08 20:56:30 +03:00
|
|
|
++ pull-sole :: disconnect console
|
2015-05-28 09:51:32 +03:00
|
|
|
|= path ::
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(pull-sole ce ost.hid src.hid) +<) ::
|
2015-05-12 22:57:58 +03:00
|
|
|
++ quit-octo :: unlinked by friend
|
2015-05-28 10:56:08 +03:00
|
|
|
|= way=wire ::
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(quit-octo ce ost.hid src.hid) way) ::
|
2015-05-12 22:57:58 +03:00
|
|
|
++ reap-octo :: linked to friend
|
2015-05-28 10:56:08 +03:00
|
|
|
|= [way=wire saw=(unit tang)] ::
|
2015-05-28 20:04:24 +03:00
|
|
|
abet:(~(reap-octo ce ost.hid src.hid) way saw) ::
|
2015-05-08 20:56:30 +03:00
|
|
|
--
|