Merge branch 'test' of https://github.com/urbit/urbit into test

Conflicts:
	urb/urbit.pill
This commit is contained in:
Anton Dyudin 2015-06-01 16:25:21 -07:00
commit 6a08824905
17 changed files with 457 additions and 254 deletions

View File

@ -6,10 +6,16 @@
/- *talk, *bit-api
/+ talk, sole, http, mean
!:
:::: sivtyv-barnel
:: be sure to have oauth2-code markk
|%
++ axle
$: cred=(unit ,[app-secret=@t client-id=@t])
oauth-code=(unit ,@t)
auth=(unit ,[access=@t refresh=@t])

View File

@ -95,6 +95,7 @@
++ poke-kiln-mv (wrap poke-mv):from-kiln
++ poke-will (wrap poke-will):from-helm
++ mere-kiln (wrap take-mere):from-kiln
++ mere-kiln-sync (wrap take-mere-sync):from-kiln
++ made-kiln (wrap take-made):from-kiln
++ init-helm |=([way=wire *] [~ +>])
++ note-helm (wrap take-note):from-helm
@ -103,4 +104,5 @@
++ peer-drum (wrap peer):from-drum
++ quit-drum (wrap quit):from-drum
++ went-helm (wrap take-went):from-helm
++ writ-kiln-sync (wrap take-writ):from-kiln
--

View File

@ -8,46 +8,24 @@
:::: :::::: interfaces
!: :: ::
=> |% ::
++ axle ,[eye=face rem=(unit ship) gam=game] :: agent state
++ card $% [%diff lime] :: update
[%quit ~] :: cancel
[%peer wire dock path] :: subscribe
[%poke wire dock pear] :: send move
[%pull wire dock ~] :: unsubscribe
== ::
++ axle ,[eye=face gam=game] :: agent state
++ card ,[%diff %sole-effect sole-effect] :: update
++ face (map bone sole-share) :: console state
++ lime $% [%sole-effect sole-effect] :: :sole update
[%oct1-update play] :: :oct1 update
== ::
++ move (pair bone card) :: cause and action
++ pear ,[%oct1-move point] :: outgoing move
-- ::
:: :: ::
:::: :::::: past state
:: :: ::
=> |% ::
++ agon (unit ,[(list move) axon]) :: boot argument
++ axon $%([%1 axle] [%0 axle-0]) :: all states
++ axle-0 ,[eye=face gam=game-0] :: old axle
++ game-0 ,[who=? box=board boo=board] :: old game
++ wake |= axon :- %1 ?- +<- %1 +<+ :: coarse upgrade
%0 [eye ~ [who ~^~ ~ box boo]:gam]:+<+ ::
== -- ::
:: :: ::
:::: :::::: parsers
:: :: ::
=> |% ::
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
++ comb (pick come ;~(pfix sig (punt fed:ag))) :: all command input
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
-- ::
:: :: ::
:::: :::::: process core
:: :: ::
|_ $: bowl
|_ $: bowl :: system state
moz=(list move) :: pending actions
[%1 axle] :: process state, v1
[%0 axle] :: server state, v0
== ::
:: :: ::
:::: :::::: process tools
@ -55,55 +33,29 @@
++ abet [(flop moz) .(moz ~)] :: resolve
++ bike $+(_. _+>) :: self-transformer
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
++ done (echo eels |=(_. (dish:+< %quit ~))) :: cancel everyone
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- :: publish to all
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
=> .(ost p.i.all, src q.i.all) ::
$(all t.all, +>.^$ (fun +>.^$)) ::
++ eels (~(tap by sup)) :: all clients
++ elfs (prey /oct1 +<-) :: network clients
++ elks (prey /sole +<-) :: console clients
++ emit |=(lime (dish %diff +<)) :: publish
++ flap |= [net=bike con=bike] :: update all clients
(echo:(echo elks con) elfs net) ::
++ here ~(. go src gam) :: game core
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- ::
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
=. ost p.i.all ::
$(all t.all, +>.^$ (fun +>.^$)) ::
++ flap |=(con=bike (echo eels con)) :: update all clients
++ here ~(. go gam) :: game core
:: :: ::
:::: :::::: server logic
:: :: ::
++ fail ?:(soul (fect %bel ~) ~|(%invalid-move !!)) :: user error
++ fect |=(sole-effect (emit %sole-effect +<)) :: update console
++ fact |=(play (emit %oct1-update +<)) :: update partner
++ harp |=(game ?:(=(gam +<) +> wild(gam +<))) :: update game
++ heal |= old=axon =. +>+<+> (wake old) :: complete update
=- +>.$(gam -) ?. !=(1 +<-) gam ::
(muy:here (turn eels |=(sink q))) ::
++ hear |=(play ?-(+<- | (word +<+), & (harp +<+))) :: network update
++ fail (fect %bel ~) :: user error
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
++ kick |= point =^ dud gam ~(m at:here +<) ::
?.(dud fail wild:?~(rem kind (send +>-))) ::
?.(dud fail wild:kind) ::
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
++ plan |= (unit ship) ?~ +< stop(gam new:here) :: link/unlink
?^(rem fail link(rem +<)) ::
++ plot |= (each point (unit ship)) :: apply command
?-(+<- & (kick +<+), | (plan +<+)) ::
++ like |*(* [/oct1 [+.rem dap] +<]) :: friend message
++ link (dish peer/(like /oct1)) :: subscribe to friend
++ lose ?^(rem . tame(gam out:here)) :: lost subscriber
++ meet ?^(rem . tame(gam inn:here)) :: gained subscriber
++ prom (fect %pro %& %oct1 stat) :: update prompt
++ prom (fect %pro %& %oct1 voy:here) :: 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 |=(point (dish poke/(like %oct1-move +<))) :: send move
++ sawn .(eye (~(del by eye) ost)) :: console unsubscribe
++ seen .(eye (~(put by eye) ost *sole-share)) :: console subscribe
++ show prom:(fect %mor rend) :: update console
++ soul =(%sole -:q:(~(got by sup) ost)) :: is console
++ stat (weld ?~(rem ~ "@{(scow p/u.rem)}") voy:here) :: prompt line
++ stop ?~(rem done wild:(dish pull/(like ~))) :: unsubscribe
++ tame (flap |=(_. (fact:+< &/gam)) |=(_. prom:+<)) :: light update
++ wild (flap |=(_. (fact:+< &/gam)) |=(_. show:+<)) :: full update
++ with |=(? (word(rem ?:(+< rem ~)) "{<[+< src]>}")) ::
++ word |= txt=tape %+ flap :: game message
|=(_+> (fact:+< |/txt)) ::
|=(_+> (fect:+< txt/txt)) ::
++ tame (flap |=(_. prom:+<)) :: light update
++ wild (flap |=(_. show:+<)) :: full update
++ word |=(tape (flap |=(_+> (fect:+< txt/+>+<)))) ::
:: :: ::
:::: :::::: console UI
:: :: ::
@ -112,28 +64,19 @@
=+ say=(~(got by eye) ost) ::
|^ ?:(?=(%det -.act) (delt +.act) dive) ::
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
++ cusp (cope !ept:here) :: parsing rule
++ delt |= cal=sole-change :: edit command line
=^ cul say (~(remit cs say) cal good) ::
?~(cul abet fail:(fect:abet det/u.cul)) ::
++ dive =+ (rust (tufa buf.say) (punt comb)) :: apply command line
?~(- fail ?~(-> show (plot:wipe ->+))) ::
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
?~(- fail ?~(-> show (kick:wipe ->+))) ::
++ good |=((list ,@c) -:(rose (tufa +<) come)) :: validate input
++ wipe =^ cal say (~(transmit cs say) set/~) :: clear line
(fect:abet %det cal) ::
-- ::
:: :: ::
:::: :::::: arvo handlers
:: :: ::
++ reap-oct1 |=([* (unit)] abet:(with =(~ +<+))) :: linked to friend
++ coup-oct1 |=([* (unit)] abet:?~(+<+ +> fail)) :: move acknowledge
++ diff-oct1-update |=([* play] abet:(hear +<+)) :: network update
++ peer-oct1 |=(* abet:tame:meet) :: urbit subscribe
++ peer-sole |=(* abet:show:seen) :: console subscribe
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
++ poke-oct1-move |=(point abet:wild:(kick +<)) :: urbit move
++ prep |=(agon abet:?~(+< +> (heal +<+>))) :: load state
++ pull-oct1 |=(* abet:lose) :: urbit unsubscribe
++ pull-sole |=(* abet:sawn) :: console unsubscribe
++ quit-oct1 |=(* abet:?~(rem +> wild(rem ~))) :: unlinked by friend
--

