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