mirror of
https://github.com/urbit/shrub.git
synced 2024-09-11 20:27:19 +03:00
accel: retool with codegen
This commit is contained in:
parent
792d3d35c1
commit
1a4f3c94e2
@ -1583,7 +1583,6 @@
|
||||
++ seize
|
||||
|= [par=pith:neo child=pith:neo car=?(%y %z)]
|
||||
^- ?
|
||||
=- ~&(seize/[par child -] -)
|
||||
?: =(%y car)
|
||||
=(`par (~(parent of:neo tide) child))
|
||||
!=(~ (dif:pith:neo par child))
|
||||
@ -1689,14 +1688,12 @@
|
||||
(ingest cards)
|
||||
::
|
||||
++ plunder
|
||||
~& plundering/~
|
||||
^+ arvo
|
||||
=/ by-parent=(jug pith:neo dust:neo)
|
||||
%+ roll grit
|
||||
|= [=dust:neo by-parent=(jug pith:neo dust:neo)]
|
||||
%- ~(gas ju by-parent)
|
||||
=/ adoptees (adopt pith.dust)
|
||||
~& adoptees/adoptees
|
||||
(turn ~(tap in (adopt pith.dust)) |=(=pith:neo [pith [(dif:pith:neo pith pith.dust) +.dust]]))
|
||||
:: XX: assert gifts empty
|
||||
=. gifts
|
||||
@ -1704,7 +1701,6 @@
|
||||
|= =pith:neo
|
||||
^- [pith:neo gift:neo]
|
||||
[(tail pith) (gas-gift ~(tap in (~(get ju by-parent) pith)))]
|
||||
~& gifts/gifts
|
||||
=. smut (welp smut grit)
|
||||
=. grit ~
|
||||
give
|
||||
|
97
pkg/arvo/neo/cod/std/src/imp/accel-conf.hoon
Normal file
97
pkg/arvo/neo/cod/std/src/imp/accel-conf.hoon
Normal file
@ -0,0 +1,97 @@
|
||||
/@ accel-conf
|
||||
=>
|
||||
|%
|
||||
++ card card:neo
|
||||
++ build
|
||||
|= [=bowl:neo conf=accel-conf]
|
||||
^- (quip card pail:neo)
|
||||
:_ accel-conf/!>(conf)
|
||||
=/ =term
|
||||
`@tas`(cat 3 'accel-' (scot %t (spat (pout (snip here.bowl)))))
|
||||
=/ =pith:neo
|
||||
#/[p/our.bowl]/cod/std/out/imp/[term]
|
||||
=; =vase
|
||||
[pith %make %ford-riff `vase/vase ~]^~
|
||||
=- !>(-)
|
||||
=> [..zuse neo=neo og=bowl conf=conf]
|
||||
=>
|
||||
|%
|
||||
++ lift-lore
|
||||
|= =lore:neo
|
||||
^- vase
|
||||
q.pail:(~(got of:neo lore) ~)
|
||||
::
|
||||
++ get-prelude
|
||||
|= =bowl:neo
|
||||
^- vase
|
||||
%+ with-faces:ford:neo (slop !>(neo) !>(..zuse))
|
||||
:- bowl/!>(bowl)
|
||||
%+ turn ~(tap by deps.bowl)
|
||||
|= [=term =pith:neo =lore:neo]
|
||||
^- [^term vase]
|
||||
[term (lift-lore lore)]
|
||||
::
|
||||
++ produce
|
||||
|= =bowl:neo
|
||||
^- pail:neo
|
||||
=/ res=(each vase tang)
|
||||
(mule |.((slap (get-prelude bowl) hoon.conf)))
|
||||
?: ?=(%& -.res)
|
||||
vase/p.res
|
||||
tang/!>(p.res)
|
||||
--
|
||||
^- kook:neo
|
||||
|%
|
||||
++ state any/~
|
||||
++ poke (sy %rely ~)
|
||||
++ kids *kids:neo
|
||||
++ deps
|
||||
%- ~(gas by *band:neo)
|
||||
%+ turn ~(tap in ~(key by crew.conf))
|
||||
|= =term
|
||||
^- [_term fief:neo]
|
||||
[term req=& [any/~ ~] ~]
|
||||
++ form
|
||||
^- form:neo
|
||||
|_ [=bowl:neo =aeon:neo =pail:neo]
|
||||
++ poke
|
||||
|= [=stud:neo vax=vase]
|
||||
^- (quip card:neo pail:neo)
|
||||
`(produce bowl)
|
||||
++ init
|
||||
|= pal=(unit pail:neo)
|
||||
`(produce bowl)
|
||||
--
|
||||
--
|
||||
--
|
||||
^- kook:neo
|
||||
|%
|
||||
++ state pro/%accel-conf
|
||||
++ poke (sy %hoon %accel-dep %accel-conf %ack ~)
|
||||
++ kids *kids:neo
|
||||
++ deps *deps:neo
|
||||
++ form
|
||||
^- form:neo
|
||||
|_ [=bowl:neo =aeon:neo =pail:neo]
|
||||
+* sta !<(conf=accel-conf q.pail)
|
||||
++ poke
|
||||
|= [=stud:neo vax=vase]
|
||||
^- (quip card:neo pail:neo)
|
||||
=+ !<(conf=accel-conf q.pail)
|
||||
=. conf
|
||||
?+ stud !!
|
||||
%hoon conf(ready |, hoon !<(hoon vax))
|
||||
%accel-dep conf(ready |, crew (~(put by crew.conf) !<([term pith] vax)))
|
||||
%accel-conf !<(accel-conf vax)
|
||||
%ack ((slog leaf/"ack" (sell vax) ~) conf(ready &))
|
||||
==
|
||||
?: ready.conf
|
||||
`accel-conf/!>(conf)
|
||||
(build bowl conf)
|
||||
++ init
|
||||
|= old=(unit pail:neo)
|
||||
^- (quip card:neo pail:neo)
|
||||
=+ !<(conf=accel-conf q:(need old))
|
||||
(build bowl conf)
|
||||
--
|
||||
--
|
@ -1,34 +1,58 @@
|
||||
/@ accel
|
||||
/@ accel-diff
|
||||
/@ accel-conf
|
||||
::
|
||||
=>
|
||||
|%
|
||||
+$ kind ?(%in %out %both)
|
||||
++ make-cells
|
||||
|= [=bowl:neo colstart=@ud colend=@ud rowstart=@ud rowend=@ud]
|
||||
|= [=bowl:neo colstart=@ud colend=@ud rowstart=@ud rowend=@ud =kind]
|
||||
^- (list card:neo)
|
||||
%- zing
|
||||
%+ turn (gulf colstart colend)
|
||||
|= col=@ud
|
||||
^- (list card:neo)
|
||||
%- zing
|
||||
%+ turn (gulf rowstart rowend)
|
||||
|= row=@ud
|
||||
[(welp here.bowl #/[ud/col]/[ud/row]) %make %accel-cell `accel-cell/!>(['~' ~ ~ ~ ~]) ~]
|
||||
^- (list card:neo)
|
||||
(make-cell bowl row col *accel-conf kind)
|
||||
::
|
||||
++ make-cell
|
||||
|= [=bowl:neo row=@ud col=@ud conf=accel-conf =kind]
|
||||
^- (list card:neo)
|
||||
=/ =pith:neo (welp here.bowl #/[ud/col]/[ud/row])
|
||||
=/ =stud:neo
|
||||
`@tas`(cat 3 'accel-' (scot %t (spat (pout pith))))
|
||||
=; caz=(list card:neo)
|
||||
?- kind
|
||||
%in (snag 0 caz)^~
|
||||
%out (snag 1 caz)^~
|
||||
%both caz
|
||||
==
|
||||
:~ [`pith:neo`(snoc pith `@tas`%in) %make %accel-conf `accel-conf/!>(conf) ~]
|
||||
[`pith:neo`(snoc pith `@tas`%out) %make stud ~ crew.conf]
|
||||
==
|
||||
|
||||
--
|
||||
::
|
||||
^- kook:neo
|
||||
|%
|
||||
++ state pro/%accel
|
||||
++ poke (sy %accel-diff ~)
|
||||
++ poke (sy %accel-diff %gift ~)
|
||||
++ kids
|
||||
:- ~
|
||||
:- %y
|
||||
%- ~(gas by *lads:neo)
|
||||
:~ :- [|/%ud |/%ud |]
|
||||
[pro/%accel-cell (sy %sig ~)]
|
||||
:~ :- [|/%ud |/%ud &/%in |]
|
||||
[pro/%accel-conf ~]
|
||||
::
|
||||
:- [|/%ud |/%ud &/%out |]
|
||||
[any/~ ~]
|
||||
==
|
||||
++ deps *deps:neo
|
||||
++ form
|
||||
^- form:neo
|
||||
::|_ [=bowl:neo =ever:neo sta=vase *]
|
||||
|_ [=bowl:neo =aeon:neo =pail:neo]
|
||||
++ init
|
||||
|= old=(unit pail:neo)
|
||||
@ -36,44 +60,54 @@
|
||||
=/ width 10
|
||||
=/ height 10
|
||||
:_ accel/!>([width height])
|
||||
(make-cells bowl 1 width 1 height)
|
||||
(make-cells bowl 1 width 1 height %in)
|
||||
::
|
||||
++ poke
|
||||
|= [=stud:neo vax=vase]
|
||||
^- (quip card:neo pail:neo)
|
||||
?> =(%accel-diff stud)
|
||||
=/ state !<(accel q.pail)
|
||||
=/ poke !<(accel-diff vax)
|
||||
?> =(our ship.src):bowl
|
||||
?- -.poke
|
||||
%inc-width
|
||||
=/ new (add 1 width.state)
|
||||
:_ accel/!>([new height.state])
|
||||
(make-cells bowl new new 1 height.state)
|
||||
::
|
||||
%inc-height
|
||||
=/ new (add 1 height.state)
|
||||
:_ accel/!>([width.state new])
|
||||
(make-cells bowl 1 width.state new new)
|
||||
::
|
||||
%new
|
||||
:_ accel/q.pail
|
||||
=; conf
|
||||
:~ :- (welp here.bowl ~[[ud/row.poke] [ud/column.poke]])
|
||||
:* %make
|
||||
%accel-cell
|
||||
`accel-cell/!>([text.poke ~ refa.poke refb.poke target.poke])
|
||||
conf
|
||||
==
|
||||
==
|
||||
:: there has to be a more elegant way to do this
|
||||
?~ refa.poke
|
||||
?~ refb.poke
|
||||
~
|
||||
(malt ~[[%b u.refb.poke]])
|
||||
?~ refb.poke
|
||||
(malt ~[[%a u.refa.poke]])
|
||||
(malt `(list [term pith])`~[[%a u.refa.poke] [%b u.refb.poke]])
|
||||
==
|
||||
|^ ^- (quip card:neo pail:neo)
|
||||
=^ cards=(list card:neo) state
|
||||
?+ stud !!
|
||||
%accel-diff (on-diff !<(accel-diff vax))
|
||||
%gift (on-gift !<(gift:neo vax))
|
||||
==
|
||||
[cards accell/!>(state)]
|
||||
++ on-diff
|
||||
|= poke=accel-diff
|
||||
?> =(our ship.src):bowl
|
||||
?+ -.poke !!
|
||||
%inc-width
|
||||
=/ new (add 1 width.state)
|
||||
=. width.state +(width.state)
|
||||
:_ state
|
||||
=, state
|
||||
(make-cells bowl width width 1 height %in)
|
||||
::
|
||||
%inc-height
|
||||
=/ new (add 1 height.state)
|
||||
=. height.state +(height.state)
|
||||
:_ state
|
||||
=, state
|
||||
(make-cells bowl 1 width new new %in)
|
||||
==
|
||||
++ on-gift
|
||||
|= =gift:neo
|
||||
^- (quip card:neo _state)
|
||||
:_ state
|
||||
=/ changes ~(tap by ~(tar of:neo gift))
|
||||
%- zing
|
||||
%+ turn changes
|
||||
|= [=road:neo =loot:neo]
|
||||
^- (list card:neo)
|
||||
?. ?=([[%ud col=@] [%ud row=@ud] %in ~] road)
|
||||
~
|
||||
?. (~(has of:neo kids.bowl) road)
|
||||
~
|
||||
=+ !<(conf=accel-conf q.pail:(~(got of:neo kids.bowl) road))
|
||||
?. ready.conf
|
||||
~
|
||||
(make-cell bowl row.road col.road conf %out)
|
||||
--
|
||||
--
|
||||
--
|
||||
|
@ -42,6 +42,7 @@
|
||||
==
|
||||
=. open.this (dec open.this)
|
||||
sky/!>(this)
|
||||
::
|
||||
%maximize
|
||||
:- ~
|
||||
=. hawks.this
|
||||
|
4
pkg/arvo/neo/cod/std/src/pro/accel-conf.hoon
Normal file
4
pkg/arvo/neo/cod/std/src/pro/accel-conf.hoon
Normal file
@ -0,0 +1,4 @@
|
||||
$: =hoon
|
||||
=crew:neo
|
||||
ready=_|
|
||||
==
|
Loading…
Reference in New Issue
Block a user