MCPcopy
hub / github.com/code-hike/codehike / line

Function line

apps/web/content/blog/the-curse-of-markdown.steps.tsx:214–230  ·  view source on GitHub ↗
(richc: number, costl: number, costr: number, n: number, rd = 5)

Source from the content-addressed store, hash-verified

212}
213
214function line(richc: number, costl: number, costr: number, n: number, rd = 5) {
215 return Array.from({ length: n * 2 }, (_, i) => {
216 const costc = (costr + costl) / 2
217 const costd = costr - costc
218
219 let rich = 101
220 let cost = 101
221 while (rich > 100 || rich < 0 || cost < 0 || cost > 100) {
222 const r = Math.random() * 2 - 1
223 const noise = Math.random() * 2 - 1
224 rich = richc + r * rd
225 cost = costc + r * costd + noise * (5 + costd)
226 }
227
228 return { rich, cost }
229 })
230}
231
232function circle(rich: number, cost: number, n: number, radius: number) {
233 return Array.from({ length: n }, (_, i) => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…