View File

@ -8,19 +8,13 @@
:::: :::::: interfaces
!: :: ::
=> |% ::
++ axle ,[eye=face rem=(unit ship) gam=game] :: agent state
++ axle ,[eye=face gam=game] :: agent state
++ card $% [%diff lime] :: update
[%quit ~] :: cancel
[%peer wire dock path] :: subscribe
[%poke wire dock pear] :: send move
[%pull wire dock ~] :: unsubscribe
== ::
++ face (map bone sole-share) :: console state
++ lime $% [%sole-effect sole-effect] :: :sole update
[%oct2-update play] :: :oct2 update
== ::
++ lime ,[%sole-effect sole-effect] :: :sole update
++ move (pair bone card) :: cause and action
++ pear ,[%oct2-move point] :: outgoing move
-- ::
:: :: ::
:::: :::::: past state
@ -30,8 +24,8 @@
++ axon $%([%1 axle] [%0 axle-0]) :: all states
++ axle-0 ,[eye=face gam=game-0] :: old axle
++ game-0 ,[who=? box=board boo=board] :: old game
++ wake |= axon :- %1 ?- +<- %1 +<+ :: coarse upgrade
%0 [eye ~ [who ~^~ ~ box boo]:gam]:+<+ ::
++ wake |= axon :- %1 ?- +<- %1 +<+ :: rough upgrade
%0 [eye [who ~^~ ~ box boo]:gam]:+<+ ::
== -- ::
:: :: ::
:::: :::::: parsers
@ -39,13 +33,12 @@
=> |% ::
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
++ comb (pick come ;~(pfix sig (punt fed:ag))) :: all command input
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) come)) :: with wait mode
-- ::
:: :: ::
:::: :::::: process core
:: :: ::
|_ $: bowl
|_ $: bowl ::
moz=(list move) :: pending actions
[%1 axle] :: process state, v1
== ::
@ -55,55 +48,32 @@
++ abet [(flop moz) .(moz ~)] :: resolve
++ bike $+(_. _+>) :: self-transformer
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
++ done (echo eels |=(_. (dish:+< %quit ~))) :: cancel everyone
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- :: publish to all
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
=> .(ost p.i.all, src q.i.all) ::
$(all t.all, +>.^$ (fun +>.^$)) ::
++ eels (~(tap by sup)) :: all clients
++ elfs (prey /oct2 +<-) :: network clients
++ elks (prey /sole +<-) :: console clients
++ emit |=(lime (dish %diff +<)) :: publish
++ flap |= [net=bike con=bike] :: update all clients
(echo:(echo elks con) elfs net) ::
++ flap |=(con=bike (echo (~(tap by sup)) con)) :: update all clients
++ here ~(. go src gam) :: game core
:: :: ::
:::: :::::: server logic
:: :: ::
++ fail ?:(soul (fect %bel ~) ~|(%invalid-move !!)) :: user error
++ fect |=(sole-effect (emit %sole-effect +<)) :: update console
++ fact |=(play (emit %oct2-update +<)) :: update partner
++ harp |=(game ?:(=(gam +<) +> wild(gam +<))) :: update game
++ fail (fect %bel ~) :: user error
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
++ heal |= old=axon =. +>+<+> (wake old) :: complete update
=- +>.$(gam -) ?. !=(1 +<-) gam ::
(muy:here (turn eels |=(sink q))) ::
++ hear |=(play ?-(+<- | (word +<+), & (harp +<+))) :: network update
(muy:here (turn (~(tap by sup)) |=(sink q))) ::
++ kick |= point =^ dud gam ~(m at:here +<) ::
?.(dud fail wild:?~(rem kind (send +>-))) ::
?.(dud fail wild:kind) ::
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
++ plan |= (unit ship) ?~ +< stop(gam new:here) :: link/unlink
?^(rem fail link(rem +<)) ::
++ plot |= (each point (unit ship)) :: apply command
?-(+<- & (kick +<+), | (plan +<+)) ::
++ like |*(* [/oct2 [+.rem dap] +<]) :: friend message
++ link (dish peer/(like /oct2)) :: subscribe to friend
++ lose ?^(rem . tame(gam out:here)) :: lost subscriber
++ meet ?^(rem . tame(gam inn:here)) :: gained subscriber
++ prom (fect %pro %& %oct2 stat) :: update prompt
++ hail |=(? tame(gam (hey:here +<))) :: toggle subscriber
++ prom (fect %pro %& %oct2 voy:here) :: 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 |=(point (dish poke/(like %oct2-move +<))) :: send move
++ sawn (hail(eye (~(del by eye) ost)) |) :: console unsubscribe
++ seen (hail(eye (~(put by eye) ost *sole-share)) &) :: console subscribe
++ show prom:(fect %mor rend) :: update console
++ soul =(%sole -:q:(~(got by sup) ost)) :: is console
++ stat (weld ?~(rem ~ "@{(scow p/u.rem)}") voy:here) :: prompt line
++ stop ?~(rem done wild:(dish pull/(like ~))) :: unsubscribe
++ tame (flap |=(_. (fact:+< &/gam)) |=(_. prom:+<)) :: light update
++ wild (flap |=(_. (fact:+< &/gam)) |=(_. show:+<)) :: full update
++ with |=(? (word(rem ?:(+< rem ~)) "{<[+< src]>}")) ::
++ word |= txt=tape %+ flap :: game message
|=(_+> (fact:+< |/txt)) ::
|=(_+> (fect:+< txt/txt)) ::
++ tame (flap |=(_. prom:+<)) :: light update
++ wild (flap |=(_. show:+<)) :: full update
++ word |=(tape (flap |=(_+> (fect:+< txt/+>+<)))) ::
:: :: ::
:::: :::::: console UI
:: :: ::
@ -116,8 +86,8 @@
++ delt |= cal=sole-change :: edit command line
=^ cul say (~(remit cs say) cal good) ::
?~(cul abet fail:(fect:abet det/u.cul)) ::
++ dive =+ (rust (tufa buf.say) (punt comb)) :: apply command line
?~(- fail ?~(-> show (plot:wipe ->+))) ::
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
?~(- fail ?~(-> show (kick:wipe ->+))) ::
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
++ wipe =^ cal say (~(transmit cs say) set/~) :: clear line
(fect:abet %det cal) ::
@ -125,15 +95,8 @@
:: :: ::
:::: :::::: arvo handlers
:: :: ::
++ reap-oct2 |=([* (unit)] abet:(with =(~ +<+))) :: linked to friend
++ coup-oct2 |=([* (unit)] abet:?~(+<+ +> fail)) :: move acknowledge
++ diff-oct2-update |=([* play] abet:(hear +<+)) :: network update
++ peer-oct2 |=(* abet:tame:meet) :: urbit subscribe
++ peer-sole |=(* abet:show:seen) :: console subscribe
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
++ poke-oct2-move |=(point abet:wild:(kick +<)) :: urbit move
++ prep |=(agon abet:?~(+< +> (heal +<+>))) :: load state
++ pull-oct2 |=(* abet:lose) :: urbit unsubscribe
++ pull-sole |=(* abet:sawn) :: console unsubscribe
++ quit-oct2 |=(* abet:?~(rem +> wild(rem ~))) :: unlinked by friend
--

