urbit/main/bin/begin.hoon

194 lines
4.9 KiB
Plaintext
Raw Normal View History

2013-09-29 00:21:18 +04:00
!:
:: /=main=/bin/begin/hoon
::
=> .(-< `who=@p`-<)
=> .(+ =>(+ ^/===/lib/pony))
|= [est=time *]
|= arg=$|(~ [p=@p ~])
=- ^- bowl
?^ arg (fud p.arg)
%+ pomp ""
2013-10-16 01:02:23 +04:00
%+ (polo %text "Do you have a ship and a ticket? " "yes" ~)
;~(pose (jest %yes) (jest %no))
2013-09-29 00:21:18 +04:00
|= [* ans=@t]
?. =(%yes ans)
:_ ~
:~ [%la %leaf "Please ask urbit@urbit.org for one."]
2013-09-29 00:21:18 +04:00
==
2013-10-16 01:02:23 +04:00
%+ (polo %text "Your ship: ~" ~ ~)
2013-09-29 00:21:18 +04:00
fed:ag
|= [* mig=@p]
^- bowl
(fud mig)
^= fud
|= mig=@p
2013-09-29 00:21:18 +04:00
=+ bos=(sein mig)
?> !=(bos mig)
=< main
|%
++ looc ;~(pose alp (shim 128 255))
++ loon
2013-09-29 00:21:18 +04:00
%+ 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 looc)))
::
++ main
^- bowl
=+ ran=(clan mig)
=+ ^= cow
|- ^- @ud
2013-09-29 00:21:18 +04:00
?- ran
%czar 256
%king (mul 255 $(ran %czar))
%duke (mul 65.535 $(ran %king))
%earl (mul (dec (bex 32)) $(ran %duke))
%pawn (sub (bex 128) $(ran %earl))
==
=+ ^= ves ^- tape
?- ran
%czar "carriers"
%king "cruisers"
%duke "destroyers"
%earl "yachts"
%pawn "submarines"
==
=+ gup=(scow %p mig)
%+ pomp ""
%+ pomp "Launching {gup}, one of {<cow>} Urbit {ves}..."
%+ pomp ""
%+ pomp " If I did not build for myself"
%+ pomp " for whom should I build?"
%+ pomp ""
%+ pomp " -- Bunting, _Chomei at Toyama_"
2013-10-16 01:02:23 +04:00
%+ pogo (pond ^:@/===doc%/warning/txt)
%+ (polo %text "Your ticket: ~" ~ ~)
2013-09-29 00:21:18 +04:00
fed:ag
|= [* tic=@p]
2013-10-16 01:02:23 +04:00
%+ pogo (pond ^:@/===doc%/entropy/txt)
%+ (polo %pass "Entropy: " ~ ~)
2013-09-29 00:21:18 +04:00
(boss 256 (more gon qit))
|= [* tey=@]
=. tey (shax tey)
%+ pomp "Entropy check: {<`@p`(mug tey)>}"
2013-10-16 01:02:23 +04:00
%+ pogo (pond ^:@/===doc%/language/txt)
%+ (polo %text "Language: " "en" ~)
2013-09-29 00:21:18 +04:00
%+ sear
|= [a=@ b=@]
^- (unit ,@ta)
=+ c=(cat 3 a b)
=+(d=(glon c) ?~(d ~ [~ c]))
;~(plug low low)
|= [* lag=lang]
%+ pomp ""
%+ pomp "Okay, we'll be speaking {(need (glon lag))}."
^- bowl
?. ?=(%duke ran)
2013-10-16 01:02:23 +04:00
%+ (polo %text "Name: " ~ ~)
2013-09-29 00:21:18 +04:00
(boss 256 (more gon qit))
|= [now=@da nam=@]
(moss now tic tey lag (gcos [ran nam]))
2013-10-16 01:02:23 +04:00
%+ pogo (pond ^:@/===doc%/identity/txt)
%+ (polo %text "Form: %" "lady" ~)
2013-09-29 00:21:18 +04:00
;~ pose
(jest %anon)
(jest %lady)
(jest %lord)
(jest %punk)
==
|= [now=@da fom=@t]
?+ fom !!
%anon (moss now tic tey lag [%duke %anon ~])
%punk
2013-10-16 01:02:23 +04:00
%+ (polo %text "Handle: " ~ ~)
2013-11-20 23:52:26 +04:00
loon
2013-09-29 00:21:18 +04:00
|= [now=@da puc=@t]
2013-11-08 04:34:44 +04:00
%+ pogo (pond ^:@/===doc%/banner/txt)
%+ (polo %text "Banner: %" "blue" ~)
;~ pose
(jest %white)
(jest %blue)
(jest %red)
2013-11-08 04:34:44 +04:00
(jest %black)
(jest %orange)
==
|= [now=@da ban=@t]
=> .(ban (?(%white %blue %red %black %orange) ban))
(moss now tic tey lag [%duke %punk ban puc])
2013-09-29 00:21:18 +04:00
::
?(%lord %lady)
2013-10-16 01:02:23 +04:00
%+ pogo (pond ^:@/===doc%/person/txt)
%+ (polo %text "Year you were born: " "19" ~)
2013-09-29 00:21:18 +04:00
dim:ag
|= [* yar=@]
%- moon
2013-09-29 00:21:18 +04:00
|= [* gov=govt]
2013-10-16 01:02:23 +04:00
%+ pogo (pond ^:@/===doc%/name/txt)
%+ (polo %text "First name: " ~ ~)
2013-09-29 00:21:18 +04:00
loon
|= [* fis=@t]
2013-10-16 01:02:23 +04:00
%+ (polo %text "Middle name (or blank): " ~ ~)
2013-09-29 00:21:18 +04:00
;~(pose (stag ~ loon) (easy ~))
|= [* mid=(unit ,@t)]
2013-10-16 01:02:23 +04:00
%+ (polo %text "Nickname/handle (or blank): " ~ ~)
2013-09-29 00:21:18 +04:00
;~(pose (stag ~ loon) (easy ~))
|= [* nik=(unit ,@t)]
2013-10-16 01:02:23 +04:00
%+ (polo %text "Last name: " ~ ~)
2013-09-29 00:21:18 +04:00
loon
|= [* las=@t]
2013-10-16 01:02:23 +04:00
%+ pogo (pond ^:@/===doc%/banner/txt)
%+ (polo %text "Banner: %" "blue" ~)
;~ pose
(jest %white)
(jest %blue)
(jest %red)
2013-09-29 00:21:18 +04:00
(jest %black)
(jest %orange)
==
|= [now=@da ban=@t]
=> .(ban (?(%white %blue %red %black %orange) ban))
=+ nam=`name`[fis mid nik las]
(moss now tic tey lag `gcos`[%duke %lord `whom`[yar gov ban nam]])
==
::
++ moon
|* woo=$+([@da govt] bowl)
2013-10-16 01:02:23 +04:00
%+ pogo (pond ^:@/===doc%/location/txt)
%+ (polo %text "Location: " "us/94114" ~)
2013-09-29 00:21:18 +04:00
;~ pose
;~ plug
(cook |=([a=@ b=@] (cat 3 a b)) ;~(plug low low))
;~ pose
;~(pfix fas (plus ;~(pose hig hep nud)))
(easy ~)
==
==
(easy ~)
==
woo
::
++ moss
|= [now=@da tic=@p tey=@ ges=gens]
^- bowl
=+ bur=(shax :(mix (jam ges) tey))
2013-10-16 01:02:23 +04:00
%+ pomp "generating 2048-bit RSA key..."
%- (posh (add ~s1 now))
2013-09-29 00:21:18 +04:00
|= now=@da
=+ loy=(brew 2.048 bur)
%- (post bos %ta [mig tic ges pub:ex:loy])
2013-09-29 00:21:18 +04:00
|= [now=@da rup=(unit ,*)]
:_ ~
?~ rup ~[la/leaf/"request rejected"]
=+ mac=`mace`[[0 sec:ex:loy] ~]
=+ wil=((hard (unit will)) u.rup)
?~ wil
:~ [%la %leaf "request rejected - invalid ticket"]
==
:~ [%la %leaf "request approved"]
[%xy /a `card`[%cash mig mac u.wil]]
==
--