mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-11 04:48:00 +03:00
Before from tweak.
This commit is contained in:
parent
ea4e7b917f
commit
cd09667bc7
@ -5,10 +5,10 @@
|
||||
/- *sole, *octo :: structures
|
||||
/+ sole, octo :: libraries
|
||||
:: :: ::
|
||||
:::: :: :: structures
|
||||
:::: :: :: server
|
||||
!: :: ::
|
||||
=> |% :: arvo structures
|
||||
++ axle ,[eye=face bus=(unit ship) gam=game] :: agent state
|
||||
++ axle ,[eye=face rem=(unit ship) gam=game] :: agent state
|
||||
++ card $% [%diff lime] :: update
|
||||
[%quit ~] :: cancel
|
||||
[%peer wire dock path] :: subscribe
|
||||
@ -17,10 +17,10 @@
|
||||
== ::
|
||||
++ face (pair (list ,@c) (map bone sole-share)) :: interface
|
||||
++ lime $% [%sole-effect sole-effect] :: :sole update
|
||||
[%octo-game game] :: :octo update
|
||||
[%octo-update game] :: :octo update
|
||||
== ::
|
||||
++ move (pair bone card) :: cause and action
|
||||
++ pear ,[%octo-action action] :: outgoing move
|
||||
++ pear ,[%octo-move point] :: outgoing move
|
||||
-- ::
|
||||
=> |% :: historical state
|
||||
++ axon $%([%1 axle] [%0 axle-0]) ::
|
||||
@ -33,51 +33,54 @@
|
||||
++ comb (pick come ;~(pfix sig (punt fed:ag))) :: all command input
|
||||
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :: :: server
|
||||
:: :: ::
|
||||
|_ [hid=hide moz=(list move) [%1 axle]] :: per server
|
||||
|_ [hid=hide moz=(list move) %1 axle] :: per agent
|
||||
++ et ::
|
||||
|_ [from say=sole-share] :: per console client
|
||||
++ abet +>(q.eye (~(put by q.eye) ost say)) :: continue
|
||||
++ amok +>(q.eye (~(del by q.eye) ost)) :: discontinue
|
||||
++ beep (emit %bel ~) :: bad user
|
||||
++ cusp (cope wait) :: parsing rule
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal=sole-change :: input line change
|
||||
=^ cul say (remit:sole cal good) ::
|
||||
?~ cul (park:abet(p.eye buf.say) | ~) ::
|
||||
abet:beep:(emit det/u.cul) ::
|
||||
++ emit |= fec=sole-effect ^+ +> :: send effect
|
||||
+>(moz [[ost %diff %sole-effect fec] moz]) ::
|
||||
++ emil |= fex=(list sole-effect) :: send effects
|
||||
?~(fex +> $(fex t.fex, +> (emit i.fex))) ::
|
||||
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: valid input
|
||||
++ here ~(. go [src gam]) :: game core
|
||||
++ kick |= point :: move command
|
||||
=^ dud gam ~(m at:here +<) ::
|
||||
?. dud abet:beep =+ mus=res:here ::
|
||||
(park:abet(gam ?^(mus *game gam)) %2 mus) ::
|
||||
++ here ~(. go src gam) :: game core
|
||||
++ kick |= a=point =^ dud gam ~(m at:here a) :: apply move
|
||||
?.(dud abet:beep (kind res:here a)) ::
|
||||
++ kind |= [(unit tape) point] :: successful move
|
||||
=. +> ?~(rem +> (send +<+)) ::
|
||||
(park:abet(gam ?^(+<- *game gam)) %2 +<-) ::
|
||||
++ line =^ cal say (transmit:sole set/p.eye) :: update command
|
||||
(emit %det cal) ::
|
||||
++ make =+ dur=(rust (tufa p.eye) comb) ::
|
||||
++ make =+ dur=(rust (tufa p.eye) (punt comb)) :: apply command
|
||||
?~ dur abet:beep ::
|
||||
=. + line(p.eye ~) ::
|
||||
?-(+<.dur & (kick +>.dur), | (plan +>.dur)) ::
|
||||
?~ u.dur abet:(play %2) ::
|
||||
=. + line(p.eye ~) ?- +>-.dur ::
|
||||
& (kick +>+.dur) | (plan +>+.dur) == ::
|
||||
++ mean |=((unit tape) ?~(+< +> (emit txt/+<+))) :: optional message
|
||||
++ play |= lev=?(%0 %1 %2) :: update by level
|
||||
?-(lev %0 +>, %1 line, %2 line:show:prom) ::
|
||||
++ plow |= [lev=?(%0 %1 %2) mus=(unit tape)] :: complete print
|
||||
abet:(mean:(play lev) mus) ::
|
||||
++ prom %^ emit %pro %& :- %octo :: update prompt
|
||||
?: wait "(their turn) " ::
|
||||
": {~[(icon who.gam)]} to move (row/col): " ::
|
||||
++ plan |= mut=(unit serf) :: peer command
|
||||
?~ mut ?~(but abet:beep stop:abet) ::
|
||||
?^(but abet:beep (link:abet u.mut)) ::
|
||||
++ rend (turn tab:here |=(tape txt/+<)) :: table print
|
||||
++ prom (emit %pro %& %octo stat) :: update prompt
|
||||
++ plan |= wid=(unit ship) :: subscribe to peer
|
||||
?~ wid (park:stop:abet(gam *game) %2) ::
|
||||
?^(rem abet:beep (link:abet u.wid)) ::
|
||||
++ rend (turn `wall`tab:here |=(tape txt/+<)) :: table print
|
||||
++ send |= point =. +>+> %- dish :: upload move
|
||||
poke/((like +.rem) %octo-move +<) +> ::
|
||||
++ show (emit %mor rend) :: update board
|
||||
++ sole ~(. cs say) :: console core
|
||||
++ wait =+(own:here &(?=(^ -) :: waiting turn
|
||||
++ 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): " ::
|
||||
== ::
|
||||
++ work |= act=sole-action :: console input
|
||||
?:(?=(%det -.act) (delt +.act) make) ::
|
||||
-- ::
|
||||
@ -86,9 +89,11 @@
|
||||
++ dish |=(cad=card (dump 0 cad)) :: forward move
|
||||
++ flet |=(from ~(. et +< (~(got by q.eye) ost))) :: in old client
|
||||
++ fret |=(from ~(. et +< *sole-share)) :: in new client
|
||||
++ like |=(a=ship |*(* [/octo [a %octo] +<])) :: to friend
|
||||
++ link |= mot=serf %+ dish(but `[| mot]) %peer :: subscribe to friend
|
||||
((like p.mot) /octo/net/[?:(q.mot %x %o)]) ::
|
||||
++ like |=(a=ship |*(* [/octo [a %octo] +<])) :: message to friend
|
||||
++ link |= a=ship :: subscribe to friend
|
||||
(dish(rem `a) %peer ((like a) /octo/net)) ::
|
||||
++ lose |=(from ?^(rem +> +>(gam ~(out go src gam)))) ::
|
||||
++ meet |=(from ?^(rem +> +>(gam ~(inn go src gam)))) ::
|
||||
++ pals %+ turn (pale hid (prix /sole)) |= sink :: per console
|
||||
[[p=p.+< q=q.+<] r=(~(got by q.eye) p.+<)] ::
|
||||
++ park |= [lev=?(%0 %1 %2) mus=(unit tape)] :: update all
|
||||
@ -98,8 +103,8 @@
|
||||
$(+< t.+<, +>.^$ (~(plow et i.+<) lev mus)) ::
|
||||
++ push =+ pey=(pale hid (prix /octo)) |- ^+ +> :: update friends
|
||||
?~(pey +> $(pey t.pey, +> (sell p.i.pey))) ::
|
||||
++ sell |=(ost=bone (dump ost %diff %octo-game gam)) :: update friend
|
||||
++ stop (dish(but ~) pull/((like +>-.but) ~)) :: cancel subscribe
|
||||
++ sell |=(bone (dump +< %diff %octo-update gam)) :: update friend
|
||||
++ stop ?~(rem . (dish pull/((like +.rem) ~))) ::
|
||||
:: :: ::
|
||||
:::: :: :: handlers
|
||||
:: :: ::
|
||||
@ -108,38 +113,39 @@
|
||||
?~(saw +> (park %0 `"move failed")) ::
|
||||
++ diff-octo-game :: friend update
|
||||
|= [then gam=game] =< abet ::
|
||||
?. &(?=([~ %& *] but) =(src p.q.u.but)) +> ::
|
||||
?: =(^gam gam) +> ::
|
||||
(park(gam gam) %2 ~) ::
|
||||
++ peer-octo-net :: urbit peer
|
||||
|= [from path] =< abet ::
|
||||
(park:(meet +<-) %2 `"net from {<src>}") ::
|
||||
++ peer-sole :: console subscribe
|
||||
|= [from pax=path] =< abet ::
|
||||
(plow:(fret +<-) %2 ~) ::
|
||||
(plow:(fret:(meet +<-) +<-) %2 ~) ::
|
||||
++ poke-sole-action :: console input
|
||||
|= [from act=sole-action] =< abet ::
|
||||
(work:(flet +<-) act) ::
|
||||
++ poke-octo-move ::
|
||||
|= [from wha=point] =< abet ::
|
||||
=^ dud gam ~(m at:here wha) ::
|
||||
?> dud =+ mus=res:here ::
|
||||
=^ dud gam ~(m ~(at go src gam) wha) ::
|
||||
?> dud =+ mus=~(res go src gam) ::
|
||||
(park(gam ?^(mus *game gam)) %2 mus) ::
|
||||
++ prep |= [from old=(unit ,[(list move) axon])] :: initialize
|
||||
=< abet ?~ old +> ::
|
||||
=< (park %2 ~) ::
|
||||
?- -.+>.old ::
|
||||
%1 +>(+<+ u.old) ::
|
||||
%0 %= +>(eye.+< eye.+>.old, gam.+< gam.+>.old)::
|
||||
%0 !! ::
|
||||
== ::
|
||||
++ pull-octo ::
|
||||
++ pull-octo :: unsubscribe
|
||||
|= [from *] =< abet ::
|
||||
(park(but ~) %2 `"dropped") ::
|
||||
(lose +<-) ::
|
||||
++ pull-sole :: disconnect console
|
||||
|= [from *] =< abet ::
|
||||
amok:(flet +<-) ::
|
||||
amok:(flet:(lose +<-) +<-) ::
|
||||
++ quit-octo :: unlinked by friend
|
||||
|=([then ~] abet:(park(but ~) %0 `"removed")) ::
|
||||
|=(then abet:(park(rem ~) %0 `"removed")) ::
|
||||
++ reap-octo :: linked to friend
|
||||
|= [then saw=(unit tang)] =< abet ::
|
||||
?> ?=([~ %| *] but) ::
|
||||
?^ saw (park:stop %0 `"fail to {<src>}") ::
|
||||
(park(p.u.but %&) %0 `"link to {<src>}") ::
|
||||
?~ saw (park %0 `"linked to {<src>}") ::
|
||||
(park(rem ~) %0 `"blocked by {<src>}") ::
|
||||
--
|
||||
|
@ -134,14 +134,14 @@
|
||||
^+ +>
|
||||
?- -.gux
|
||||
%|
|
||||
=. +> (mo-bold dap dep)
|
||||
=. +> (mo-bold pup dap dep)
|
||||
=. +> (mo-give %onto %| p.gux)
|
||||
+>
|
||||
%&
|
||||
?> ?=(@ p.p.gux)
|
||||
?. (mo-okay q.p.gux)
|
||||
(mo-give %onto %| [%leaf "{<dap>}: bogus core"]~)
|
||||
=. +> (mo-bold dap dep)
|
||||
=. +> (mo-bold pup dap dep)
|
||||
=. +> (mo-born dap pup q.p.gux)
|
||||
=+ old=+>.$
|
||||
=+ wag=(ap-prop:(ap-abed:ap dap [%high [~ our]]) ~)
|
||||
@ -174,7 +174,7 @@
|
||||
?. (~(has by bum) dap)
|
||||
~& [%gall-old-boon dap]
|
||||
+>
|
||||
=. +> (mo-bold dap dep)
|
||||
=. +> (mo-bold pup dap dep)
|
||||
?- -.gux
|
||||
%| (mo-give %onto %| p.gux)
|
||||
%& ?> ?=(@ p.p.gux)
|
||||
@ -182,9 +182,9 @@
|
||||
==
|
||||
::
|
||||
++ mo-bold :: wait for dep
|
||||
|= [dap=dude dep=@uvH]
|
||||
|= [pup=scup dap=dude dep=@uvH]
|
||||
^+ +>
|
||||
%+ mo-pass [%sys %dep dap ~]
|
||||
%+ mo-pass [%sys %dep (scot %p p.pup) q.pup dap ~]
|
||||
[%f %wasp our dep]
|
||||
::
|
||||
++ mo-boot :: create ship
|
||||
@ -282,12 +282,16 @@
|
||||
?+ -.pax !!
|
||||
%dep :: update
|
||||
?> ?=([%f %news *] sih)
|
||||
?> ?=([@ ~] t.pax)
|
||||
=+ sot=(~(get by bum) i.t.pax)
|
||||
?~ sot
|
||||
~& [%mo-cyst-none i.t.pax]
|
||||
+>.$
|
||||
(mo-boot i.t.pax %old pup.u.sot)
|
||||
?. ?=([@ @ @ ~] t.pax) :: XX while old piers
|
||||
?> ?=([@ ~] t.pax) :: may retain state
|
||||
=+ sot=(~(get by bum) i.t.pax) :: then delete
|
||||
?~ sot
|
||||
~& [%mo-cyst-none i.t.pax]
|
||||
+>.$
|
||||
(mo-boot i.t.pax %old pup.u.sot)
|
||||
%^ mo-boot i.t.t.t.pax
|
||||
?:((~(has by bum) i.t.t.t.pax) %old %new)
|
||||
[(slav %p i.t.pax) i.t.t.pax]
|
||||
::
|
||||
%new
|
||||
?> ?=([%f %made *] sih)
|
||||
|
@ -1,26 +1,28 @@
|
||||
::
|
||||
:::: /hook/door/octo-game/mar
|
||||
::
|
||||
/? 310
|
||||
!:
|
||||
|%
|
||||
++ rip9
|
||||
=+ b=0
|
||||
|= a=@ ^- (list ,@A)
|
||||
?: =(b 9) ~
|
||||
[(cut 0 [b 1] a) $(b +(b))]
|
||||
--
|
||||
!:
|
||||
|_ cod=[who=? box=@ boo=@] :: game state
|
||||
::
|
||||
:: :: ::
|
||||
:::: /hook/door/octo-game/mar :: :: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo
|
||||
/- *octo :: structures
|
||||
/+ octo :: libraries
|
||||
!: :: ::
|
||||
:::: :: :: protocol
|
||||
:: :: ::
|
||||
|_ game :: game
|
||||
++ grab :: convert from
|
||||
|%
|
||||
++ noun ,[who=? box=@ boo=@] :: clam from %noun
|
||||
++ noun game :: from %noun
|
||||
--
|
||||
++ grow
|
||||
++ grow :: convert to %json
|
||||
|%
|
||||
++ json ^- ^json
|
||||
=> |=(bor=@ `^json`a/(turn (rip9 bor) |=(a=@A [%b =(1 a)])))
|
||||
(jobe who/s/?:(who.cod %x %o) box/(. box.cod) boo/(. boo.cod) ~)
|
||||
++ json ^- ^json :: to %json
|
||||
=+ she=|=(ship s/(scot %p +<))
|
||||
%- jobe
|
||||
:~ who/s/?:(who %x %o)
|
||||
plx/?~(p.sag ~ (she u.p.sag))
|
||||
plo/?~(q.sag ~ (she u.q.sag))
|
||||
aud/a/(turn (~(tap by aud)) she)
|
||||
box/~(jon bo box)
|
||||
boo/~(jon bo boo)
|
||||
==
|
||||
--
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user