View File

@ -8,19 +8,15 @@
:::: :::::: interfaces
!: :: ::
=> |% ::
++ axle ,[eye=face rem=(unit ship) gam=game] :: agent state
++ axle ,[eye=face gam=game] :: agent state
++ card $% [%diff lime] :: update
[%quit ~] :: cancel
[%peer wire dock path] :: subscribe
[%poke wire dock pear] :: send move
[%pull wire dock ~] :: unsubscribe
== ::
++ face (map bone sole-share) :: console state
++ lime $% [%sole-effect sole-effect] :: :sole update
[%oct3-update play] :: :oct3 update
== ::
++ move (pair bone card) :: cause and action
++ pear ,[%oct3-move point] :: outgoing move
-- ::
:: :: ::
:::: :::::: past state
@ -31,7 +27,7 @@
++ axle-0 ,[eye=face gam=game-0] :: old axle
++ game-0 ,[who=? box=board boo=board] :: old game
++ wake |= axon :- %1 ?- +<- %1 +<+ :: coarse upgrade
%0 [eye ~ [who ~^~ ~ box boo]:gam]:+<+ ::
%0 [eye [who ~^~ ~ box boo]:gam]:+<+ ::
== -- ::
:: :: ::
:::: :::::: parsers
@ -39,13 +35,12 @@
=> |% ::
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
++ comb (pick come ;~(pfix sig (punt fed:ag))) :: all command input
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) come)) :: with wait mode
-- ::
:: :: ::
:::: :::::: process core
:: :: ::
|_ $: bowl
|_ $: bowl ::
moz=(list move) :: pending actions
[%1 axle] :: process state, v1
== ::
@ -55,7 +50,6 @@
++ abet [(flop moz) .(moz ~)] :: resolve
++ bike $+(_. _+>) :: self-transformer
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
++ done (echo eels |=(_. (dish:+< %quit ~))) :: cancel everyone
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- :: publish to all
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
=> .(ost p.i.all, src q.i.all) ::
@ -63,7 +57,6 @@
++ eels (~(tap by sup)) :: all clients
++ elfs (prey /oct3 +<-) :: network clients
++ elks (prey /sole +<-) :: console clients
++ emit |=(lime (dish %diff +<)) :: publish
++ flap |= [net=bike con=bike] :: update all clients
(echo:(echo elks con) elfs net) ::
++ here ~(. go src gam) :: game core
@ -71,36 +64,23 @@
:::: :::::: server logic
:: :: ::
++ fail ?:(soul (fect %bel ~) ~|(%invalid-move !!)) :: user error
++ fect |=(sole-effect (emit %sole-effect +<)) :: update console
++ fact |=(play (emit %oct3-update +<)) :: update partner
++ harp |=(game ?:(=(gam +<) +> wild(gam +<))) :: update game
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
++ fact |=(play (dish %diff %oct3-update +<)) :: update partner
++ hail |=(? tame(gam (hey:here +<))) :: toggle subscriber
++ heal |= old=axon =. +>+<+> (wake old) :: complete update
=- +>.$(gam -) ?. !=(1 +<-) gam ::
(muy:here (turn eels |=(sink q))) ::
++ hear |=(play ?-(+<- | (word +<+), & (harp +<+))) :: network update
++ kick |= point =^ dud gam ~(m at:here +<) ::
?.(dud fail wild:?~(rem kind (send +>-))) ::
?.(dud fail wild:kind) ::
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
++ plan |= (unit ship) ?~ +< stop(gam new:here) :: link/unlink
?^(rem fail link(rem +<)) ::
++ plot |= (each point (unit ship)) :: apply command
?-(+<- & (kick +<+), | (plan +<+)) ::
++ like |*(* [/oct3 [+.rem dap] +<]) :: friend message
++ link (dish peer/(like /oct3)) :: subscribe to friend
++ lose ?^(rem . tame(gam out:here)) :: lost subscriber
++ meet ?^(rem . tame(gam inn:here)) :: gained subscriber
++ prom (fect %pro %& %oct3 stat) :: update prompt
++ prom (fect %pro %& %oct3 voy:here) :: 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 |=(point (dish poke/(like %oct3-move +<))) :: send move
++ sawn (hail(eye (~(del by eye) ost)) |) :: console unsubscribe
++ seen (hail(eye (~(put by eye) ost *sole-share)) &) :: console subscribe
++ show prom:(fect %mor rend) :: update console
++ soul =(%sole -:q:(~(got by sup) ost)) :: is console
++ stat (weld ?~(rem ~ "@{(scow p/u.rem)}") voy:here) :: prompt line
++ stop ?~(rem done wild:(dish pull/(like ~))) :: unsubscribe
++ tame (flap |=(_. (fact:+< &/gam)) |=(_. prom:+<)) :: light update
++ wild (flap |=(_. (fact:+< &/gam)) |=(_. show:+<)) :: full update
++ with |=(? (word(rem ?:(+< rem ~)) "{<[+< src]>}")) ::
++ word |= txt=tape %+ flap :: game message
|=(_+> (fact:+< |/txt)) ::
|=(_+> (fect:+< txt/txt)) ::
@ -116,8 +96,8 @@
++ delt |= cal=sole-change :: edit command line
=^ cul say (~(remit cs say) cal good) ::
?~(cul abet fail:(fect:abet det/u.cul)) ::
++ dive =+ (rust (tufa buf.say) (punt comb)) :: apply command line
?~(- fail ?~(-> show (plot:wipe ->+))) ::
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
?~(- fail ?~(-> show (kick:wipe ->+))) ::
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
++ wipe =^ cal say (~(transmit cs say) set/~) :: clear line
(fect:abet %det cal) ::
@ -125,15 +105,11 @@
:: :: ::
:::: :::::: arvo handlers
:: :: ::
++ reap-oct3 |=([* (unit)] abet:(with =(~ +<+))) :: linked to friend
++ coup-oct3 |=([* (unit)] abet:?~(+<+ +> fail)) :: move acknowledge
++ diff-oct3-update |=([* play] abet:(hear +<+)) :: network update
++ peer-oct3 |=(* abet:tame:meet) :: urbit subscribe
++ peer-oct3 |=(* abet:tame:(hail &)) :: urbit subscribe
++ peer-sole |=(* abet:show:seen) :: console subscribe
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
++ poke-oct3-move |=(point abet:wild:(kick +<)) :: urbit move
++ prep |=(agon abet:?~(+< +> (heal +<+>))) :: load state
++ pull-oct3 |=(* abet:lose) :: urbit unsubscribe
++ pull-oct3 |=(* abet:(hail |)) :: urbit unsubscribe
++ pull-sole |=(* abet:sawn) :: console unsubscribe
++ quit-oct3 |=(* abet:?~(rem +> wild(rem ~))) :: unlinked by friend
--

