added json octo interfaces

This commit is contained in:
Anton Dyudin 2015-05-12 12:57:58 -07:00
parent 23939c6dfd
commit fdbf46ce16
7 changed files with 66 additions and 17 deletions

View File

@ -97,7 +97,7 @@
?> ?=([[@ ~] ~] zaz)
`term`p.i.zaz
=+ tip=(end 3 1 nam)
=+ way=[(scot %p our.hid) %base (scot %da lat.hid) %arvo nam %hoon ~]
=+ way=[(scot %p our.hid) %home (scot %da lat.hid) %arvo nam %hoon ~]
=+ fil=(,@ .^(%cx way))
:* ost
%flog

View File

@ -1,5 +1,5 @@
:: :::::::::::::::
:::: /hook/core/acto/ape :: :: :: build
:::: /hook/core/octo/ape :: :: :: build
:: :::::::::::::::
/- *sole :: structures
/+ sole :: libraries
@ -10,7 +10,7 @@
++ board ,@ :: one-player bitfield
++ point ,[x=@ y=@] :: coordinate
++ game ,[who=? box=board boo=board] :: game state
++ icon |=(? ?:(+< 'Q' 'O')) :: display at
++ icon |=(? ?:(+< 'X' 'O')) :: display at
++ bo :: per board
|_ bud=board ::
++ get |=(point =(1 (cut 0 [(off +<) 1] bud))) :: get point
@ -56,7 +56,7 @@
== ::
++ face (pair (list ,@c) (map bone sole-share)) :: interface
++ lime $% [%sole-effect sole-effect] :: :sole update
[%acto-game game] :: :acto update
[%octo-game game] :: :octo update
== ::
++ move (pair bone card) :: cause and action
++ mote (pair ship ,?) :: remote binding
@ -100,7 +100,7 @@
?-(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 %& :- %acto :: update prompt
++ prom %^ emit %pro %& :- %octo :: update prompt
?: wait "(xir turn) " ::
": {~[(icon who.gam)]} to move (row/col): " ::
++ plan |= mut=(unit mote) :: peer command
@ -118,9 +118,9 @@
++ 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 |=(xir=ship |*(* [/acto [xir %octo] +<])) :: to friend
++ like |=(xir=ship |*(* [/octo [xir %octo] +<])) :: to friend
++ link |= mot=mote %- dish(but `[| mot]) :: subscribe to friend
peer/((like p.mot) /acto/[?:(q.mot %x %o)]) ::
peer/((like p.mot) /octo/[?:(q.mot %x %o)]) ::
++ 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
@ -128,19 +128,19 @@
=+ pals ::
|- ^+ +>.^$ ?~ +< +>.^$ ::
$(+< t.+<, +>.^$ (~(plow et i.+<) lev mus)) ::
++ push =+ pey=(pale hid (prix /acto)) |- ^+ +> :: update friends
++ push =+ pey=(pale hid (prix /octo)) |- ^+ +> :: update friends
?~(pey +> $(pey t.pey, +> (sell p.i.pey))) ::
++ sell |=(ost=bone (dump ost %diff %acto-game gam)) :: update friend
++ sell |=(ost=bone (dump ost %diff %octo-game gam)) :: update friend
++ stop (dish(but ~) pull/((like +>-.but) ~)) :: cancel subscribe
:: :::::::::::::::
:::: :: :: :: hooks
:: :::::::::::::::
++ diff-acto-game :: friend update
++ diff-octo-game :: friend update
|= [then gam=game] =< abet ::
?. &(?=([~ %& *] but) =(src p.q.u.but)) +> ::
?: =(^gam gam) +> ::
(park(gam gam) %2 ~) ::
++ peer-acto :: linked by friend
++ peer-octo :: linked by friend
|= [from pax=path] =< abet ::
=+ who==(%x -.pax) ::
?^ but (park %2 ~) :: [~ %& !who src]
@ -151,6 +151,12 @@
++ poke-sole-action :: console input
|= [from act=sole-action] =< abet ::
(work:(flet +<-) act) ::
++ poke-octo-move
|= [from wha=point] =< abet
=^ dud gam ~(m ~(at go gam) wha)
?> dud
=+ mus=~(res go gam) ::
(park(gam ?^(mus *game gam)) %2 mus)
++ prep |= [from old=(unit ,[(list move) axon])] :: initialize
=< abet ?~ old +> ::
=< (park %2 ~) ::
@ -158,15 +164,15 @@
%1 +>(+<+ u.old) ::
%0 +>(eye.+< eye.+>.old, gam.+< gam.+>.old)::
== ::
++ pull-acto ::
++ pull-octo ::
|= [from ~] =< abet ::
(park(but ~) %0 `"dropped") ::
++ pull-sole :: disconnect console
|= [from *] =< abet ::
amok:(flet +<-) ::
++ quit-acto :: unlinked by friend
++ quit-octo :: unlinked by friend
|=([then ~] abet:(park(but ~) %0 `"removed")) ::
++ reap-acto :: linked to friend
++ reap-octo :: linked to friend
|= [then saw=(unit tang)] =< abet ::
?> ?=([~ %| *] but) ::
?^ saw (park:stop %0 `"fail to {<src>}") ::

View File

@ -519,6 +519,7 @@
%diff
?> ?=([%of @ ^] tee)
?. ?=(%json p.p.cuf)
::~> %slog.`rose/[" " "[" "]"]^~[>%backing< >p.p.cuf< (sell q.p.cuf)]
(back tee 0v0 %json p.cuf)
(get-rush:(ire-ix p.tee) q.tee ((hard json) q.q.p.cuf))
::
@ -632,7 +633,7 @@
|=([him=ship gam=gram] (pass-note ~ %a %want [our him] [%e -.gam] +.gam))
::
++ back :: %ford bounce
|= [tea=whir dep=@uvH mar=mark cay=cage]
|= [tea=whir dep=@uvH mar=mark cay=cage]
(pass-note tea (ford-req root-beak [%cast mar %done ~ cay])) :: XX deps
::
++ ford-kill (pass-note ~ %f [%exec our *beak ~]) :: XX unused

View File

@ -765,7 +765,7 @@
^- (each cute tang)
?. &(?=(^ q.vax) ?=(@ -.q.vax) ((sane %tas) -.q.vax))
[%| (ap-suck "move: improper diff")]
[%& sto %give %diff `cage`[-.q.vax (slot 3 vax)]]
[%& sto %give %diff `cage`[-.q.vax (slot 3 (spec vax))]]
::
++ ap-move-mess :: extract path, target
|= vax=vase

View File

@ -106,7 +106,7 @@
?> ?=([[@ ~] ~] zaz)
`term`p.i.zaz
=+ tip=(end 3 1 nam)
=+ way=[(scot %p our) %base (scot %da lat) %arvo nam %hoon ~]
=+ way=[(scot %p our) %home (scot %da lat) %arvo nam %hoon ~]
=+ fil=(,@ .^(%cx way))
:* %flog
/reload

View File

@ -0,0 +1,26 @@
::
:::: /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
::
++ grab :: convert from
|%
++ noun ,[who=? box=@ boo=@] :: clam from %noun
--
++ grow
|%
++ 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) ~)
--
--

View File

@ -0,0 +1,16 @@
::
:::: /hook/door/octo-move/mar
::
/? 314
!:
::::
::
=+ point=,[x=@ y=@]
|_ point
::
++ grab :: convert from
|%
++ json (corl need (at ni ni ~):jo) :: reparse from %json
++ noun point :: clam from %noun
--
--