on main help sign in
initial star chart scry
d08b4efJohn Hyde
desk/app/astrolabe.hoon+57−62
@@ -54,9 +54,10 @@
54 ?+ path (on-peek:def path)
54 ?+ path (on-peek:def path)
55 [%x %point @ ~]
55 [%x %point @ ~]
56 ``astrolabe-point+!>((get-point:hc &3.path))
56 ``astrolabe-point+!>((get-point:hc &3.path))
57− [%x %point @ %spawned ~]
57+ [%x %point @ %spawned ?(~ [spawned-filter ~])]
58 =/ =ship `@p`(slav %p &3.path)
58 =/ =ship `@p`(slav %p &3.path)
59+ =/ arg ?~(t.t.t.t.path %all i.t.t.t.t.path)
59− ``astrolabe-point-set+!>((get-spawned-points:hc ship))
60+ ``astrolabe-point-set+!>((get-spawned-points:hc ship arg))
60 [%x %search @ ?(~ [%narrow ~])]
61 [%x %search @ ?(~ [%narrow ~])]
61 =/ =search-text (trip &3.path)
62 =/ =search-text (trip &3.path)
62 =/ expand-search =(t.t.t.path ~)
63 =/ expand-search =(t.t.t.path ~)
@@ -64,6 +65,8 @@
64 [%x %peers ~]
65 [%x %peers ~]
65 =/ peers .^((map ship ?(%alien %known)) %ax (scrio:hc %$ /peers))
66 =/ peers .^((map ship ?(%alien %known)) %ax (scrio:hc %$ /peers))
66 ``astrolabe-point-set+!>((turn ~(tap in peers) head))
67 ``astrolabe-point-set+!>((turn ~(tap in peers) head))
68+ [%x %chart-data ~]
69+ ``astrolabe-chart-data+!>(get-chart-data:hc)
67 [%x %doc ^]
70 [%x %doc ^]
68 =/ doc-path=^path t.t.path
71 =/ doc-path=^path t.t.path
69 =/ doc (read-doc:hc doc-path)
72 =/ doc (read-doc:hc doc-path)
@@ -180,12 +183,13 @@
180 ==
183 ==
181::
184::
182++ run-spawned-points
185++ run-spawned-points
183− |* [agg=mold targ=ship]
186+ |* [agg=mold targ=ship nas=^state:naive filter=spawned-filter]
184− |= f=$-([agg ship] agg)
187+ |= f=$-([agg [ship npoint]] agg)
185 ^- agg
188 ^- agg
186− =/ nas get-nas
189+ =| =agg
190+ ?. ?=(?(%czar %king) (clan:title targ))
191+ agg
187 =+ points=points.nas
192 =+ points=points.nas
188− =| agg=agg
189 |-
193 |-
190 ^- _agg
194 ^- _agg
191 ?~ points
195 ?~ points
@@ -196,69 +200,28 @@
196 $(points r.points)
200 $(points r.points)
197 =? agg =(targ (end (add 2 (xeb (met 3 targ))) n))
201 =? agg =(targ (end (add 2 (xeb (met 3 targ))) n))
198 $(points r.points)
202 $(points r.points)
203+ =/ should-agg
199− =? agg =(targ (^sein:title n))
204+ ?& =(targ (^sein:title n))
205+ ?| =(filter %all)
206+ .= =(filter %locked) (is-npoint-locked +.n.points)
207+ ==
208+ ==
209+ =? agg should-agg
200− (f agg n)
210+ (f agg n.points)
201 $(points l.points)
211 $(points l.points)
202++ get-spawned-points
212++ get-spawned-points
203− |= targ=ship
213+ |= [targ=ship filter=spawned-filter]
214+ =/ nas get-nas
204− %- (run-spawned-points (list ship) targ)
215+ %- (run-spawned-points (list ship) targ nas filter)
205− |= [agg=(list ship) spawn=ship]
216+ |= [agg=(list ship) [spawn=ship *]]
206 [spawn agg]
217 [spawn agg]
207::
218::
208++ spa-count
219++ spa-count
209 |= targ=ship
220 |= targ=ship
210− %- (run-spawned-points @ud targ)
221+ %- (run-spawned-points @ud targ get-nas %all)
211− |= [agg=@ud spawn=ship]
222+ |= [agg=@ud [spawn=ship *]]
212 +(agg)
223 +(agg)
213::
224::
214−++ run-wildcard-search
215− |* [agg=mold search=search-full points=opoints =page-info]
216− |= [res=[count=@ =agg] f=$-([agg @q] agg)]
217− ^- [count=@ =agg]
218− =/ s-syls search-syls.search
219− :: ~& s-syls
220− =/ s-opts search-opts.search
221− =+ [llb=.~zod rrb=`@q`(sub (bex 32) 1)]
222− :: =< +
223− |-
224− ^- _res
225− ?~ points
226− :: ~& "nothing here, going up"
227− res
228− :: ?: (gth count.res 1.000) ~|(%search-too-broad !!)
229− =/ n=@q `@`-.n.points
230− =/ lrb=@q ?: (gth n 0) (sub-d n 1) .~zod
231− =/ rlb=@q (add-d n 1)
232− =/ left-view (range-contains-search llb lrb s-opts)
233− :: ~& "arrived at {<n>}"
234− :: ~& "left side: {<?:(contains.left-view 'Y' 'N')>} {<llb>} - {<lrb>}"
235− =/ right-view (range-contains-search rlb rrb s-opts)
236− =? res contains.left-view
237− $(points l.points, rrb lrb, s-opts opts.left-view)
238− =? res (matches-search s-syls n)
239− =/ fits (fits-on-page count.res page-info)
240− =. count.res +(count.res)
241− =? agg.res fits (f agg.res n)
242− res
243− :: ~& "right side: {<?:(contains.right-view 'Y' 'N')>} {<rlb>} - {<rrb>}"
244− =? res contains.right-view
245− $(points r.points, llb rlb, s-opts opts.right-view)
246− res
247−::
248−++ run-mr-search
249− |= [search=mr-search res=[count=@ agg=opoints]]
250− ^- _res
251− =/ points ?: reversed.search ropoints fopoints
252− =. res
253− %+ (run-wildcard-search _agg.res search-full.search points [0 0])
254− res
255− |= [agg=_agg.res result=@q]
256− =? result reversed.search
257− (switch-words result)
258− =. result (to-p result)
259− (put:((on @ @) gte) agg result ~)
260− :: ~& "returning {<~(wyt by agg.res)>} of {<count.res>} results"
261− res
262++ search-opoints
225++ search-opoints
263 |= [=search-text expand-search=?]
226 |= [=search-text expand-search=?]
264 ^- (list ship)
227 ^- (list ship)
@@ -273,7 +236,7 @@
273 ?~ mr-searches ~|(%search-predicted-too-broad !!)
236 ?~ mr-searches ~|(%search-predicted-too-broad !!)
274 =/ res
237 =/ res
275 %+ roll `(list mr-search)`mr-searches
238 %+ roll `(list mr-search)`mr-searches
276− run-mr-search
239+ (run-mr-search fopoints ropoints)
277 :: ~& "search for {<search-text>}".
240 :: ~& "search for {<search-text>}".
278 :: " returning {<~(wyt by agg.res)>}".
241 :: " returning {<~(wyt by agg.res)>}".
279 :: " of {<count.res>} results"
242 :: " of {<count.res>} results"
@@ -301,6 +264,38 @@
301 =/ parent-point (get-unpoint parent)
264 =/ parent-point (get-unpoint parent)
302 $(ship parent, unpoint parent-point)
265 $(ship parent, unpoint parent-point)
303::
266::
267+++ get-chart-data
268+ ^- chart-data
269+ =/ nas get-nas
270+ :: =/ galaxies (gulf 0 15) :: todo remove
271+ %+ turn galaxies
272+ |= =ship
273+ =/ point (need (get:orm:naive points.nas ship))
274+ (get-point-chart-data nas ship point)
275+::
276+++ get-point-chart-data
277+ |= [nas=^state:naive =ship =npoint]
278+ ^- point-chart-data
279+ =, sponsor.net.npoint
280+ =/ desc-has
281+ ?. has %none
282+ ?: =(who (^sein:title ship))
283+ %same
284+ %diff
285+ :- :* ship
286+ dominion.npoint
287+ [desc-has who]
288+ ==
289+ (get-spawned-chart-data nas ship)
290+::
291+++ get-spawned-chart-data
292+ |= [nas=^state:naive =ship]
293+ ^- chart-data
294+ :: [*point-meta ~]~
295+ %- (run-spawned-points chart-data ship nas %all)
296+ |= [agg=chart-data [spawn=^ship spawn-point=npoint]]
297+ :_ agg
298+ (get-point-chart-data nas spawn spawn-point)
304++ read-doc
299++ read-doc
305 |= =path
300 |= =path
306 =/ doc-path=^path :(weld /doc/usr path /udon)
301 =/ doc-path=^path :(weld /doc/usr path /udon)
desk/lib/astrolabe.hoon+36
@@ -1,4 +1,5 @@
1/- sur=astrolabe
1/- sur=astrolabe
2+/+ azimuth
2=< [sur .]
3=< [sur .]
3=, sur
4=, sur
4|%
5|%
@@ -52,6 +53,11 @@
52 $(a (rsh 3 a), b (rsh 3 b), i +(i))
53 $(a (rsh 3 a), b (rsh 3 b), i +(i))
53 (lth c d)
54 (lth c d)
54::
55::
56+++ is-npoint-locked
57+ |= p=npoint
58+ .= linear-star-release:contracts:azimuth
59+ address.owner.own.p
60+::
55++ nu :: parse number as hex
61++ nu :: parse number as hex
56 |= jon=json
62 |= jon=json
57 ?> ?=([%s *] jon)
63 ?> ?=([%s *] jon)
@@ -137,6 +143,36 @@
137 ~
143 ~
138 ?: =('.' i.b) $(b t.b)
144 ?: =('.' i.b) $(b t.b)
139 [i.b $(b t.b)]
145 [i.b $(b t.b)]
146+ ++ point-meta
147+ |= m=^point-meta
148+ ^- (list [@tas json])
149+ =/ main-pairs
150+ :~
151+ p+(ship ship.m)
152+ :: spa-count+(numb spa-count.m)
153+ [%d s+dom.m]
154+ ==
155+ ?: =(has.spo.m %same) main-pairs
156+ :_ main-pairs
157+ :- %s
158+ ?: =(has.spo.m %none) ~
159+ (ship who.spo.m)
160+ ::
161+ ++ point-chart-data
162+ |= d=^point-chart-data
163+ ^- json
164+ =/ point-meta-pairs (point-meta -.d)
165+ %- pairs
166+ ?~ spa.d point-meta-pairs
167+ %+ snoc point-meta-pairs
168+ c+(chart-data spa.d)
169+ :: spa+a+~
170+ ::
171+ ++ chart-data
172+ |= d=^chart-data
173+ ^- json
174+ :- %a
175+ (turn d point-chart-data)
140 --
176 --
141::
177::
142++ dejs
178++ dejs
desk/lib/search.hoon+51
@@ -12,6 +12,7 @@
12++ prefixes ^~ (trip-syls sis:po)
12++ prefixes ^~ (trip-syls sis:po)
13++ suffixes ^~ (trip-syls dex:po)
13++ suffixes ^~ (trip-syls dex:po)
14++ full-opts ^~ (gulf .~zod .~fes)
14++ full-opts ^~ (gulf .~zod .~fes)
15+++ galaxies ^~ `(list @p)``(list @)`full-opts
15++ sanitize-search-text
16++ sanitize-search-text
16 |= =search-text
17 |= =search-text
17 ^- tape
18 ^- tape
@@ -277,4 +278,54 @@
277 $(cand-0 t.cand-0)
278 $(cand-0 t.cand-0)
278 search
279 search
279::
280::
281+++ run-wildcard-search
282+ |* [agg=mold search=search-full points=opoints =page-info]
283+ |= [res=[count=@ =agg] f=$-([agg @q] agg)]
284+ ^- [count=@ =agg]
285+ =/ s-syls search-syls.search
286+ :: ~& s-syls
287+ =/ s-opts search-opts.search
288+ =+ [llb=.~zod rrb=`@q`(sub (bex 32) 1)]
289+ :: =< +
290+ |-
291+ ^- _res
292+ ?~ points
293+ :: ~& "nothing here, going up"
294+ res
295+ :: ?: (gth count.res 1.000) ~|(%search-too-broad !!)
296+ =/ n=@q `@`-.n.points
297+ =/ lrb=@q ?: (gth n 0) (sub-d n 1) .~zod
298+ =/ rlb=@q (add-d n 1)
299+ =/ left-view (range-contains-search llb lrb s-opts)
300+ :: ~& "arrived at {<n>}"
301+ :: ~& "left side: {<?:(contains.left-view 'Y' 'N')>} {<llb>} - {<lrb>}"
302+ =/ right-view (range-contains-search rlb rrb s-opts)
303+ =? res contains.left-view
304+ $(points l.points, rrb lrb, s-opts opts.left-view)
305+ =? res (matches-search s-syls n)
306+ =/ fits (fits-on-page count.res page-info)
307+ =. count.res +(count.res)
308+ =? agg.res fits (f agg.res n)
309+ res
310+ :: ~& "right side: {<?:(contains.right-view 'Y' 'N')>} {<rlb>} - {<rrb>}"
311+ =? res contains.right-view
312+ $(points r.points, llb rlb, s-opts opts.right-view)
313+ res
314+::
315+++ run-mr-search
316+ |= [fopoints=opoints ropoints=opoints]
317+ |= [search=mr-search res=[count=@ agg=opoints]]
318+ ^- _res
319+ =/ points ?: reversed.search ropoints fopoints
320+ =. res
321+ %+ (run-wildcard-search _agg.res search-full.search points [0 0])
322+ res
323+ |= [agg=_agg.res result=@q]
324+ =? result reversed.search
325+ (switch-words result)
326+ =. result (to-p result)
327+ (put:((on @ @) gte) agg result ~)
328+ :: ~& "returning {<~(wyt by agg.res)>} of {<count.res>} results"
329+ res
330+::
280--
331--
desk/mar/astrolabe/chart-data.hoonnew file+14
@@ -0,0 +1,14 @@
1+/+ *astrolabe
2+|_ data=chart-data
3+++ grab
4+ |%
5+ ++ noun chart-data
6+ :: ++ json point:dejs
7+ --
8+++ grow
9+ |%
10+ ++ noun data
11+ ++ json (chart-data:enjs data)
12+ --
13+++ grad %noun
14+--
desk/sur/astrolabe.hoon+22
@@ -9,4 +9,26 @@
9 sponsor-chain=(list ship)
9 sponsor-chain=(list ship)
10 probable-dominion=dominion:naive
10 probable-dominion=dominion:naive
11 ==
11 ==
12++$ spawned-filter ?(%all %locked %unlocked)
13+::
14++$ point-meta
15+ $: =ship
16+ :: spa-count=@ud
17+ dom=dominion:naive
18+ spo=[has=?(%none %same %diff) who=ship]
19+ :: moons=(list ship)
20+ ==
21+:: +$ point-chart-data
22+:: $% [%czar point-meta spa=chart-data]
23+:: [%king point-meta spa=chart-data]
24+:: [%duke point-meta]
25+:: ==
26++$ point-chart-data [point-meta spa=chart-data]
27+:: +$ star-chart-data [self=point planets=(list point)]
28+:: +$ galaxy-chart-data stars=(list star-chart-data)
29+++ chart-data
30+ |-
31+ $@ ~
32+ (list [point-meta spa=$])
33+
12--
34--