138
base/ape/oct4/core.hook Normal file
View File

@ -0,0 +1,138 @@
:: :: ::
:::: /hook/core/oct4/ape :::::: dependencies
:: :: ::
/? 310 :: arvo version
/- *sole, *oct4 :: structures
/+ sole, oct4 :: libraries
:: :: ::
:::: :::::: interfaces
!: :: ::
=> |% ::
++ axle ,[eye=face rem=(unit ship) gam=game] :: agent state
++ card $% [%diff lime] :: update
[%quit ~] :: cancel
[%peer wire dock path] :: subscribe
[%poke wire dock pear] :: send move
[%pull wire dock ~] :: unsubscribe
== ::
++ face (map bone sole-share) :: console state
++ lime $% [%sole-effect sole-effect] :: :sole update
[%oct4-update play] :: :oct4 update
== ::
++ move (pair bone card) :: cause and action
++ pear ,[%oct4-move point] :: outgoing move
-- ::
:: :: ::
:::: :::::: past state
:: :: ::
=> |% ::
++ agon (unit ,[(list move) axon]) :: boot argument
++ axon $%([%1 axle] [%0 axle-0]) :: all states
++ axle-0 ,[eye=face gam=game-0] :: old axle
++ game-0 ,[who=? box=board boo=board] :: old game
++ wake |= axon :- %1 ?- +<- %1 +<+ :: coarse upgrade
%0 [eye ~ [who ~^~ ~ box boo]:gam]:+<+ ::
== -- ::
:: :: ::
:::: :::::: parsers
:: :: ::
=> |% ::
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
++ comb (pick come ;~(pfix sig (punt fed:ag))) :: all command input
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
-- ::
:: :: ::
:::: :::::: process core
:: :: ::
|_ $: bowl
moz=(list move) :: pending actions
[%1 axle] :: process state, v1
== ::
:: :: ::
:::: :::::: process tools
:: :: ::
++ abet [(flop moz) .(moz ~)] :: resolve
++ bike $+(_. _+>) :: self-transformer
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
++ done (echo eels |=(_. (dish:+< %quit ~))) :: cancel everyone
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- :: publish to all
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
=> .(ost p.i.all, src q.i.all) ::
$(all t.all, +>.^$ (fun +>.^$)) ::
++ eels (~(tap by sup)) :: all clients
++ elfs (prey /oct4 +<-) :: network clients
++ elks (prey /sole +<-) :: console clients
++ emit |=(lime (dish %diff +<)) :: publish
++ flap |= [net=bike con=bike] :: update all clients
(echo:(echo elks con) elfs net) ::
++ here ~(. go src gam) :: game core
:: :: ::
:::: :::::: server logic
:: :: ::
++ fail ?:(soul (fect %bel ~) ~|(%invalid-move !!)) :: user error
++ fect |=(sole-effect (emit %sole-effect +<)) :: update console
++ fact |=(play (emit %oct4-update +<)) :: update partner
++ hail |=(? ?^(rem +> tame(gam (hey:here +<)))) :: toggle subscriber
++ harp |=(game ?:(=(gam +<) +> wild(gam +<))) :: update game
++ heal |= old=axon =. +>+<+> (wake old) :: complete update
=- +>.$(gam -) ?. !=(1 +<-) gam ::
(muy:here (turn eels |=(sink q))) ::
++ hear |=(play ?-(+<- | (word +<+), & (harp +<+))) :: network update
++ kick |= point =^ dud gam ~(m at:here +<) ::
?.(dud fail wild:?~(rem kind (send +>-))) ::
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
++ plan |= (unit ship) ?~ +< stop(gam new:here) :: link/unlink
?^(rem fail link(rem +<)) ::
++ plot |= (each point (unit ship)) :: apply command
?-(+<- & (kick +<+), | (plan +<+)) ::
++ like |*(* [/oct4 [+.rem dap] +<]) :: friend message
++ link (dish peer/(like /oct4)) :: subscribe to friend
++ prom (fect %pro %& %oct4 stat) :: update prompt
++ rend (turn `wall`tab:here |=(tape txt/+<)) :: table print
++ sawn (hail(eye (~(del by eye) ost)) |) :: console unsubscribe
++ seen (hail(eye (~(put by eye) ost *sole-share)) &) :: console subscribe
++ send |=(point (dish poke/(like %oct4-move +<))) :: send move
++ show prom:(fect %mor rend) :: update console
++ soul =(%sole -:q:(~(got by sup) ost)) :: is console
++ stat (weld ?~(rem ~ "@{(scow p/u.rem)}") voy:here) :: prompt line
++ stop ?~(rem done wild:(dish pull/(like ~))) :: unsubscribe
++ tame (flap |=(_. (fact:+< &/gam)) |=(_. prom:+<)) :: light update
++ wild (flap |=(_. (fact:+< &/gam)) |=(_. show:+<)) :: full update
++ with |=(? (word(rem ?:(+< rem ~)) "{<[+< src]>}")) ::
++ word |= txt=tape %+ flap :: game message
|=(_+> (fact:+< |/txt)) ::
|=(_+> (fect:+< txt/txt)) ::
:: :: ::
:::: :::::: console UI
:: :: ::
++ 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
++ cusp (cope !ept:here) :: parsing rule
++ delt |= cal=sole-change :: edit command line
=^ cul say (~(remit cs say) cal good) ::
?~(cul abet fail:(fect:abet det/u.cul)) ::
++ 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) ::
-- ::
:: :: ::
:::: :::::: arvo handlers
:: :: ::
++ reap-oct4 |=([* (unit)] abet:(with =(~ +<+))) :: linked to friend
++ coup-oct4 |=([* (unit)] abet:?~(+<+ +> fail)) :: move acknowledge
++ diff-oct4-update |=([* play] abet:(hear +<+)) :: network update
++ peer-oct4 |=(* abet:tame:(hail &)) :: urbit subscribe
++ peer-sole |=(* abet:show:seen) :: console subscribe
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
++ poke-oct4-move |=(point abet:wild:(kick +<)) :: urbit move
++ prep |=(agon abet:?~(+< +> (heal +<+>))) :: load state
++ pull-oct4 |=(* abet:(hail |)) :: urbit unsubscribe
++ pull-sole |=(* abet:sawn) :: console unsubscribe
++ quit-oct4 |=(* abet:?~(rem +> wild(rem ~))) :: unlinked by friend
--

