urbit/gen/moon.hoon

21 lines
472 B
Plaintext
Raw Normal View History

2016-10-22 02:44:39 +03:00
:: Generate random moon and corresponding ticket
2015-10-20 21:12:22 +03:00
::
2016-02-05 06:05:37 +03:00
:::: /hoon/moon/gen
2015-10-20 21:12:22 +03:00
::
/? 310
2015-10-20 21:12:22 +03:00
::
::::
2016-11-17 04:42:58 +03:00
::
2015-10-20 21:12:22 +03:00
:- %say
2016-08-11 21:15:06 +03:00
|= $: {now/@da eny/@uvJ bec/beak}
2016-02-17 07:34:06 +03:00
$~
$~
2015-10-20 21:12:22 +03:00
==
:- %tang :_ ~ :- %leaf
=+ ran=(clan p.bec)
?: ?=({?($earl $pawn)} ran)
"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}"
2015-10-20 21:12:22 +03:00
=+ mon=(mix (lsh 5 1 (end 5 1 eny)) p.bec)
=+ tic=.^(@ /a/(scot %p p.bec)/tick/(scot %da now)/(scot %p mon))
"moon: {<`@p`mon>}; ticket: {<`@p`tic>}"