This commit is contained in:
W̷̛͒i̶̓͗l̷͗̌ľ̶͘ committed 2021-12-13 18:45:15 +00:00
1 parent e8b77d4b66
commit e8fa6f5b31
3 files changed
+17 -4

No files matched your search

Vendored
BIN
View File
Binary file not shown.
+9 -1
View File
@@ -1,3 +1,4 @@
from os import extsep
import re import re
from typing import Any, Tuple from typing import Any, Tuple
import sys import sys
@@ -5,6 +6,7 @@ import time
import math import math
import random import random
import json import json
import pathlib
version = "ARGON Beta 2.2.1" version = "ARGON Beta 2.2.1"
@@ -625,9 +627,11 @@ def val_Aexec(string, eval=False, vars=vars) -> Tuple[bool, Any]: # returns a tu
# bodmas stands for brackets, order of operations, division, multiplication, addition, subtraction # bodmas stands for brackets, order of operations, division, multiplication, addition, subtraction
def Aexec(string, eval=False, vars=vars) -> Tuple[bool, str]: # Aexec stands for Argon Execution def Aexec(string, eval=False, vars=vars) -> Tuple[bool, str]: # Aexec stands for Argon Execution
string = string.strip() string = string.strip()
print(string)
if (eval and cobinedcompiled.fullmatch(string)) or (not eval and cobinedevalcompiled.fullmatch(string)): if (eval and cobinedcompiled.fullmatch(string)) or (not eval and cobinedevalcompiled.fullmatch(string)):
return val_Aexec(string, eval, vars=vars) return val_Aexec(string, eval, vars=vars)
elif bracketsTest.fullmatch(string): elif bracketsTest.fullmatch(string):
print(string)
try: try:
return Aexec(string[1:-1], eval, vars=vars) return Aexec(string[1:-1], eval, vars=vars)
except SyntaxError: except SyntaxError:
@@ -747,7 +751,11 @@ def run(code: list, vars=vars, isSub = False):
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) > 1: if len(sys.argv) > 1:
code = open(sys.argv[1], "r").read().split("\n") filename = sys.argv[1]
split = pathlib.Path(filename)
if len(split.suffix) == 0:
filename += ".ar"
code = open(filename, "r").read().split("\n")
run(code) run(code)
else: else:
print(boxify( print(boxify(
+8 -3
View File
@@ -1,14 +1,19 @@
log('welcome to PI calculator!') log('welcome to PI calculator!')
const sides = whole(input('how many sides will the circle have? (more sides = more acurate and longer loading) ')) const sides = whole(input('how many sides will the circle have? '))
const timing = time() const timing = time()
var lasttime = timing
const angles = 360 / sides const angles = 360 / sides
var diameter = 0 var diameter = 0
var i = 0 var i = 0
while (i <- sides/2) [ while (i <- sides) [
diameter = diameter + sin(angles*i) diameter = diameter + sin(angles*i)
if (time() - lasttime >- 1) [
log((time() - timing) / i)
lasttime = time()
]
i++ i++
] ]
log('pi is',sides/diameter) log('pi is', sides/diameter)
log('completed in', time()-timing, 'seconds') log('completed in', time()-timing, 'seconds')