View File

@ -954,7 +954,7 @@
^+ +>
?> ?=(^ ref)
?. ?=(%& -.res)
~| "validate foreign plops failed"
~| "validate foreign x failed"
=+ why=?-(-.res %| p.res, %tabl ~[>%bad-marc<])
~> %mean.|.(%*(. >[%plop-fail %why]< |1.+> why))
!!
@ -989,17 +989,13 @@
^+ +>
?> ?=(^ ref)
?> ?=(^ nak.u.ref)
?. ?=(%| -.res)
~| "validate foreign plops failed"
~> %mean.|.(rose/[" " "[" "]"]^[>%plop-fail< p.res])
!!
=+ ^- lat=(list blob)
%+ turn (gage-to-cages res)
%+ turn ~|("validate foreign plops failed" (gage-to-cages res))
|= [bob=cage cay=cage]
?. ?=(%blob p.bob)
~| %plop-not-blob
!!
=+ bol=((hard blob) q.bob)
=+ bol=((hard blob) q.q.bob)
?- -.bol
%delta [-.bol p.bol q.bol p.cay q.q.cay]
%direct [-.bol p.bol p.cay q.q.cay]
@ -1067,10 +1063,10 @@
=+ vid=(read-at-aeon:ze u.nao p.q.i.xiq)
:: ~& %red-at-aeon
?~ vid
?~ u.nao
~& [%oh-poor `path`[syd '0' r.p.q.i.xiq]]
$(xiq t.xiq)
~& [%oh-well desk=syd mood=p.q.i.xiq aeon=u.nao]
:: ?: =(0 u.nao)
:: ~& [%oh-poor `path`[syd '0' r.p.q.i.xiq]]
:: $(xiq t.xiq)
:: ~& [%oh-well desk=syd mood=p.q.i.xiq aeon=u.nao]
$(xiq t.xiq, xaq [i.xiq xaq])
$(xiq t.xiq, ..wake (balk p.i.xiq u.vid p.q.i.xiq))
::
@ -1455,6 +1451,8 @@
++ read-x
|= [yon=aeon pax=path]
^- (unit (unit (each cage lobe)))
?: =(0 yon)
[~ ~]
=+ tak=(~(get by hit.dom) yon)
?~ tak
~
@ -1485,6 +1483,8 @@
++ read-y
|= [yon=aeon pax=path]
^- (unit (unit ,[%arch (hypo arch)]))
?: =(0 yon)
``[%arch -:!>(*arch) *arch]
=+ tak=(~(get by hit.dom) yon)
?~ tak
~

