mirror of
https://github.com/urbit/shrub.git
synced 2025-01-02 17:43:32 +03:00
oct* compile.
This commit is contained in:
parent
d52d49121d
commit
f017a73d44
@ -655,14 +655,14 @@
|
||||
=. insts.vat
|
||||
%- mo
|
||||
%+ weld dropz
|
||||
%+ skip (~(tap by insts.vat) *(list ,[@t instance]))
|
||||
%+ skip (~(tap by insts.vat) *(list {@t instance}))
|
||||
|=(a+{@t instance} ?=($do +>.$))
|
||||
=+ buf=`@da`(add ~s10 now)
|
||||
:_ +>.$
|
||||
:- [ost %wait /refresh-do buf]
|
||||
%- spam
|
||||
%- instance-to-json
|
||||
%+ turn (~(tap by insts.vat) *(list ,[@t instance]))
|
||||
%+ turn (~(tap by insts.vat) *(list {@t instance}))
|
||||
|=(a=[@t instance] +.a)
|
||||
::
|
||||
++ thou-list-do-images
|
||||
|
@ -9,23 +9,23 @@
|
||||
:::: :::::: interfaces
|
||||
!: :: ::
|
||||
=> |% ::
|
||||
++ axle {eye+face gam+game} :: agent state
|
||||
++ axle {eye+face gam+game} :: agent state
|
||||
++ card $% {$diff lime} :: update
|
||||
{$quit ~} :: cancel
|
||||
{$quit $~} :: cancel
|
||||
== ::
|
||||
++ face (map bone sole-share) :: console state
|
||||
++ lime {$sole-effect sole-effect} :: :sole update
|
||||
++ lime {$sole-effect sole-effect} :: :sole update
|
||||
++ move (pair bone card) :: cause and action
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: past state
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ 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 +<+ :: rough upgrade
|
||||
%0 [eye [who ~^~ ~ box boo]:gam]:+<+ ::
|
||||
++ 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 +<+ :: rough upgrade
|
||||
$0 [eye [who ~^~ ~ box boo]:gam]:+<+ ::
|
||||
== -- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
@ -48,7 +48,7 @@
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. _+>) :: self-transformer
|
||||
++ dish |=(cad+card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ echo |= [all+(list sink) fun+bike] =+ old=+>+<- :: publish to all
|
||||
++ echo |= {all+(list sink) fun+bike} =+ old=+>+<- :: publish to all
|
||||
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
|
||||
=> .(ost p.i.all, src q.i.all) ::
|
||||
$(all t.all, +>.^$ (fun +>.^$)) ::
|
||||
@ -59,7 +59,7 @@
|
||||
:: :: ::
|
||||
++ fail (fect %bel ~) :: user error
|
||||
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
|
||||
++ heal |= old=axon =. +>+<+> (wake old) :: complete update
|
||||
++ heal |= old+axon =. +>+<+> (wake old) :: complete update
|
||||
=- +>.$(gam -) ?. !=(1 +<-) gam ::
|
||||
(muy:here (turn (~(tap by sup)) |=(sink q))) ::
|
||||
++ kick |= point =^ dud gam ~(m at:here +<) ::
|
||||
@ -78,17 +78,17 @@
|
||||
:::: :::::: console UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act=sole-action ::
|
||||
|= act+sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet $det (delt +.act), $ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal=sole-change :: edit command line
|
||||
++ delt |= cal+sole-change :: edit command line
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det/u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
|
||||
?~(- fail ?~(-> show (kick:wipe ->+))) ::
|
||||
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ good |=((list @c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit sole say) set/~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
|
@ -26,8 +26,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 +<+ :: coarse upgrade
|
||||
$0 [eye [who ~^~ ~ box boo]:gam]:+<+ ::
|
||||
== -- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
@ -48,9 +48,9 @@
|
||||
:::: :::::: process tools
|
||||
:: :: ::
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. $+>) :: self-transformer
|
||||
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- :: publish to all
|
||||
++ bike $+(_. _+>) :: self-transformer
|
||||
++ dish |=(cad+card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ echo |= {all+(list sink) fun+bike} =+ old=+>+<- :: publish to all
|
||||
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
|
||||
=> .(ost p.i.all, src q.i.all) ::
|
||||
$(all t.all, +>.^$ (fun +>.^$)) ::
|
||||
@ -82,15 +82,15 @@
|
||||
++ tame (flap |=(_. (fact:+< &/gam)) |=(_. prom:+<)) :: light update
|
||||
++ wild (flap |=(_. (fact:+< &/gam)) |=(_. show:+<)) :: full update
|
||||
++ word |= txt+tape %+ flap :: game message
|
||||
|=($+> (fact:+< |/txt)) ::
|
||||
|=($+> (fect:+< txt/txt)) ::
|
||||
|=(_+> (fact:+< |/txt)) ::
|
||||
|=(_+> (fect:+< txt/txt)) ::
|
||||
:: :: ::
|
||||
:::: :::::: console UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act+sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet %det (delt +.act), %ret dive) ::
|
||||
|^ ?+(-.act abet $det (delt +.act), $ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal+sole-change :: edit command line
|
||||
|
@ -31,8 +31,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 +<+ :: coarse upgrade
|
||||
$0 [eye ~ [who ~^~ ~ box boo]:gam]:+<+ ::
|
||||
== -- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
@ -54,7 +54,7 @@
|
||||
:::: :::::: process tools
|
||||
:: :: ::
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. $+>) :: self-transformer
|
||||
++ 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
|
||||
@ -79,14 +79,14 @@
|
||||
++ heal |= old+axon =. +>+<+> (wake old) :: complete update
|
||||
=- +>.$(gam -) ?. !=(1 +<-) gam ::
|
||||
(muy:here (turn eels |=(sink q))) ::
|
||||
++ hear |=(play ?-(+<- | (word +<+), & (harp +<+))) :: network update
|
||||
++ 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 +<+)) ::
|
||||
?-(+<- $& (kick +<+), $| (plan +<+)) ::
|
||||
++ like |*(* [/oct4 [+.rem dap] +<]) :: friend message
|
||||
++ link (dish peer/(like /oct4)) :: subscribe to friend
|
||||
++ prom (fect %pro %& %oct4 stat) :: update prompt
|
||||
@ -102,32 +102,32 @@
|
||||
++ wild (flap |=(_. (fact:+< &/gam)) |=(_. show:+<)) :: full update
|
||||
++ with |=(? (word(rem ?:(+< rem ~)) "{<[+< src]>}")) ::
|
||||
++ word |= txt+tape %+ flap :: game message
|
||||
|=($+> (fact:+< |/txt)) ::
|
||||
|=($+> (fect:+< txt/txt)) ::
|
||||
|=(_+> (fact:+< |/txt)) ::
|
||||
|=(_+> (fect:+< txt/txt)) ::
|
||||
:: :: ::
|
||||
:::: :::::: console UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act=sole-action ::
|
||||
|= act+sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet %det (delt +.act), %ret dive) ::
|
||||
|^ ?+(-.act abet $det (delt +.act), $ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal=sole-change :: edit command line
|
||||
++ delt |= cal+sole-change :: edit command line
|
||||
=^ cul say (~(remit sole 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
|
||||
++ good |=((list @c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit sole 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
|
||||
++ 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
|
||||
|
@ -3,6 +3,6 @@
|
||||
[twitter .]
|
||||
|_ [bowl ~]
|
||||
++ poke-noun |=(span (onwards [%peer / [our %twit] /user/[+<]]))
|
||||
++ onwards |*([mark *] [[ost +<]~ +>.$])
|
||||
++ diff-twit-feed |=([* a=(list twit-stat)] ?~(a `+>.$ ~&(i.a $(a t.a))))
|
||||
++ onwards |*({mark *} [[ost +<]~ +>.$])
|
||||
++ diff-twit-feed |=({* a=(list twit-stat)} ?~(a `+>.$ ~&(i.a $(a t.a))))
|
||||
--
|
||||
|
@ -322,11 +322,11 @@
|
||||
{$zpzp $~} :: always crash
|
||||
== ::
|
||||
++ stem (pair term @) ::
|
||||
++ tine (list (pair twig twig))
|
||||
++ tine (list (pair twig twig)) ::
|
||||
++ tusk (list twig) ::
|
||||
++ tyre (list {p+term q+twig}) ::
|
||||
++ tyre (list {p+term q+twig}) ::
|
||||
++ tyke (list (unit twig)) ::
|
||||
++ tram (list {p+wing q+twig}) ::
|
||||
++ tram (list {p+wing q+twig}) ::
|
||||
:: :::::: virtual nock
|
||||
++ nock $^ {p+nock q+nock} :: autocons
|
||||
$% {$0 p+@} :: axis select
|
||||
@ -352,9 +352,9 @@
|
||||
== ::
|
||||
++ tune $% {$0 p+vase} ::
|
||||
{$1 p+(list)} ::
|
||||
{$2 p+(list {@ta *})} ::
|
||||
{$2 p+(list {@ta *})} ::
|
||||
== ::
|
||||
++ twin {p+term q+wing r+axis s+type} :: alias info
|
||||
++ twin {p+term q+wing r+axis s+type} :: alias info
|
||||
++ type $@ ?($noun $void) :: set all or set none
|
||||
$% {$atom p+term} :: number and format
|
||||
{$bull p+twin q+type} :: wing synonym
|
||||
@ -363,7 +363,7 @@
|
||||
{$cube p+* q+type} :: constant
|
||||
{$face p+term q+type} :: name
|
||||
{$fork p+type q+type} :: union/branch
|
||||
{$hold p+(list {p+type q+twig})} :: infinite genrator
|
||||
{$hold p+(list {p+type q+twig})} :: infinite genrator
|
||||
== ::
|
||||
++ typo type :: old type
|
||||
++ udal :: atomic change (%b)
|
||||
|
@ -1,25 +1,25 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct1/lib :::::: dependencies
|
||||
:::: /hoon/oct1/lib :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct1 :: structures
|
||||
/- oct1 :: structures
|
||||
=> ^oct1 :: namespace
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
!: :: ::
|
||||
[oct1 .]
|
||||
|% ::
|
||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
||||
++ bo :: per board
|
||||
|_ bud=board ::
|
||||
|_ bud+board ::
|
||||
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
|
||||
++ get |=(point (bit (off +<))) :: get point
|
||||
++ 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
|
||||
++ win %- lien :_ |=(a+@ =(a (dis a bud))) :: test for win
|
||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
||||
-- ::
|
||||
++ go :: play from
|
||||
|_ game ::
|
||||
|_ game:oct1 ::
|
||||
++ at |_ point :: per point
|
||||
++ g +>+< :: game
|
||||
++ k !|(x o) :: legal move
|
||||
@ -35,7 +35,7 @@
|
||||
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
|
||||
?: =(511 (con boo box)) ::
|
||||
`"tie :-(" ~ `"{<~[(icon who)]>} wins" ::
|
||||
++ row |= y=@ :- (add y '1') %- zing :: print row
|
||||
++ row |= y+@ :- (add y '1') %- zing :: print row
|
||||
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
|
||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
||||
++ voy ": {<~[(icon who)]>} (row/col): " :: print prompt
|
||||
|
@ -2,24 +2,24 @@
|
||||
:::: /hoon/oct2/lib :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct2 :: structures
|
||||
/- oct2 :: structures
|
||||
=> ^oct2 :: namespace
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
!: :: ::
|
||||
[oct2 .]
|
||||
|% ::
|
||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
||||
++ bo :: per board
|
||||
|_ bud=board ::
|
||||
|_ bud+board ::
|
||||
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
|
||||
++ get |=(point (bit (off +<))) :: get point
|
||||
++ 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
|
||||
++ win %- lien :_ |=(a+@ =(a (dis a bud))) :: test for win
|
||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
||||
-- ::
|
||||
++ go :: play from
|
||||
|_ [src=ship game] ::
|
||||
|_ {src+ship game} ::
|
||||
++ at |_ point :: per point
|
||||
++ g `game`+>+<+ :: game
|
||||
++ k &(!|(x o) ept) :: legal move
|
||||
@ -44,7 +44,7 @@
|
||||
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
|
||||
?: =(511 (con boo box)) ::
|
||||
`"tie :-(" ~ `"{<nam>} wins" ::
|
||||
++ row |= y=@ :- (add y '1') %- zing :: print row
|
||||
++ 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.-<)) ::
|
||||
|
@ -2,7 +2,7 @@
|
||||
:::: /hoon/oct3/lib :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct3 :: structures
|
||||
/- oct3 :: structures
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
!: :: ::
|
||||
|
@ -2,15 +2,15 @@
|
||||
:::: /hoon/oct1/sur :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
:: :: ::
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
:: :: ::
|
||||
|% ::
|
||||
++ board ,@ :: one-player bitfield
|
||||
++ point ,[x=@ y=@] :: coordinate
|
||||
++ board @ :: one-player bitfield
|
||||
++ point {x+@ y+@} :: coordinate
|
||||
++ game :: game state
|
||||
$: who=? :: whose turn
|
||||
box=board :: X board
|
||||
boo=board :: O board
|
||||
$: who+? :: whose turn
|
||||
box+board :: X board
|
||||
boo+board :: O board
|
||||
== ::
|
||||
--
|
||||
|
@ -6,14 +6,14 @@
|
||||
:::: :::::: semantics
|
||||
:: :: ::
|
||||
|% ::
|
||||
++ board ,@ :: one-player bitfield
|
||||
++ point ,[x=@ y=@] :: coordinate
|
||||
++ board @ :: one-player bitfield
|
||||
++ point {x+@ y+@} :: coordinate
|
||||
++ stage (pair (unit ship) (unit ship)) :: players
|
||||
++ 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
|
||||
$: who+? :: whose turn
|
||||
sag+stage :: who's playing
|
||||
aud+(map ship @ud) :: who's watching
|
||||
box+board :: X board
|
||||
boo+board :: O board
|
||||
== ::
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user