shrub/main/app/begin/core.hook
2014-11-24 16:15:04 -05:00

445 lines
13 KiB
Plaintext

|%
++ sign
$% $: %g
$% [%init p=@p]
[%nice ~]
[%mean p=ares]
[%rush %txt p=cord]
== == ==
++ form ,[his=@p tic=@p eny=@t ges=gens]
++ state
$? %begin %his %tic %eny %lag
%name %form %psect %pname %year
%govt %sect %fname %mname %nname
%lname %done
==
++ tepe ,[(unit ,[cord prom cord]) (list cord)]
--
::
!:
|_ [hid=hide sat=state form]
++ done
|= ost=bone
:_ +>.$
:* :* ost %pass /to-gan %g %mess [our.hid /began] our.hid
%began-args !>([his tic eny ges])
==
(spam %rush %prompt "[waiting...]" %text '')
==
::
++ loon
%+ cook
|= all=(list ,@t)
|- ^- @t
?~ all %$
?~ t.all i.all
(cat 3 i.all (cat 3 ' ' $(all t.all)))
(most ace (cook |=(a=(list ,@) (rap 3 a)) (plus prn)))
::
++ next
|= txt=cord
^- [tepe _+>.$]
?- sat
%begin
:_ +>.$(sat %his)
:- `['Your ship: ~' %text '']
%- lore %- crip
"""
Do you have a ship and a ticket? If not, please ask
urbit@urbit.org for one.
"""
%his
=+ a=(rush txt fed:ag)
?~ a [[~ 'invalid input' ~] +>.$]
=> .(-.q.ges (clan u.a))
=+ ^= cow
|- ^- @ud
?- -.q.ges
%czar 256
%king (mul 255 $(-.q.ges %czar))
%duke (mul 65.535 $(-.q.ges %king))
%earl (mul (dec (bex 32)) $(-.q.ges %duke))
%pawn (sub (bex 128) $(-.q.ges %earl))
==
=+ ^= ves ^- tape
?- -.q.ges
%czar "carriers"
%king "cruisers"
%duke "destroyers"
%earl "yachts"
%pawn "submarines"
==
:_ ^+ +>.$ +>.$(his u.a, sat %tic)
:- `['Your ticket: ~' %text '']
%- lore %- crip
"""
Launching {(scow %p u.a)}, one of {<cow>} Urbit {ves}...
If I did not build for myself
for whom should I build?
-- Bunting, _Chomei at Toyama_
Let's configure your identity. Warning - it's nontrivial to
change this data once you've sent it to the server. If you enter
something wrong, hit ^D to cancel, then run the program again.
"""
::
%tic
=+ a=(rush txt fed:ag)
?~ a [[~ 'invalid input' ~] +>.$]
:_ +>.$(tic u.a, sat %eny)
:- `['Entropy: ' %pass '']
%- lore %- crip
"""
Enter a passphrase or other unusual text. You (or your enemies)
can regenerate your ship from this entropy.
"""
::
%eny
=+ a=(rush txt (boss 256 (more gon qit)))
?~ a [[~ 'invalid input' ~] +>.$]
=. u.a (shax u.a)
:_ +>.$(eny u.a, sat %lag)
:- `['Language: ' %text 'en']
%- lore %- crip
"""
Entropy check: {<`@p`(mug u.a)>}
What language would your ship rather speak? Enter it as a
two-letter (ISO 639-1) code, like "en" for English. Whatever
language you pick, it'll all be English now, but in future
we'll be more sensitive to your needs.
"""
::
%lag
=+ ^= par
%+ sear
|= [a=@ b=@]
^- (unit ,@ta)
=+ c=(cat 3 a b)
=+(d=(glon c) ?~(d ~ [~ c]))
;~(plug low low)
=+ a=(rush txt par)
?~ a [[~ 'invalid input' ~] +>.$]
?. ?=(%duke -.q.ges)
:_ +>.$(p.ges u.a, sat %name)
[`['Name: ' %text ''] ~]
:_ +>.$(p.ges u.a, sat %form)
:- `['Form: %' %text 'lady']
%- lore %- crip
"""
Please select one of the pre-chosen forms:
%lady female-identified individual
%lord male-identified individual
%punk opaque handle
%anon totally anonymous
"""
::
%name
?> ?=(?(%earl %king) -.q.ges)
=+ a=(rush txt (boss 256 (more gon qit)))
?~ a [[~ 'invalid input' ~] +>.$]
=+ gos=?-(-.q.ges %earl [%earl u.a], %king [%king u.a])
:_ +>.$(q.ges gos, sat %done)
[`['' %text ''] ~]
::
%form
=+ ^= par
;~ pose
(jest %anon)
(jest %lady)
(jest %lord)
(jest %punk)
==
=+ a=(rush txt par)
?~ a [[~ 'invalid input' ~] +>.$]
?+ u.a !!
%anon [[`['' %text ''] ~] +>.$(q.ges [%duke %anon ~], sat %done)]
%punk
:_ +>.$(q.ges [%duke %punk *sect ''], sat %pname)
[`['Handle: ' %text ''] ~]
?(%lady %lord)
=+ wat=?-(u.a %lady [%lady *whom], %lord [%lord *whom])
:_ +>.$(q.ges `gcos`[%duke wat], sat %year)
:- `['Year you were born: ' %text '19']
%- lore %- crip
"""
You've selected a personal identity. For a %lord or a %lady,
please use your real name only. If you'd prefer a fictitious
handle, you can hit ^D and start over as a %punk. Or you can
use %anon and go by your ship name alone.
As a real person, we're going to ask you for a little bit of
personal information - not enough to compromise your privacy,
just enough to make everyone on Urbit feel like a neighbor.
What we're going to ask you for is information that's (a)
public (would be obvious, or at least easy to guess, for
someone who met you in person); (b) durable (doesn't change
often); and (c) relevant (helps you connect with friends).
For example, we'll ask for the year (not day) you were born,
because your age is easy to guess in person, doesn't change,
and has a big effect on how people perceive you.
"""
==
::
%pname
=+ a=(rush txt loon)
?~ a [[~ 'invalid input' ~] +>.$]
:_ +>.$(q.ges [%duke %punk *sect u.a], sat %psect)
:- `['Banner: %' %text 'white']
%- lore %- crip
"""
One basic human instinct is the urge to form political tribes.
In a network that fights this need, these tribes form anyway and
they form badly. Urbit designs them into the infrastructure.
Inspired by the Qing Dynasty, you'll align yourself with one of
five colored "banners" - %red, %blue, %orange, %black or %white.
Political discourse across tribal boundaries is almost always an
antisocial act - less communication, than symbolic violence. In
Urbit, messages marked political stay within your own banner;
your friends in other banners simply won't see them. Between
banners, politics doesn't erode apolitical relationships; inside
each banner, political discourse is harmonious and productive.
Pick a banner by the adjective you feel best describes you:
%red far left: radical, anarchist
%blue center-left: moderate, liberal
%orange center-right: conservative, libertarian
%black far right: traditionalist, reactionary
Or if digital agitation isn't your cup of tea, choose %white, and
your Urbit experience will remain politics-free.
"""
::
%psect
?> ?=(%duke -.q.ges)
?> ?=(%punk -.p.q.ges)
=+ ^= par
;~ pose
(jest %white)
(jest %blue)
(jest %red)
(jest %black)
(jest %orange)
==
=+ a=(rush txt par)
?~ a [[~ 'invalid input' ~] +>.$]
:- [`['' %text ''] ~]
%= +>.$
q.ges [%duke %punk ((hard sect) u.a) q.p.q.ges]
sat %done
==
::
%year
?> ?=(%duke -.q.ges)
?> ?=(?(%lord %lady) -.p.q.ges)
=+ a=(rush txt dim:ag)
?~ a [[~ 'invalid input' ~] +>.$]
=+ woh=`whom`[u.a *govt *sect *name]
=+ wat=`what`?-(-.p.q.ges %lord [%lord woh], %lady [%lady woh])
:_ +>.$(q.ges [%duke wat], sat %govt)
:- `['Location ' %text 'us/94103']
%- lore %- crip
"""
Where are you? This is totally optional, but we'd like to
know your vague general location. You can enter nothing at
all, just a country code, or country and postal code.
"""
::
%govt
?> ?=(%duke -.q.ges)
?> ?=(?(%lord %lady) -.p.q.ges)
=+ ^= par
;~ pose
;~ plug (cook |=([a=@ b=@] (cat 3 a b)) ;~(plug low low))
;~ pfix fas
%+ cook
|=(a=tape (rap 3 ^-((list ,@) a)))
(star ;~(pose hig hep nud))
==
(easy ~)
==
==
=+ a=(rush txt par)
?~ a [[~ 'invalid input' ~] +>.$]
=+ woh=`whom`[p.p.p.q.ges u.a *sect *name]
=+ wat=`what`?-(-.p.q.ges %lord [%lord woh], %lady [%lady woh])
:_ +>.$(q.ges [%duke wat], sat %sect)
:- `['Banner: %' %text 'white']
%- lore %- crip
"""
One basic human instinct is the urge to form political tribes.
In a network that fights this need, these tribes form anyway and
they form badly. Urbit designs them into the infrastructure.
Inspired by the Qing Dynasty, you'll align yourself with one of
five colored "banners" - %red, %blue, %orange, %black or %white.
Political discourse across tribal boundaries is almost always an
antisocial act - less communication, than symbolic violence. In
Urbit, messages marked political stay within your own banner;
your friends in other banners simply won't see them. Between
banners, politics doesn't erode apolitical relationships; inside
each banner, political discourse is harmonious and productive.
Pick a banner by the adjective you feel best describes you:
%red far left: radical, anarchist
%blue center-left: moderate, liberal
%orange center-right: conservative, libertarian
%black far right: traditionalist, reactionary
Or if digital agitation isn't your cup of tea, choose %white, and
your Urbit experience will remain politics-free.
"""
::
%sect
?> ?=(%duke -.q.ges)
?> ?=(?(%lord %lady) -.p.q.ges)
=+ ^= par
;~ pose
(jest %white)
(jest %blue)
(jest %red)
(jest %black)
(jest %orange)
==
=+ a=(rush txt par)
?~ a [[~ 'invalid input' ~] +>.$]
=+ woh=`whom`[p.p.p.q.ges q.p.p.q.ges (sect u.a) *name]
=+ wat=`what`?-(-.p.q.ges %lord [%lord woh], %lady [%lady woh])
:_ +>.$(q.ges [%duke wat], sat %fname)
[`['First name: ' %text ''] ~]
::
%fname
?> ?=(%duke -.q.ges)
?> ?=(?(%lord %lady) -.p.q.ges)
=+ a=(rush txt loon)
?~ a [[~ 'invalid input' ~] +>.$]
=+ nam=[u.a *(unit ,@t) *(unit ,@t) *@t]
=+ woh=`whom`[p.p.p.q.ges q.p.p.q.ges r.p.p.q.ges nam]
=+ wat=`what`?-(-.p.q.ges %lord [%lord woh], %lady [%lady woh])
:_ +>.$(q.ges [%duke wat], sat %mname)
[`['Middle name (or blank): ' %text ''] ~]
::
%mname
?> ?=(%duke -.q.ges)
?> ?=(?(%lord %lady) -.p.q.ges)
=+ a=(rush txt ;~(pose (stag ~ loon) (easy ~)))
?~ a [[~ 'invalid input' ~] +>.$]
=+ nam=[p.s.p.p.q.ges u.a *(unit ,@t) *@t]
=+ woh=`whom`[p.p.p.q.ges q.p.p.q.ges r.p.p.q.ges nam]
=+ wat=`what`?-(-.p.q.ges %lord [%lord woh], %lady [%lady woh])
:_ +>.$(q.ges [%duke wat], sat %nname)
[`['Nickname/handle (or blank): ' %text ''] ~]
::
%nname
?> ?=(%duke -.q.ges)
?> ?=(?(%lord %lady) -.p.q.ges)
=+ a=(rush txt ;~(pose (stag ~ loon) (easy ~)))
?~ a [[~ 'invalid input' ~] +>.$]
=+ nam=[p.s.p.p.q.ges q.s.p.p.q.ges u.a *@t]
=+ woh=`whom`[p.p.p.q.ges q.p.p.q.ges r.p.p.q.ges nam]
=+ wat=`what`?-(-.p.q.ges %lord [%lord woh], %lady [%lady woh])
:_ +>.$(q.ges [%duke wat], sat %lname)
[`['Last name: ' %text ''] ~]
::
%lname
?> ?=(%duke -.q.ges)
?> ?=(?(%lord %lady) -.p.q.ges)
=+ a=(rush txt loon)
?~ a [[~ 'invalid input' ~] +>.$]
=+ nam=[p.s.p.p.q.ges q.s.p.p.q.ges r.s.p.p.q.ges u.a]
=+ woh=`whom`[p.p.p.q.ges q.p.p.q.ges r.p.p.q.ges nam]
=+ wat=`what`?-(-.p.q.ges %lord [%lord woh], %lady [%lady woh])
:_ +>.$(q.ges [%duke wat], sat %done)
[`['' %text ''] ~]
::
%done !! :: can't actually complete event because vere commits suicide
::[[`['[waiting...]' %text ''] ~] +>.$]
==
::
++ poke-begin-args
|= [ost=bone you=ship arg=?(~ [his=ship ~])]
=+ sot=?~(arg %begin %his)
=^ res +>.$
^- [[pot=(unit ,[cord prom cord]) tak=(list cord)] _+>.$]
?~ arg
(next(sat %begin) '')
(next(sat %his) (rsh 3 1 (scot %p his.arg)))
:_ +>.$
%+ welp
:~ [ost %pass /in %g %show [our.hid +.imp.hid] you /in/[-.imp.hid]]
[ost %give %nice ~]
==
%+ welp
?~(pot.res ~ (spam %rush %prompt u.pot.res))
%- zing
(turn (flop tak.res) |=(a=cord (spam %rush %txt a)))
::
++ pour
|= [ost=bone pax=path sih=*]
=+ sih=((hard sign) sih)
?: ?=(%init +<.sih)
[[ost %give +.sih]~ +>.$]
?: ?=([%in ~] pax)
?. ?=(%rush +<.sih) `+>.$
=^ res +>.$
^- [[pot=(unit ,[cord prom cord]) tak=(list cord)] _+>.$]
(next p.sih)
?: ?=(%done sat)
(done ost)
:_ +>.$
%+ welp
?~(pot.res ~ (spam %rush %prompt u.pot.res))
%- zing
(turn (flop tak.res) |=(a=cord (spam %rush %txt a)))
:_ +>.$
:- [ost %give +.sih]
?+ +<.sih ~
%nice
%+ turn (~(tap by sup.hid))
|= [ost=bone *]
:^ ost %give %rush
:- %tang :_ ~
[%leaf "begin successful"]
%mean
%+ turn (~(tap by sup.hid))
|= [ost=bone *]
:^ ost %give %rush
:- %tang :_ ~
[%leaf "begin failed"]
==
++ peer
|=
*
`+>
::
++ spam
|* git=*
%+ turn
(~(tap in (~(get ju pus.hid) /out)))
|=(a=bone [a %give git])
--