From 7e716125921a12fabe2e272caf0ad1a17d2b55f9 Mon Sep 17 00:00:00 2001 From: Shautvast Date: Mon, 9 Dec 2024 22:29:05 +0100 Subject: [PATCH] add PI --- js/interpreter.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/interpreter.js b/js/interpreter.js index 95edb9c..ef29735 100644 --- a/js/interpreter.js +++ b/js/interpreter.js @@ -15,8 +15,9 @@ import { import {atan, cos, random, sin, tan} from "./functions"; export function interpret(init_env, code) { - + const log_console = document.getElementById("log"); let {canvas, tx, ty, tangle, unit, width, height} = init_env; + init_env.PI = Math.PI; const UP = "UP"; const DOWN = "DOWN"; const LEFT = "LEFT"; @@ -76,7 +77,7 @@ export function interpret(init_env, code) { visitPrintStatement: (expression) => { let value = THIS.evaluate(expression); - console.log(THIS.stringify(value)); + log_console.innerText = THIS.stringify(value); }, visitCallStatement: (fun, argList) => {