View File

@ -1030,6 +1030,7 @@
%plug `%c
%them `%e
%want `%a
%warp `%c
==
--
--

View File

@ -9,7 +9,8 @@
++ kiln-part ,[%kiln %0 kiln-pith] :: kiln state
++ kiln-pith ::
$: rem=(map desk kiln-desk) ::
==
syn=(map hood-sync ,[let=@ud ust=bone]) ::
== ::
++ kiln-desk :: per-desk state
$: auto=? :: escalate on failure
gem=germ :: strategy
@ -35,8 +36,8 @@
sud=desk ::
gim=?(%auto germ) ::
== ::
++ hood-cp [input=path output=path] ::
++ hood-mv [input=path output=path]
++ hood-cp [input=path output=path] ::
++ hood-mv [input=path output=path] ::
-- ::
:: :: ::
:::: :: ::
@ -54,6 +55,7 @@
[%merg wire @p @tas @p @tas germ] ::
[%plug wire @p @tas @p @tas] ::
[%poke wire dock pear] ::
[%warp wire sock riff] ::
== ::
++ pear :: poke fruit
$% [%talk-command command:talk] ::
@ -76,8 +78,11 @@
abet:(emit %lynx /kiln our syd syn)
::
++ poke-sync ::
|= hood-sync
abet:(emit %font /kiln our syd her sud)
|= hos=hood-sync
?: (~(has by syn) hos)
=+ "already syncing from {<sud.hos>} on {<her.hos>} to {<syd.hos>}"
abet:(spam leaf/- ~)
abet:abet:start:(auto hos)
::
++ poke-merge ::
|= hood-merge
@ -115,6 +120,113 @@
|= [way=wire saw=(unit tang)]
abet:abet:(coup-fancy:(take way) saw)
::
++ take-mere-sync ::
|= [way=wire mes=(each (set path) (pair term tang))]
?> ?=([@ @ @ ~] way)
=+ ^- hos=hood-sync
:* syd=(slav %tas i.way)
her=(slav %p i.t.way)
sud=(slav %tas i.t.t.way)
==
abet:abet:(mere:(auto hos) mes)
::
++ take-writ ::
|= [way=wire rot=riot]
?> ?=([@ @ @ ~] way)
=+ ^- hos=hood-sync
:* syd=(slav %tas i.way)
her=(slav %p i.t.way)
sud=(slav %tas i.t.t.way)
==
abet:abet:(writ:(auto hos) rot)
::
++ spam
|= mes=(list tank)
%- emit
:* %poke /kiln/spam
[our %talk] %talk-command
^- command:talk
:- %publish
%- flop
=< acc
%+ roll mes
=< .(eny ^eny)
|= [tan=tank acc=(list thought:talk) eny=@uvI]
^- [acc=(list thought:talk) eny=@uvI]
=+ (sham eny mes)
:_ -
:_ acc
^- thought:talk
:+ -
[[[%& our (main our)] [*envelope:talk %pending]] ~ ~]
[now *bouquet:talk [%app (crip ~(ram re tan))]]
==
::
++ auto
|= hood-sync
=+ (fall (~(get by syn) syd her sud) [let=*@ud ust=ost])
|%
++ abet
..auto(syn (~(put by syn) [syd her sud] let ust))
::
++ blab
|= new=(list move)
^+ +>
+>.$(moz (welp new moz))
::
++ spam |*(* %_(+> ..auto (^spam +<)))
++ start
%- blab :_ ~
:* ost %warp
/kiln/sync/[syd]/(scot %p her)/[sud]
[our her] sud ~ %sing %w [%da now] /
==
::
++ writ
|= rot=riot
?~ rot
%^ spam
leaf/"bad %writ response on autosync"
leaf/"from {<sud>} on {<her>} to {<syd>}"
~
=. let ?. ?=(%w p.p.u.rot) let ((hard ,@ud) q.q.r.u.rot)
%- blab :_ ~
:* ost %merg
/kiln/sync/[syd]/(scot %p her)/[sud]
our syd her sud
?: =(0 .^(%cw /(scot %p our)/[syd]/(scot %da now)))
%init
%mate
==
::
++ mere
|= mes=(each (set path) (pair term tang))
=. let +(let)
=. +>.$
%- spam
?: ?=(%& -.mes)
[leaf/"autosync succeeded from {<sud>} on {<her>} to {<syd>}" ~]
?+ p.p.mes
:* leaf/"autosync failed from {<sud>} on {<her>} to {<syd>}"
leaf/"please manually merge the desks with"
leaf/":+merge %{(trip syd)} {(scow %p her)} %{(trip sud)}"
leaf/""
leaf/"error code: {<p.p.mes>}"
q.p.mes
==
::
%no-ali-desk
:~ leaf/"{<sud>} on {<her>} does not exist, so the sync"
leaf/"into {<syd>} will begin automatically when it does"
==
==
%- blab :_ ~
:* ost %warp
/kiln/sync/[syd]/(scot %p her)/[sud]
[our her] sud ~ %sing %y [%ud let] /
==
--
::
++ work :: state machine
|= syd=desk
=+ ^- kiln-desk
@ -125,7 +237,7 @@
++ abet :: resolve
..work(rem (~(put by rem) syd auto gem her sud cas))
::
++ blab :: emit, XX remove
++ blab
|= new=(list move)
^+ +>
+>.$(moz (welp new moz))
@ -134,7 +246,7 @@
++ lose
^+ .
~| %kiln-work-fail
!!
.
::
++ ford-fail
|=(tan=tang ~|(%ford-fail (mean tan)))
@ -179,28 +291,7 @@
%- blab :_ ~
[ost %poke /kiln/fancy/[^syd] [our %hood] %hood-merge [syd her sud gem]]
::
++ spam
|= mes=(list tank)
%- blab :_ ~
:* ost %poke /kiln/spam/[syd]
[our %talk] %talk-command
^- command:talk
:- %publish
%- flop
=< acc
%+ roll mes
=< .(eny eny)
|= [tan=tank acc=(list thought:talk) eny=@uvI]
^- [acc=(list thought:talk) eny=@uvI]
=+ (sham eny mes)
:_ -
:_ acc
^- thought:talk
:+ -
[[[%& our (main our)] [*envelope:talk %pending]] ~ ~]
[now *bouquet:talk [%app (crip ~(ram re tan))]]
==
::
++ spam |*(* +>(..work (^spam +<)))
++ merge
|= [her=@p sud=@tas gim=?(%auto germ)]
^+ +>
@ -341,7 +432,7 @@
=< win
%- blab:(spam tan)
:_ ~
:* ost %info /kiln/[syd]/dash
:* ost %info /kiln/[syd]
our (cat 3 syd '-scratch')
%& *cart
%+ murn can

