mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-30 10:27:11 +03:00
no demo
This commit is contained in:
parent
2dfcda3923
commit
e871adea36
@ -1,152 +0,0 @@
|
|||||||
|
|
||||||
Commands
|
|
||||||
|
|
||||||
[from URL bar]
|
|
||||||
***TBD - Galen/Anton please fill in
|
|
||||||
|
|
||||||
[from unix]
|
|
||||||
For A, to build and boot:
|
|
||||||
git clone https://github.com/urbit/urbit
|
|
||||||
cd urbit
|
|
||||||
make
|
|
||||||
bin/urbit -T $A -c $A
|
|
||||||
|
|
||||||
For A, to kill and restart from checkpoint:
|
|
||||||
[in new terminal] killall -9 urbit
|
|
||||||
[in old terminal] urbit $A
|
|
||||||
|
|
||||||
For A, to kill, delete checkpoint, and rerun events:
|
|
||||||
[in new terminal] killall -9 urbit; rm -rf $A/.urb/chk
|
|
||||||
[in old terminal] urbit $A
|
|
||||||
|
|
||||||
For B, to edit /foo/bar/hoon:
|
|
||||||
*** Philip/anyone, add directions to install vim style
|
|
||||||
|
|
||||||
vim urbit/$B/$B/in/$DEMO/foo/bar.hoon
|
|
||||||
|
|
||||||
|
|
||||||
[from talk]
|
|
||||||
For A, to private-message B (who defaults to talking back):
|
|
||||||
|
|
||||||
;~B
|
|
||||||
|
|
||||||
To create a channel '%foobar':
|
|
||||||
|
|
||||||
;create channel %foobar 'channel description'
|
|
||||||
|
|
||||||
[from hood, #]
|
|
||||||
|
|
||||||
For A or B, to start tictactoe:
|
|
||||||
|
|
||||||
*demo/tictactoe
|
|
||||||
|
|
||||||
For A or B, to log in to X's tictactoe:
|
|
||||||
|
|
||||||
+~X/
|
|
||||||
|
|
||||||
To log out:
|
|
||||||
|
|
||||||
-~X/tictactoe
|
|
||||||
|
|
||||||
[from dojo]
|
|
||||||
|
|
||||||
For B, to create a %demo desk for this project:
|
|
||||||
|
|
||||||
:+merge %demo ~B %home
|
|
||||||
|
|
||||||
For A, to sync and follow B's demo desk:
|
|
||||||
|
|
||||||
:+sync %demo ~B %demo
|
|
||||||
|
|
||||||
[to send bitcoin]
|
|
||||||
Start the dæmon(from sole):
|
|
||||||
*bit
|
|
||||||
|
|
||||||
Auth in (from dojo):
|
|
||||||
:bit+auth [reacted-see-asana] 'f771f6dc08910095b2476b033dca62ddcb302b6617e6a7d4d66e194a2a9bd605'
|
|
||||||
|
|
||||||
In webtalk, click on the link and auth in. The password for coinbase account anton.dyudin@tlon.io has been communicated privately.
|
|
||||||
|
|
||||||
Click authorize and then return to the command line.
|
|
||||||
|
|
||||||
To send:
|
|
||||||
|
|
||||||
:bit+send 0c[bitcoin-address] '[qty-of-bitcoin]'
|
|
||||||
|
|
||||||
I recommend sending about .0001 bitcoin (2¢) because it's just over their minimum and it's an account with limited funds.
|
|
||||||
With this protocol, the recipient will obviously have to provide their btc address over chat.
|
|
||||||
|
|
||||||
Lastly, on https://blockchain.info/ there is a search bar that allows you to search by address, assuming you wish to display the address
|
|
||||||
|
|
||||||
[files in script, clay and unix]
|
|
||||||
|
|
||||||
The tictactoe app, all three versions:
|
|
||||||
|
|
||||||
/=demo=/ape/tictactoe/core/hook
|
|
||||||
urbit/$X/$X/in/$DEMO/ape/tictactoe/core/hook
|
|
||||||
|
|
||||||
version 1 (centralized):
|
|
||||||
$DEMO/files/1-ape-tictactoe.hoon
|
|
||||||
|
|
||||||
version 2 (distributed):
|
|
||||||
$DEMO/files/2-ape-tictactoe.hoon
|
|
||||||
|
|
||||||
version 3 (webified)
|
|
||||||
$DEMO/files/3-ape-tictactoe.hoon
|
|
||||||
|
|
||||||
Helper files needed for version 2:
|
|
||||||
|
|
||||||
The %octo-game mark, for game update diffs:
|
|
||||||
|
|
||||||
/=demo=/mar/octo-game/door/hook
|
|
||||||
urbit/$X/$X/in/$DEMO/mar/octo-game/door.hook
|
|
||||||
$DEMO/files/mar-octo-game.hoon
|
|
||||||
|
|
||||||
Helper files needed for version 3:
|
|
||||||
|
|
||||||
The %octo-move mark, for moves from the web:
|
|
||||||
|
|
||||||
/=demo=/mar/octo-move/door/hook
|
|
||||||
urbit/$X/$X/in/$DEMO/mar/octo-move/door.hook
|
|
||||||
$DEMO/files/mar-octo-move.hoon
|
|
||||||
|
|
||||||
The HTML generator:
|
|
||||||
|
|
||||||
/=demo=/pub/octo/fab/hymn/hook
|
|
||||||
urbit/$X/$X/in/$DEMO/pub/octo/fab/hymn.hook
|
|
||||||
$DEMO/files/pub-octo-hymn.hoon
|
|
||||||
|
|
||||||
The CSS:
|
|
||||||
|
|
||||||
/=demo=/pub/octo/src/main/css
|
|
||||||
urbit/$X/$X/in/$DEMO/pub/octo/src/main.css
|
|
||||||
$DEMO/files/pub-octo-main.css
|
|
||||||
|
|
||||||
The JS:
|
|
||||||
|
|
||||||
/=demo=/pub/octo/src/main/js
|
|
||||||
urbit/$X/$X/in/$DEMO/pub/octo/src/main.js
|
|
||||||
$DEMO/files/pub-octo-main.js
|
|
||||||
|
|
||||||
[from tictactoe]
|
|
||||||
|
|
||||||
To move:
|
|
||||||
|
|
||||||
X/Y where X is row, Y is column.
|
|
||||||
|
|
||||||
To connect to a remote server (in versions 2 and 3),
|
|
||||||
specifying the side you will play:
|
|
||||||
|
|
||||||
~X x
|
|
||||||
~X o
|
|
||||||
|
|
||||||
To disconnect from a remote server (versions 2 and 3)
|
|
||||||
|
|
||||||
~ *** - not well tested
|
|
||||||
|
|
||||||
[scripts, to run from branch root directory]
|
|
||||||
|
|
||||||
$DEMO/install1.sh - copy in all version 1 (centralized) files
|
|
||||||
$DEMO/install2.sh - copy in all version 2 (distributed) files
|
|
||||||
$DEMO/install3.sh - copy in all version 3 (webby) files
|
|
||||||
|
|
@ -1,123 +0,0 @@
|
|||||||
:: :: ::
|
|
||||||
:::: /hook/core/acto/ape :: :: dependencies
|
|
||||||
:: :: ::
|
|
||||||
/- *sole :: structure
|
|
||||||
/+ sole :: library
|
|
||||||
:: :: ::
|
|
||||||
:::: :: :: structures
|
|
||||||
!: :: ::
|
|
||||||
=> |% :: board logic
|
|
||||||
++ board ,@ :: one-player bitfield
|
|
||||||
++ point ,[x=@ y=@] :: coordinate
|
|
||||||
++ game ,[who=? box=board boo=board] :: game state
|
|
||||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
|
||||||
++ bo :: per board
|
|
||||||
|_ bud=board ::
|
|
||||||
++ get |=(point =(1 (cut 0 [(off +<) 1] bud))) :: 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
|
|
||||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) ::
|
|
||||||
-- ::
|
|
||||||
:: :: ::
|
|
||||||
:::: :: :: semantics
|
|
||||||
:: :: ::
|
|
||||||
++ go :: per game
|
|
||||||
|_ game ::
|
|
||||||
++ at |_ point :: per point
|
|
||||||
++ g +>+< :: game
|
|
||||||
++ k !|(x o) :: ok move
|
|
||||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
|
||||||
++ o (~(get bo boo) +<) :: old 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) +<)) :: play at x
|
|
||||||
-- ::
|
|
||||||
++ res ?: ~(win bo box) `"{~[(icon &)]} wins" :: result
|
|
||||||
?: ~(win bo boo) `"{~[(icon |)]} wins" ::
|
|
||||||
?: =(511 (con boo box)) `"tie :-(" ~ ::
|
|
||||||
++ row |= y=@ :~ (add y '1') :: print row
|
|
||||||
' ' ~(v at y 0) ::
|
|
||||||
' ' ~(v at y 1) ::
|
|
||||||
' ' ~(v at y 2) ::
|
|
||||||
== ::
|
|
||||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
|
||||||
-- ::
|
|
||||||
-- ::
|
|
||||||
:: :: ::
|
|
||||||
:::: :: :: server
|
|
||||||
:: :: ::
|
|
||||||
=> |% :: arvo structures
|
|
||||||
++ axle ,[%0 eye=face gam=game] :: agent state
|
|
||||||
++ card ,[%diff lime] :: update
|
|
||||||
++ face (pair (list ,@c) (map bone sole-share)) :: interface
|
|
||||||
++ lime ,[%sole-effect sole-effect] :: console update
|
|
||||||
++ move (pair bone card) :: cause and action
|
|
||||||
-- ::
|
|
||||||
=> |% :: parsers
|
|
||||||
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
|
|
||||||
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
|
|
||||||
-- ::
|
|
||||||
|_ [hid=hide moz=(list move) axle] :: per agent
|
|
||||||
++ et ::
|
|
||||||
|_ [from say=sole-share] :: per console
|
|
||||||
++ abet +>(q.eye (~(put by q.eye) ost say)) :: continue
|
|
||||||
++ amok +>(q.eye (~(del by q.eye) ost)) :: discontinue
|
|
||||||
++ beep (emit %bel ~) :: bad user
|
|
||||||
++ 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 +<) come)) :: valid input
|
|
||||||
++ kick |= point :: move command
|
|
||||||
=^ dud gam ~(m ~(at go gam) +<) ::
|
|
||||||
?. dud abet:beep =+ mus=~(res go gam) ::
|
|
||||||
(park:abet(gam ?^(mus *game gam)) %2 mus) ::
|
|
||||||
++ line =^ cal say (transmit:sole set/p.eye) :: update command
|
|
||||||
(emit %det cal) ::
|
|
||||||
++ make =+ dur=(rust (tufa p.eye) come) ::
|
|
||||||
?~ dur abet:beep ::
|
|
||||||
(kick:line(p.eye ~) +.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 %& :- %tictactoe :: update prompt
|
|
||||||
": {~[(icon who.gam)]} to move (row/col): " ::
|
|
||||||
++ rend (turn `wall`~(tab go gam) |=(tape txt/+<)) :: table print
|
|
||||||
++ show (emit %mor rend) :: update board
|
|
||||||
++ sole ~(. cs say) :: console library
|
|
||||||
++ work |= act=sole-action :: console input
|
|
||||||
?:(?=(%det -.act) (delt +.act) make) ::
|
|
||||||
-- ::
|
|
||||||
++ abet [(flop moz) .(moz ~)] :: resolve core
|
|
||||||
++ flet |=(from ~(. et +< (~(got by q.eye) ost))) :: in old client
|
|
||||||
++ fret |=(from ~(. et +< *sole-share)) :: in new client
|
|
||||||
++ 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)] :: general update
|
|
||||||
=+ pals |- ^+ +>.^$ ?~ +< +>.^$ ::
|
|
||||||
$(+< t.+<, +>.^$ (~(plow et i.+<) lev mus)) ::
|
|
||||||
:: :: ::
|
|
||||||
:::: :: :: events
|
|
||||||
:: :: ::
|
|
||||||
++ peer-sole :: console subscribe
|
|
||||||
|= [from *] =< abet ::
|
|
||||||
(plow:(fret +<-) %2 ~) ::
|
|
||||||
++ poke-sole-action :: console input
|
|
||||||
|= [from act=sole-action] =< abet ::
|
|
||||||
(work:(flet +<-) act) ::
|
|
||||||
++ prep |= [from old=(unit ,[(list move) axle])] :: initialize
|
|
||||||
=< abet ?~ old +> =< (park %2 ~) ::
|
|
||||||
+>(+<+ u.old) ::
|
|
||||||
++ pull-sole :: disconnect console
|
|
||||||
|= [from *] =< abet ::
|
|
||||||
amok:(flet +<-) ::
|
|
||||||
--
|
|
@ -1,174 +0,0 @@
|
|||||||
:: :: ::
|
|
||||||
:::: /hook/core/acto/ape :: :: dependencies
|
|
||||||
:: :: ::
|
|
||||||
/- *sole :: structures
|
|
||||||
/+ sole :: libraries
|
|
||||||
:: :: ::
|
|
||||||
:::: :: :: structures
|
|
||||||
!: :: ::
|
|
||||||
=> |% :: board logic
|
|
||||||
++ board ,@ :: one-player bitfield
|
|
||||||
++ point ,[x=@ y=@] :: coordinate
|
|
||||||
++ game ,[who=? box=board boo=board] :: game state
|
|
||||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
|
||||||
++ bo :: per board
|
|
||||||
|_ bud=board ::
|
|
||||||
++ get |=(point =(1 (cut 0 [(off +<) 1] bud))) :: 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
|
|
||||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
|
||||||
-- ::
|
|
||||||
++ go :: per game
|
|
||||||
|_ game ::
|
|
||||||
++ at |_ point :: per point
|
|
||||||
++ g +>+< :: game
|
|
||||||
++ k !|(x o) :: ok move
|
|
||||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
|
||||||
++ o (~(get bo boo) +<) :: old 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) +<)) :: play at x
|
|
||||||
-- ::
|
|
||||||
++ res ?: ~(win bo box) `"{~[(icon &)]} wins" :: result
|
|
||||||
?: ~(win bo boo) `"{~[(icon |)]} wins" ::
|
|
||||||
?: =(511 (con boo box)) `"tie :-(" ~ ::
|
|
||||||
++ row |= y=@ :~ (add y '1') :: print row
|
|
||||||
' ' ~(v at y 0) ::
|
|
||||||
' ' ~(v at y 1) ::
|
|
||||||
' ' ~(v at y 2) ::
|
|
||||||
== ::
|
|
||||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
|
||||||
-- ::
|
|
||||||
-- ::
|
|
||||||
:: :: ::
|
|
||||||
:::: :: :: server
|
|
||||||
:: :: ::
|
|
||||||
=> |% :: arvo structures
|
|
||||||
++ axle ,[%1 eye=face but=tube gam=game] :: agent state
|
|
||||||
++ axon $?(axle [%0 eye=face gam=game]) :: historical state
|
|
||||||
++ card $% [%diff lime] :: update
|
|
||||||
[%quit ~] :: cancel
|
|
||||||
[%peer wire dock path] :: subscribe
|
|
||||||
[%pull wire dock ~]
|
|
||||||
== ::
|
|
||||||
++ face (pair (list ,@c) (map bone sole-share)) :: interface
|
|
||||||
++ lime $% [%sole-effect sole-effect] :: :sole update
|
|
||||||
[%octo-game game] :: :octo update
|
|
||||||
== ::
|
|
||||||
++ move (pair bone card) :: cause and action
|
|
||||||
++ mote (pair ship ,?) :: remote binding
|
|
||||||
++ tube (unit (pair ,? mote)) :: alive, remote
|
|
||||||
-- ::
|
|
||||||
=> |% :: 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 comp))) :: all command input
|
|
||||||
++ comp ;~(plug fed:ag ;~(pfix ace (flag %x %o))) :: login command
|
|
||||||
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
|
|
||||||
-- ::
|
|
||||||
|_ [hid=hide moz=(list move) 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
|
|
||||||
++ 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
|
|
||||||
++ kick |= point :: move command
|
|
||||||
=^ dud gam ~(m ~(at go gam) +<) ::
|
|
||||||
?. dud abet:beep =+ mus=~(res go gam) ::
|
|
||||||
(park:abet(gam ?^(mus *game gam)) %2 mus) ::
|
|
||||||
++ line =^ cal say (transmit:sole set/p.eye) :: update command
|
|
||||||
(emit %det cal) ::
|
|
||||||
++ make =+ dur=(rust (tufa p.eye) comb) ::
|
|
||||||
?~ dur abet:beep ::
|
|
||||||
=. + 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 mote) :: peer command
|
|
||||||
?~ mut ?~(but abet:beep stop:abet) ::
|
|
||||||
?^(but abet:beep (link:abet u.mut)) ::
|
|
||||||
++ rend (turn `wall`~(tab go gam) |=(tape txt/+<)) :: table print
|
|
||||||
++ show (emit %mor rend) :: update board
|
|
||||||
++ sole ~(. cs say) :: console library
|
|
||||||
++ wait &(?=(^ but) !=(q.q.u.but who.gam)) :: waiting turn
|
|
||||||
++ work |= act=sole-action :: console input
|
|
||||||
?:(?=(%det -.act) (delt +.act) make) ::
|
|
||||||
-- ::
|
|
||||||
++ abet [(flop moz) .(moz ~)] :: resolve core
|
|
||||||
++ dump |=(mov=move %_(+> moz [mov moz])) :: send move
|
|
||||||
++ 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 %tictactoe] +<])) :: to friend
|
|
||||||
++ link |= mot=mote %+ dish(but `[| mot]) %peer :: subscribe to friend
|
|
||||||
((like p.mot) /octo/net/[?:(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
|
|
||||||
=. +> ?:(=(%2 lev) push +>) ::
|
|
||||||
=+ pals ::
|
|
||||||
|- ^+ +>.^$ ?~ +< +>.^$ ::
|
|
||||||
$(+< 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
|
|
||||||
:: :::::::::::::::
|
|
||||||
:::: :: :: :: hooks
|
|
||||||
:: :::::::::::::::
|
|
||||||
++ 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 pax=path] =< abet ::
|
|
||||||
=+ who==(%x -.pax) ::
|
|
||||||
?^ but (park %2 ~) ::
|
|
||||||
(park:(link src !who) %2 `"net from {<src>}") ::
|
|
||||||
++ peer-sole :: console subscribe
|
|
||||||
|= [from pax=path] =< abet ::
|
|
||||||
(plow:(fret +<-) %2 ~) ::
|
|
||||||
++ poke-sole-action :: console input
|
|
||||||
|= [from act=sole-action] =< abet ::
|
|
||||||
(work:(flet +<-) act) ::
|
|
||||||
++ prep |= [from old=(unit ,[(list move) axon])] :: initialize
|
|
||||||
=< abet ?~ old +> ::
|
|
||||||
=< (park %2 ~) ::
|
|
||||||
?- -.+>.old ::
|
|
||||||
%1 +>(+<+ u.old) ::
|
|
||||||
%0 +>(eye.+< eye.+>.old, gam.+< gam.+>.old)::
|
|
||||||
== ::
|
|
||||||
++ pull-octo ::
|
|
||||||
|= [from *] =< abet ::
|
|
||||||
(park(but ~) %2 `"dropped") ::
|
|
||||||
++ pull-sole :: disconnect console
|
|
||||||
|= [from *] =< abet ::
|
|
||||||
amok:(flet +<-) ::
|
|
||||||
++ quit-octo :: unlinked by friend
|
|
||||||
|=([then ~] abet:(park(but ~) %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>}") ::
|
|
||||||
--
|
|
@ -1,185 +0,0 @@
|
|||||||
:: :: ::
|
|
||||||
:::: /hook/core/acto/ape :: :: dependencies
|
|
||||||
:: :: ::
|
|
||||||
/- *sole :: structures
|
|
||||||
/+ sole :: libraries
|
|
||||||
:: :: ::
|
|
||||||
:::: :: :: structures
|
|
||||||
!: :: ::
|
|
||||||
=> |% :: board logic
|
|
||||||
++ board ,@ :: one-player bitfield
|
|
||||||
++ point ,[x=@ y=@] :: coordinate
|
|
||||||
++ game ,[who=? box=board boo=board] :: game state
|
|
||||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
|
||||||
++ bo :: per board
|
|
||||||
|_ bud=board ::
|
|
||||||
++ get |=(point =(1 (cut 0 [(off +<) 1] bud))) :: 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
|
|
||||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
|
||||||
-- ::
|
|
||||||
++ go :: per game
|
|
||||||
|_ game ::
|
|
||||||
++ at |_ point :: per point
|
|
||||||
++ g +>+< :: game
|
|
||||||
++ k !|(x o) :: ok move
|
|
||||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
|
||||||
++ o (~(get bo boo) +<) :: old 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) +<)) :: play at x
|
|
||||||
-- ::
|
|
||||||
++ res ?: ~(win bo box) `"{~[(icon &)]} wins" :: result
|
|
||||||
?: ~(win bo boo) `"{~[(icon |)]} wins" ::
|
|
||||||
?: =(511 (con boo box)) `"tie :-(" ~ ::
|
|
||||||
++ row |= y=@ :~ (add y '1') :: print row
|
|
||||||
' ' ~(v at y 0) ::
|
|
||||||
' ' ~(v at y 1) ::
|
|
||||||
' ' ~(v at y 2) ::
|
|
||||||
== ::
|
|
||||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
|
||||||
-- ::
|
|
||||||
-- ::
|
|
||||||
:: :: ::
|
|
||||||
:::: :: :: server
|
|
||||||
:: :: ::
|
|
||||||
=> |% :: arvo structures
|
|
||||||
++ axle ,[%1 eye=face but=tube gam=game] :: agent state
|
|
||||||
++ axon $?(axle [%0 eye=face gam=game]) :: historical state
|
|
||||||
++ card $% [%diff lime] :: update
|
|
||||||
[%quit ~] :: cancel
|
|
||||||
[%peer wire dock path] :: subscribe
|
|
||||||
[%pull wire dock ~]
|
|
||||||
== ::
|
|
||||||
++ face (pair (list ,@c) (map bone sole-share)) :: interface
|
|
||||||
++ lime $% [%sole-effect sole-effect] :: :sole update
|
|
||||||
[%octo-game game] :: :octo update
|
|
||||||
== ::
|
|
||||||
++ move (pair bone card) :: cause and action
|
|
||||||
++ mote (pair ship ,?) :: remote binding
|
|
||||||
++ tube (unit (pair ,? mote)) :: alive, remote
|
|
||||||
-- ::
|
|
||||||
=> |% :: 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 comp))) :: all command input
|
|
||||||
++ comp ;~(plug fed:ag ;~(pfix ace (flag %x %o))) :: login command
|
|
||||||
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
|
|
||||||
-- ::
|
|
||||||
|_ [hid=hide moz=(list move) 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
|
|
||||||
++ 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
|
|
||||||
++ kick |= point :: move command
|
|
||||||
=^ dud gam ~(m ~(at go gam) +<) ::
|
|
||||||
?. dud abet:beep =+ mus=~(res go gam) ::
|
|
||||||
(park:abet(gam ?^(mus *game gam)) %2 mus) ::
|
|
||||||
++ line =^ cal say (transmit:sole set/p.eye) :: update command
|
|
||||||
(emit %det cal) ::
|
|
||||||
++ make =+ dur=(rust (tufa p.eye) comb) ::
|
|
||||||
?~ dur abet:beep ::
|
|
||||||
=. + 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 mote) :: peer command
|
|
||||||
?~ mut ?~(but abet:beep stop:abet) ::
|
|
||||||
?^(but abet:beep (link:abet u.mut)) ::
|
|
||||||
++ rend (turn `wall`~(tab go gam) |=(tape txt/+<)) :: table print
|
|
||||||
++ show (emit %mor rend) :: update board
|
|
||||||
++ sole ~(. cs say) :: console library
|
|
||||||
++ wait &(?=(^ but) !=(q.q.u.but who.gam)) :: waiting turn
|
|
||||||
++ work |= act=sole-action :: console input
|
|
||||||
?:(?=(%det -.act) (delt +.act) make) ::
|
|
||||||
-- ::
|
|
||||||
++ abet [(flop moz) .(moz ~)] :: resolve core
|
|
||||||
++ dump |=(mov=move %_(+> moz [mov moz])) :: send move
|
|
||||||
++ 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 %tictactoe] +<])) :: to friend
|
|
||||||
++ link |= mot=mote %+ dish(but `[| mot]) %peer :: subscribe to friend
|
|
||||||
((like p.mot) /octo/net/[?:(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
|
|
||||||
=. +> ?:(=(%2 lev) push +>) ::
|
|
||||||
=+ pals ::
|
|
||||||
|- ^+ +>.^$ ?~ +< +>.^$ ::
|
|
||||||
$(+< 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
|
|
||||||
:: :::::::::::::::
|
|
||||||
:::: :: :: :: hooks
|
|
||||||
:: :::::::::::::::
|
|
||||||
++ 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 pax=path] =< abet ::
|
|
||||||
=+ who==(%x -.pax) ::
|
|
||||||
?^ but (park %2 ~) ::
|
|
||||||
(park:(link src !who) %2 `"net from {<src>}") ::
|
|
||||||
++ peer-octo-web :: web peer
|
|
||||||
|= [from pax=path] =< abet ::
|
|
||||||
~& [%peer-web +<] ::
|
|
||||||
?^ but (park %2 ~) ::
|
|
||||||
%+ park(but `[%& src !who.gam]) %2 ::
|
|
||||||
`"web from {<src>}" ::
|
|
||||||
++ peer-sole :: console subscribe
|
|
||||||
|= [from pax=path] =< abet ::
|
|
||||||
(plow:(fret +<-) %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 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 ~) ::
|
|
||||||
?- -.+>.old ::
|
|
||||||
%1 +>(+<+ u.old) ::
|
|
||||||
%0 +>(eye.+< eye.+>.old, gam.+< gam.+>.old)::
|
|
||||||
== ::
|
|
||||||
++ pull-octo ::
|
|
||||||
|= [from *] =< abet ::
|
|
||||||
(park(but ~) %2 `"dropped") ::
|
|
||||||
++ pull-sole :: disconnect console
|
|
||||||
|= [from *] =< abet ::
|
|
||||||
amok:(flet +<-) ::
|
|
||||||
++ quit-octo :: unlinked by friend
|
|
||||||
|=([then ~] abet:(park(but ~) %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>}") ::
|
|
||||||
--
|
|
@ -1,26 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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) ~)
|
|
||||||
--
|
|
||||||
--
|
|
@ -1,16 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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
|
|
||||||
--
|
|
||||||
--
|
|
@ -1,32 +0,0 @@
|
|||||||
::
|
|
||||||
::
|
|
||||||
:::: /hook/hymn/fab/octo/pub/
|
|
||||||
::
|
|
||||||
^- manx
|
|
||||||
;html
|
|
||||||
;head
|
|
||||||
;meta(charset "utf-8");
|
|
||||||
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js");
|
|
||||||
;script(type "text/javascript", src "/~/at/base/lib/urb.js");
|
|
||||||
;link(type "text/css", rel "stylesheet", href "/home/lib/base.css");
|
|
||||||
;link(type "text/css", rel "stylesheet", href "/home/pub/octo/src/main.css");
|
|
||||||
;title: :octo
|
|
||||||
==
|
|
||||||
;body
|
|
||||||
;div#what
|
|
||||||
;div#ship
|
|
||||||
;div.sig: ~
|
|
||||||
;div.ship;
|
|
||||||
;div.as;
|
|
||||||
==
|
|
||||||
;div#vs: vs
|
|
||||||
;div#user
|
|
||||||
;div.sig: ~
|
|
||||||
;div.ship;
|
|
||||||
;div.as;
|
|
||||||
==
|
|
||||||
==
|
|
||||||
;div#bord;
|
|
||||||
;script(type "text/javascript", src "/home/pub/octo/src/main.js");
|
|
||||||
==
|
|
||||||
==
|
|
@ -1,102 +0,0 @@
|
|||||||
#what,
|
|
||||||
#bord {
|
|
||||||
width: 600px;
|
|
||||||
text-align: center;
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
margin-left: -300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#what {
|
|
||||||
height: 36px;
|
|
||||||
top: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bord {
|
|
||||||
height: 600px;
|
|
||||||
position: absolute;
|
|
||||||
top: 111px;
|
|
||||||
opacity: .6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.turn #bord {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#what {
|
|
||||||
font-family: "bau";
|
|
||||||
}
|
|
||||||
|
|
||||||
#what div {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#what .ship {
|
|
||||||
font-weight: 400;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
.turn #what #ship,
|
|
||||||
#what #user {
|
|
||||||
border: 2px solid #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
#what #ship,
|
|
||||||
.turn #what #user {
|
|
||||||
border: 2px solid red;
|
|
||||||
}
|
|
||||||
|
|
||||||
#what #ship,
|
|
||||||
#what #user {
|
|
||||||
padding: .6rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
#what .as {
|
|
||||||
width: 1.6rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
#vs {
|
|
||||||
margin: 0 1rem;
|
|
||||||
padding: .3rem;
|
|
||||||
color: #fff;
|
|
||||||
background-color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spac {
|
|
||||||
font-size: 100px;
|
|
||||||
line-height: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spac {
|
|
||||||
width: 198px;
|
|
||||||
height: 198px;
|
|
||||||
border: 1px solid #000;
|
|
||||||
text-align: center;
|
|
||||||
float: left;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spac[data-index="0-0"],
|
|
||||||
.spac[data-index="1-0"],
|
|
||||||
.spac[data-index="2-0"] {
|
|
||||||
border-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spac[data-index="0-0"],
|
|
||||||
.spac[data-index="0-1"],
|
|
||||||
.spac[data-index="0-2"] {
|
|
||||||
border-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spac[data-index="2-0"],
|
|
||||||
.spac[data-index="2-1"],
|
|
||||||
.spac[data-index="2-2"] {
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spac[data-index="0-2"],
|
|
||||||
.spac[data-index="1-2"],
|
|
||||||
.spac[data-index="2-2"] {
|
|
||||||
border-right: 0;
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
$(function() {
|
|
||||||
$bord = $('#bord')
|
|
||||||
$whom = $('#whom')
|
|
||||||
|
|
||||||
lett = ["x","o"]
|
|
||||||
symb = [" ","✕","◯"]
|
|
||||||
draw = function(state) {
|
|
||||||
space = function(_state,y,x) {
|
|
||||||
return "<div class='spac' data-index='"+y+"-"+x+
|
|
||||||
"'>"+symb[_state]+"</div>"
|
|
||||||
}
|
|
||||||
s = ""
|
|
||||||
x = 0
|
|
||||||
y = 0
|
|
||||||
for(i=0;i<9;i++) {
|
|
||||||
j = [0,3,6,1,4,7,2,5,8][i] // XX math
|
|
||||||
s += space((state.box[j] ? 1 : 0)+(state.boo[j] ? 2 : 0),y,x)
|
|
||||||
x++
|
|
||||||
if((i+1)%3 == 0) {
|
|
||||||
y++
|
|
||||||
x=0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$bord.html(s)
|
|
||||||
turn(state.who)
|
|
||||||
}
|
|
||||||
|
|
||||||
which = null
|
|
||||||
turn = function(who) {
|
|
||||||
$('body').toggleClass('turn',(who == which))
|
|
||||||
}
|
|
||||||
|
|
||||||
assign = function(who) {
|
|
||||||
which = who
|
|
||||||
turn(who)
|
|
||||||
$('#ship .as').text(symb[Number(!lett.indexOf(who))+1])
|
|
||||||
$('#user .as').text(symb[lett.indexOf(who)+1])
|
|
||||||
}
|
|
||||||
|
|
||||||
urb.appl = 'tictactoe'
|
|
||||||
urb.bind('/octo/web', function(err,res) {
|
|
||||||
if(which == null) { assign(res.data.who) }
|
|
||||||
draw(res.data)
|
|
||||||
})
|
|
||||||
|
|
||||||
// draw({
|
|
||||||
// box:[false,false,false,false,false,false,false,false,false],
|
|
||||||
// boo:[false,false,false,false,false,false,false,false,false]
|
|
||||||
// })
|
|
||||||
|
|
||||||
$bord.on('click', function(e) {
|
|
||||||
if(!$('body').hasClass('turn')) { return false }
|
|
||||||
$t = $(e.target).closest('.spac')
|
|
||||||
data = $.map(
|
|
||||||
$t.attr('data-index').split('-'),
|
|
||||||
function(i) { return Number(i); })
|
|
||||||
urb.send({mark:'octo-move',data:data})
|
|
||||||
})
|
|
||||||
|
|
||||||
$('#ship .ship').text(window.urb.ship)
|
|
||||||
$('#user .ship').text(window.urb.user)
|
|
||||||
})
|
|
@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
X=$1
|
|
||||||
DEMO=demo
|
|
||||||
COLD=$DEMO/files
|
|
||||||
DESK=test/$X/$X/in/base
|
|
||||||
|
|
||||||
echo "cp -f $COLD/1-ape-tictactoe.hoon $DESK/ape/tictactoe/core.hook"
|
|
||||||
mkdir -p $DESK/ape/tictactoe
|
|
||||||
cp -f $COLD/1-ape-tictactoe.hoon $DESK/ape/tictactoe/core.hook
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
X=$1
|
|
||||||
DEMO=demo
|
|
||||||
COLD=$DEMO/files
|
|
||||||
DESK=test/$X/$X/in/base
|
|
||||||
|
|
||||||
echo "cp -f $COLD/2-ape-tictactoe.hoon $DESK/ape/tictactoe/core.hook"
|
|
||||||
mkdir -p $DESK/ape/tictactoe
|
|
||||||
cp -f $COLD/1-ape-tictactoe.hoon $DESK/ape/tictactoe/core.hook
|
|
||||||
|
|
||||||
echo "cp -f $COLD/mar-octo-game.hoon $DESK/mar/octo-game/door.hook"
|
|
||||||
mkdir -p $DESK/mar/octo-game
|
|
||||||
cp -f $COLD/mar-octo-game.hoon $DESK/mar/octo-game/door.hook
|
|
@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
X=$1
|
|
||||||
DEMO=demo
|
|
||||||
COLD=$DEMO/files
|
|
||||||
DESK=test/$X/$X/in/base
|
|
||||||
|
|
||||||
echo "cp -f $COLD/3-ape-tictactoe.hoon $DESK/ape/tictactoe/core.hook"
|
|
||||||
mkdir -p $DESK/ape/tictactoe
|
|
||||||
cp -f $COLD/3-ape-tictactoe.hoon $DESK/ape/tictactoe/core.hook
|
|
||||||
|
|
||||||
echo "cp -f $COLD/mar-octo-game.hoon $DESK/mar/octo-game/door.hook"
|
|
||||||
mkdir -p $DESK/mar/octo-game
|
|
||||||
cp -f $COLD/mar-octo-game.hoon $DESK/mar/octo-game/door.hook
|
|
||||||
|
|
||||||
echo "cp -f $COLD/pub-octo-hymn.hoon $DESK/pub/octo/fab/hymn.hook"
|
|
||||||
mkdir -p $DESK/pub/octo/fab
|
|
||||||
cp -f $COLD/pub-octo-hymn.hoon $DESK/pub/octo/fab/hymn.hook
|
|
||||||
|
|
||||||
echo "cp -f $COLD/pub-octo-main.css $DESK/pub/octo/src/main.css"
|
|
||||||
mkdir -p $DESK/pub/octo/src
|
|
||||||
cp -f $COLD/pub-octo-main.css $DESK/pub/octo/src/main.css
|
|
||||||
|
|
||||||
echo "cp -f $COLD/pub-octo-main.js $DESK/pub/octo/src/main.js"
|
|
||||||
cp -f $COLD/pub-octo-main.js $DESK/pub/octo/src/main.js
|
|
@ -1,27 +0,0 @@
|
|||||||
script:
|
|
||||||
~tasfyn-partyv and ~talsur-todres decide to build a tic-tac-toe game
|
|
||||||
|
|
||||||
tasfyn-partyv: would you like to play a game of thermonuclear war?
|
|
||||||
|
|
||||||
talsur-todres: no. how about some tic-tac-toe?
|
|
||||||
|
|
||||||
tasfyn-partyv: sure. but wait, do we have a server?
|
|
||||||
|
|
||||||
talsur-todres:
|
|
||||||
features of the game:
|
|
||||||
(0) we build one-computer two-player TTT
|
|
||||||
(1) we build console tic-tac-toe
|
|
||||||
(2) we install it over the network
|
|
||||||
|
|
||||||
+ 1 2 3
|
|
||||||
1 X X
|
|
||||||
2 O O
|
|
||||||
3 X O X
|
|
||||||
|
|
||||||
? 1/3
|
|
||||||
|
|
||||||
(3) we update it to change the characters
|
|
||||||
|
|
||||||
(4) maybe cheating with some pretyped assets, we make a web view
|
|
||||||
|
|
||||||
(5)
|
|
@ -1,147 +0,0 @@
|
|||||||
A == ~tasfyn-partyv
|
|
||||||
B == ~talsur-todres
|
|
||||||
|
|
||||||
A and B, on unix terminals on different machines, clone and
|
|
||||||
build urbit from scratch, cutting over the build.
|
|
||||||
|
|
||||||
Each screen is divided into two logical columns. A's
|
|
||||||
screen is filled with two shells. B's screen has a shell
|
|
||||||
on the left and is empty on the right.
|
|
||||||
|
|
||||||
At the unix prompt, both run
|
|
||||||
|
|
||||||
urbit -c myship
|
|
||||||
|
|
||||||
type in an invisible ticket, and begin their ships. All
|
|
||||||
diagnostic messages are suppressed. Both users land
|
|
||||||
initially in :talk.
|
|
||||||
|
|
||||||
A: is this thing on?
|
|
||||||
|
|
||||||
B: who am i? why am i here?
|
|
||||||
|
|
||||||
A: would you like to play a game of global thermonuclear war?
|
|
||||||
|
|
||||||
B: wouldn't you prefer tic-tac-toe?
|
|
||||||
|
|
||||||
A: sure, but i'll have to write it. hang on...
|
|
||||||
|
|
||||||
A switches to :dojo and runs
|
|
||||||
|
|
||||||
:+merge %tic-tac-a ~tasfyn-partyv %home
|
|
||||||
|
|
||||||
In the other window, A runs vim and edits, occasionally
|
|
||||||
hitting :w to save the file:
|
|
||||||
|
|
||||||
demo/file1.txt -> A/in/base/ape/tictactoe/core.hook
|
|
||||||
|
|
||||||
After ++bo,
|
|
||||||
|
|
||||||
A: the board state is a bitfield
|
|
||||||
|
|
||||||
A: btw, you can watch me code at <URL>.
|
|
||||||
|
|
||||||
B opens a browser and points it at <URL>, showing the
|
|
||||||
tree with live update every time A saves.
|
|
||||||
|
|
||||||
After ++go:
|
|
||||||
|
|
||||||
A: game semantics are not that complex...
|
|
||||||
|
|
||||||
After ++move:
|
|
||||||
|
|
||||||
A: basic console io, kinda boilerplaty
|
|
||||||
|
|
||||||
After ++come:
|
|
||||||
|
|
||||||
A: if you can infer the type of the product
|
|
||||||
A: of a combinator parser, you are probably
|
|
||||||
A: a typed functional language even if you
|
|
||||||
A: leave category theory to the real math nerds...
|
|
||||||
|
|
||||||
After ++park:
|
|
||||||
|
|
||||||
A: a fairly vanilla console server. probably some
|
|
||||||
A: of this should be sucked out into a library -
|
|
||||||
A: you can never completely beat the boilerplate.
|
|
||||||
A: also note that this is a two-way console with
|
|
||||||
A: operational transformation that cancels syntax
|
|
||||||
A: errors as you type, just like how :talk violates
|
|
||||||
A: your human rights by lowercasing your capitals.
|
|
||||||
A: finally, while the style is perfectly readable
|
|
||||||
A: for a hoon programmer, we don't normally go in
|
|
||||||
A: for this kind of mildly contrived topiary.
|
|
||||||
|
|
||||||
After ++pull-sole:
|
|
||||||
|
|
||||||
A: those were the event hooks where arvo calls us,
|
|
||||||
A: expecting a new state and a list of actions.
|
|
||||||
A: anyway, this should work - let's try it.
|
|
||||||
A: do this:
|
|
||||||
|
|
||||||
:+sync %tic-tac-a ~tasfyn-partyv %tic-tac-a
|
|
||||||
:+start %tic-tac-a %tictactoe
|
|
||||||
|
|
||||||
B does this. it puts him straight into TTT.
|
|
||||||
|
|
||||||
A: now hang on, I'll join you.
|
|
||||||
|
|
||||||
A uses ^V to pop the hood and types +~B/
|
|
||||||
|
|
||||||
A: bear in mind, this is a very crude shared space.
|
|
||||||
A: your server is just exporting a console interface
|
|
||||||
A: which we both can access. so essentially i'm
|
|
||||||
A: ssh-ed into your game world.
|
|
||||||
|
|
||||||
They play a couple of moves.
|
|
||||||
|
|
||||||
A: it's important to note that your urbit is also
|
|
||||||
A: in a sense, a database. try this from unix:
|
|
||||||
|
|
||||||
killall -9 urbit
|
|
||||||
urbit myship
|
|
||||||
|
|
||||||
B does this, comes back and plays a move.
|
|
||||||
|
|
||||||
B: we don't seem to have lost any data.
|
|
||||||
A: we didn't even come close to losing data,
|
|
||||||
A: so let's come a little closer:
|
|
||||||
|
|
||||||
killall -9 vere
|
|
||||||
rm -rf $checkpoint
|
|
||||||
urbit myship
|
|
||||||
|
|
||||||
B does this, comes back and plays a move.
|
|
||||||
|
|
||||||
B: whoa, that was heavy.
|
|
||||||
A: yeah, your life flashed before your eyes. or at least,
|
|
||||||
A: your event history. this system of checkpoint
|
|
||||||
A: and transaction log is actually how normal dbs work,
|
|
||||||
A: though urbit is designed as a personal computer and
|
|
||||||
A: hardly up for a normal db workload.
|
|
||||||
|
|
||||||
B: it's a little odd that either of us could play X or O.
|
|
||||||
A: or even have an edit war in the command line.
|
|
||||||
|
|
||||||
They have an edit war in the command line.
|
|
||||||
|
|
||||||
B: it might be right for some things. not tictactoe.
|
|
||||||
A: then we'll have to change it! often when someone
|
|
||||||
A: installs your software, later you find out it's not
|
|
||||||
A: perfect and sometimes actually needs to be changed.
|
|
||||||
B: i've had that experience a number of times.
|
|
||||||
A: but it's always tricky to operate on a beating heart,
|
|
||||||
A: so let's try it in a small way first...
|
|
||||||
|
|
||||||
A edits the source file and changes X to Z, or
|
|
||||||
maybe to a Unicode symbol. When he saves, the
|
|
||||||
change propagates to both consoles and also the
|
|
||||||
tree view on B's screen, even to the prompt UI.
|
|
||||||
|
|
||||||
B: i've seen that sort of thing before.
|
|
||||||
A: really? in any case, let's do it for real. the next
|
|
||||||
A: version is a genuine distributed tictactoe with
|
|
||||||
A: its own peer-to-peer move protocol. surely this
|
|
||||||
A: is some fancy technology...
|
|
||||||
|
|
||||||
A edits the source file into
|
|
@ -1,162 +0,0 @@
|
|||||||
For dialogue: start with dialogue ad-libbed by whoever is
|
|
||||||
doing the production. Later, copy it into a script and
|
|
||||||
edit that script.
|
|
||||||
|
|
||||||
For operation details, see commands.txt. Fill in the script
|
|
||||||
with literal operations *only once you have tested them
|
|
||||||
yourself*.
|
|
||||||
|
|
||||||
A: build and boot A
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A: private-message B
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B: create demo desk
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B: vim in application version 1, just typing, very fast
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A: sync A's demo desk to B
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B: log in to A's tictactoe (intentionally reversed)
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A: start tictactoe on A
|
|
||||||
|
|
||||||
A/B: play ONE full game of tictactoe, moves interleaved with
|
|
||||||
these subdemos:
|
|
||||||
|
|
||||||
B changes X to Z in the source, then changes it back
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A or B enters an invalid move, beep sound is heard
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A kills and restarts the vere process:
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A kills the vere process, deletes the checkpoint, restarts:
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A or B enters an invalid move, beep sound is heard:
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A and B tussle humorously over weird shared command line
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B edits version 1 into version 2, automagically upgrading A
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B logs out of A's tictactoe
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B starts local tictactoe
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B connects local tictactoe to A's server
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B edits in version 3 ape, with web support
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A: watch editing of application
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B edits in mar, pub (very fast)
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A: logs in to game url
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A: brings up web talk
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B: creates a local channel to talk about TTT
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A: subscribes from the web UI to B's channel
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
C, D, and E: join the channel and give humorous advice
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A: loses the game
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
B: sends bitcoin payment to A
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
A: points browser at blockchain.info, shows real payment
|
|
||||||
|
|
||||||
...
|
|
||||||
""
|
|
||||||
|
|
||||||
close:
|
|
||||||
credit screen 1:
|
|
||||||
|
|
||||||
*everyone who has ever worked/for at Tlon, in alphabetical
|
|
||||||
order*,
|
|
||||||
|
|
||||||
credit screen 2:
|
|
||||||
|
|
||||||
*every non Tlon github uid that has contributed to our repository*
|
|
||||||
|
|
||||||
credit screen 3:
|
|
||||||
|
|
||||||
~, huge
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user