fix penwidth bug
This commit is contained in:
parent
f0d19da532
commit
13856cb8b2
|
@ -121,7 +121,7 @@ function command_to_state (prev_state, curr_command) {
|
|||
case "pendown": {
|
||||
return {...prev_state, pendown: true}
|
||||
}
|
||||
case "pendwith": {
|
||||
case "penwidth": {
|
||||
const [_, width] = curr_command
|
||||
return {...prev_state, penwidth: width}
|
||||
}
|
||||
|
@ -349,6 +349,7 @@ export function p5 (commands) {
|
|||
states.push(new_state)
|
||||
return new_state
|
||||
}, turtle_init)
|
||||
console.log(states)
|
||||
const p5_calls = [...p5_call_root]
|
||||
for (let i = 1; i < states.length; ++i) {
|
||||
const prev = states[i - 1]
|
||||
|
|
|
@ -4,6 +4,7 @@ const code = `
|
|||
print! ("Hello, world!")
|
||||
pencolor! (colors :white)
|
||||
fd! (50)
|
||||
pw! (3)
|
||||
`
|
||||
|
||||
const result = run(code)
|
||||
|
|
Loading…
Reference in New Issue
Block a user