build
This commit is contained in:
parent
479e304357
commit
be9a86a973
Binary file not shown.
|
@ -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) {
|
||||||
|
|
|
@ -6489,7 +6489,7 @@ var __emscripten_stack_alloc = (a0) => (__emscripten_stack_alloc = wasmExports['
|
||||||
var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])();
|
var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])();
|
||||||
var ___cxa_is_pointer_type = createExportWrapper('__cxa_is_pointer_type', 1);
|
var ___cxa_is_pointer_type = createExportWrapper('__cxa_is_pointer_type', 1);
|
||||||
var dynCall_jiji = Module['dynCall_jiji'] = createExportWrapper('dynCall_jiji', 5);
|
var dynCall_jiji = Module['dynCall_jiji'] = createExportWrapper('dynCall_jiji', 5);
|
||||||
var ___emscripten_embedded_file_data = Module['___emscripten_embedded_file_data'] = 1816104;
|
var ___emscripten_embedded_file_data = Module['___emscripten_embedded_file_data'] = 1816476;
|
||||||
function invoke_i(index) {
|
function invoke_i(index) {
|
||||||
var sp = stackSave();
|
var sp = stackSave();
|
||||||
try {
|
try {
|
||||||
|
|
BIN
build/out.wasm
BIN
build/out.wasm
Binary file not shown.
|
@ -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))
|
||||||
|
|
4019
build/svg_test.svg
4019
build/svg_test.svg
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 338 KiB After Width: | Height: | Size: 7.7 KiB |
|
@ -1232,8 +1232,8 @@ fn apply_command {
|
||||||
(:clear) -> do state >
|
(:clear) -> do state >
|
||||||
assoc (state, :position, (0, 0)) >
|
assoc (state, :position, (0, 0)) >
|
||||||
assoc (_, :heading, 0)
|
assoc (_, :heading, 0)
|
||||||
(:right, turns) -> update (state, :heading, add (_, turns))
|
(:right, turns) -> update (state, :heading, mod (add (_, turns), 1))
|
||||||
(:left, turns) -> update (state, :heading, sub (_, turns))
|
(:left, turns) -> update (state, :heading, mod (sub (_, turns), 1))
|
||||||
(:forward, steps) -> {
|
(:forward, steps) -> {
|
||||||
let #{heading, position, ...} = state
|
let #{heading, position, ...} = state
|
||||||
let unit = heading/vector (heading)
|
let unit = heading/vector (heading)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user