View File

@ -12,49 +12,31 @@
|_ bud=board ::
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
++ get |=(point (bit (off +<))) :: get point
++ jon a/(turn (gulf 0 9) |=(@ b/(bit +<))) :: to json
++ off |=(point (add x (mul 3 y))) :: bitfield address
++ set |=(point (con bud (bex (off +<)))) :: set point
++ win %- lien :_ |=(a=@ =(a (dis a bud))) :: test for win
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
-- ::
++ go :: play from
|_ [src=ship game] ::
|_ game ::
++ at |_ point :: per point
++ g `game`+>+<+ :: game
++ k &(!|(x o) ept) :: legal move
++ g +>+< :: game
++ k !|(x o) :: legal move
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
++ o (~(get bo boo) +<) :: old at o
++ p .(boo (~(set bo boo) +<), q.sag `src) :: play at o
++ p .(boo (~(set bo boo) +<)) :: play at o
++ t .(who !who) :: take turn
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
++ x (~(get bo box) +<) :: old at x
++ y .(box (~(set bo box) +<), p.sag `src) :: play at x
++ y .(box (~(set bo box) +<)) :: play at x
-- ::
++ ept =+(own |(&(=(~ -) !=(oth `src)) =(`src -))) :: we can play
++ inn +<+(aud ((stat ship) & src aud)) :: source in audience
++ muy |= (list ship) ?~ +< +>+<+ :: many in audience
$(+< t.+<, aud ((stat ship) & i.+< aud)) ::
++ nam =+ ?: =(p.sag `src) ['=' (icon &) ~] :: print name
?: =(q.sag `src) ['=' (icon |) ~] ::
"" (welp (scow %p src) `tape`-) ::
++ new +<+(boo 0, box 0, who &, sag [~ ~]) :: reset game
++ oth own(who !who) :: who owns other turn
++ out +<+(aud ((stat ship) | src aud)) :: source quit audience
++ own ?:(who p.sag q.sag) :: who owns this turn
++ new +<(boo 0, box 0, who &) :: reset game
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
?: =(511 (con boo box)) ::
`"tie :-(" ~ `"{<nam>} wins" ::
`"tie :-(" ~ `"{<~[(icon who)]>} wins" ::
++ row |= y=@ :- (add y '1') %- zing :: print row
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
++ str =+ [own ~[(icon who)]] ^- tape :: print player
?~(-< -> (scow %p u.-<)) ::
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
++ vew =- ?: =(~ -) ~ :(weld "[" - "]") :: print watchers
=+ dow=(~(tap by aud)) |- ^- tape ::
?~ dow ~ =+ mor=$(dow t.dow) ::
:(weld nam(src p.i.dow) ?~(mor "" ", ") mor) ::
++ voy =+ ~[(icon who)] %+ weld vew :: print prompt
?.(ept " ({-}'s turn) " ": {-} (row/col): ")::
++ voy ": {<~[(icon who)]>} (row/col): " :: print prompt
--
--

View File

@ -12,7 +12,6 @@
|_ bud=board ::
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
++ get |=(point (bit (off +<))) :: get point
++ jon a/(turn (gulf 0 9) |=(@ b/(bit +<))) :: to json
++ off |=(point (add x (mul 3 y))) :: bitfield address
++ set |=(point (con bud (bex (off +<)))) :: set point
++ win %- lien :_ |=(a=@ =(a (dis a bud))) :: test for win
@ -32,7 +31,7 @@
++ y .(box (~(set bo box) +<), p.sag `src) :: play at x
-- ::
++ ept =+(own |(&(=(~ -) !=(oth `src)) =(`src -))) :: we can play
++ inn +<+(aud ((stat ship) & src aud)) :: source in audience
++ hey |=(? +>+<+(aud ((stat ship) +< src aud))) :: enter/leave
++ muy |= (list ship) ?~ +< +>+<+ :: many in audience
$(+< t.+<, aud ((stat ship) & i.+< aud)) ::
++ nam =+ ?: =(p.sag `src) ['=' (icon &) ~] :: print name
@ -40,7 +39,6 @@
"" (welp (scow %p src) `tape`-) ::
++ new +<+(boo 0, box 0, who &, sag [~ ~]) :: reset game
++ oth own(who !who) :: who owns other turn
++ out +<+(aud ((stat ship) | src aud)) :: source quit audience
++ own ?:(who p.sag q.sag) :: who owns this turn
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
?: =(511 (con boo box)) ::

View File

@ -32,7 +32,7 @@
++ y .(box (~(set bo box) +<), p.sag `src) :: play at x
-- ::
++ ept =+(own |(&(=(~ -) !=(oth `src)) =(`src -))) :: we can play
++ inn +<+(aud ((stat ship) & src aud)) :: source in audience
++ hey |=(? +>+<+(aud ((stat ship) +< src aud))) :: enter/leave
++ muy |= (list ship) ?~ +< +>+<+ :: many in audience
$(+< t.+<, aud ((stat ship) & i.+< aud)) ::
++ nam =+ ?: =(p.sag `src) ['=' (icon &) ~] :: print name
@ -40,7 +40,6 @@
"" (welp (scow %p src) `tape`-) ::
++ new +<+(boo 0, box 0, who &, sag [~ ~]) :: reset game
++ oth own(who !who) :: who owns other turn
++ out +<+(aud ((stat ship) | src aud)) :: source quit audience
++ own ?:(who p.sag q.sag) :: who owns this turn
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
?: =(511 (con boo box)) ::
@ -53,7 +52,7 @@
++ vew =- ?: =(~ -) ~ :(weld "[" - "]") :: print watchers
=+ dow=(~(tap by aud)) |- ^- tape ::
?~ dow ~ =+ mor=$(dow t.dow) ::
:(weld nam(src p.i.dow) ?~(mor "" ", ") mor) ::
:(weld nam(src p.i.dow) ?~(mor "" ", ") mor) ::
++ voy =+ ~[(icon who)] %+ weld vew :: print prompt
?.(ept " ({-}'s turn) " ": {-} (row/col): ")::
--

59
base/lib/oct4/core.hook Normal file
View File

@ -0,0 +1,59 @@
:: :: ::
:::: /hook/core/oct4/lib :: :: dependencies
:: :: ::
/? 310 :: arvo version
/- *oct4 :: structures
:: :: ::
:::: :: :: semantics
!: :: ::
|%
++ icon |=(? ?:(+< 'X' 'O')) :: display at
++ bo :: per board
|_ bud=board ::
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
++ get |=(point (bit (off +<))) :: get point
++ jon a/(turn (gulf 0 9) |=(@ b/(bit +<))) :: to json
++ off |=(point (add x (mul 3 y))) :: bitfield address
++ set |=(point (con bud (bex (off +<)))) :: set point
++ win %- lien :_ |=(a=@ =(a (dis a bud))) :: test for win
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
-- ::
++ go :: play from
|_ [src=ship game] ::
++ at |_ point :: per point
++ g `game`+>+<+ :: game
++ k &(!|(x o) ept) :: legal move
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
++ o (~(get bo boo) +<) :: old at o
++ p .(boo (~(set bo boo) +<), q.sag `src) :: play at o
++ t .(who !who) :: take turn
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
++ x (~(get bo box) +<) :: old at x
++ y .(box (~(set bo box) +<), p.sag `src) :: play at x
-- ::
++ ept =+(own |(&(=(~ -) !=(oth `src)) =(`src -))) :: we can play
++ hey |=(? +>+<+(aud ((stat ship) +< src aud))) :: enter/leave
++ muy |= (list ship) ?~ +< +>+<+ :: many in audience
$(+< t.+<, aud ((stat ship) & i.+< aud)) ::
++ nam =+ ?: =(p.sag `src) ['=' (icon &) ~] :: print name
?: =(q.sag `src) ['=' (icon |) ~] ::
"" (welp (scow %p src) `tape`-) ::
++ new +<+(boo 0, box 0, who &, sag [~ ~]) :: reset game
++ oth own(who !who) :: who owns other turn
++ own ?:(who p.sag q.sag) :: who owns this turn
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
?: =(511 (con boo box)) ::
`"tie :-(" ~ `"{<nam>} wins" ::
++ row |= y=@ :- (add y '1') %- zing :: print row
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
++ str =+ [own ~[(icon who)]] ^- tape :: print player
?~(-< -> (scow %p u.-<)) ::
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
++ vew =- ?: =(~ -) ~ :(weld "[" - "]") :: print watchers
=+ dow=(~(tap by aud)) |- ^- tape ::
?~ dow ~ =+ mor=$(dow t.dow) ::
:(weld nam(src p.i.dow) ?~(mor "" ", ") mor) ::
++ voy =+ ~[(icon who)] %+ weld vew :: print prompt
?.(ept " ({-}'s turn) " ": {-} (row/col): ")::
--
--

View File

@ -0,0 +1,16 @@
::
:::: /hook/door/oct4-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
--
--

View File

@ -0,0 +1,34 @@
:: :: ::
:::: /hook/door/oct4-update/mar :::::: dependencies
:: :: ::
/? 310 :: arvo
/- *oct4 :: structures
/+ oct4 :: libraries
!: :: ::
:::: :: :: protocol
:: :: ::
|_ play :: game
++ grab :: convert from
|%
++ noun play :: from %noun
--
++ grow :: convert to
|%
++ json ^- ^json :: to %json
~! +>-<
?: ?=(| +>-<)
~! +>-<
~! p
s/(crip p)
=+ she=|=(ship s/(scot %p +<))
=+ hes=|=([ship *] (she +<-))
%- jobe
:~ who/s/?:(who.p %x %o)
plx/?~(p.sag.p ~ (she u.p.sag.p))
plo/?~(q.sag.p ~ (she u.q.sag.p))
aud/a/(turn (~(tap by aud.p)) hes)
box/~(jon bo box.p)
boo/~(jon bo boo.p)
==
--
--

View File

@ -1,19 +1,15 @@
:: :: ::
:::: /hook/core/oct1/sur :::::: dependencies
:: :: ::
/? 310 ::
/? 310 :: arvo version
:: :: ::
:::: :::::: semantics
:: :: ::
|% ::
++ board ,@ :: one-player bitfield
++ point ,[x=@ y=@] :: coordinate
++ stage (pair (unit ship) (unit ship)) :: players
++ play (each game tape) :: update
++ game :: game state
$: who=? :: whose turn
sag=stage :: who's playing
aud=(map ship ,@ud) :: who's watching
box=board :: X board
boo=board :: O board
== ::

View File

@ -9,7 +9,6 @@
++ board ,@ :: one-player bitfield
++ point ,[x=@ y=@] :: coordinate
++ stage (pair (unit ship) (unit ship)) :: players
++ play (each game tape) :: update
++ game :: game state
$: who=? :: whose turn
sag=stage :: who's playing