Compare commits

...

3 Commits

Author SHA1 Message Date
Scott Richmond
73b2343963 add p5 test file 2024-08-02 13:56:37 -04:00
Scott Richmond
1733de7dff build 2024-08-01 18:54:18 -04:00
Scott Richmond
be9a86a973 build 2024-08-01 18:50:09 -04:00
6 changed files with 76 additions and 3981 deletions

Binary file not shown.

View File

@ -194,11 +194,11 @@ function rotate (vector, heading) {
} }
function turn_to_rad (heading) { function turn_to_rad (heading) {
return heading * 2 * Math.PI return (heading % 1) * 2 * Math.PI
} }
function turn_to_deg (heading) { function turn_to_deg (heading) {
return (heading * 360) return ((heading % 1) * 360)
} }
function svg_render_line (prev, curr) { function svg_render_line (prev, curr) {

Binary file not shown.

16
build/p5_test.mjs Normal file
View File

@ -0,0 +1,16 @@
import {run, p5} from "./ludus.mjs"
const code = `
pencolor! (colors :white)
repeat 10 {
repeat 4 {
fd! (500)
rt! (0.25)
}
rt! (0.1)
}`
const result = run(code)
console.log(result.io.stdout.data)
console.log(p5(result.io.turtle.data))

View File

@ -1,15 +1,15 @@
import {run, svg} from "./ludus.mjs" import {run, svg} from "./ludus.mjs"
const code = ` const code = `
print! (random ()) pencolor! (colors :white)
print! (random ()) repeat 10 {
print! (random ()) repeat 4 {
print! (random ()) fd! (500)
print! (random ()) rt! (0.25)
print! (random ()) }
rt! (0.1)
` }`
const result = run(code) const result = run(code)
console.log(result.io.stdout.data) console.log(svg(result.io.turtle.data))

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 338 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB