mirror of
https://github.com/Open-Argon/Argon.git
synced 2026-10-28 09:43:38 +00:00
merge
This commit is contained in:
1 parent
e8b77d4b66
commit
e8fa6f5b31
3 files changed
+17
-4
No files matched your search
@@ -1,3 +1,4 @@
|
||||
from os import extsep
|
||||
import re
|
||||
from typing import Any, Tuple
|
||||
import sys
|
||||
@@ -5,6 +6,7 @@ import time
|
||||
import math
|
||||
import random
|
||||
import json
|
||||
import pathlib
|
||||
|
||||
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
|
||||
def Aexec(string, eval=False, vars=vars) -> Tuple[bool, str]: # Aexec stands for Argon Execution
|
||||
string = string.strip()
|
||||
print(string)
|
||||
if (eval and cobinedcompiled.fullmatch(string)) or (not eval and cobinedevalcompiled.fullmatch(string)):
|
||||
return val_Aexec(string, eval, vars=vars)
|
||||
elif bracketsTest.fullmatch(string):
|
||||
print(string)
|
||||
try:
|
||||
return Aexec(string[1:-1], eval, vars=vars)
|
||||
except SyntaxError:
|
||||
@@ -747,7 +751,11 @@ def run(code: list, vars=vars, isSub = False):
|
||||
|
||||
if __name__ == "__main__":
|
||||
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)
|
||||
else:
|
||||
print(boxify(
|
||||
|
||||
+8
-3
@@ -1,14 +1,19 @@
|
||||
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()
|
||||
var lasttime = timing
|
||||
const angles = 360 / sides
|
||||
var diameter = 0
|
||||
|
||||
var i = 0
|
||||
while (i <- sides/2) [
|
||||
while (i <- sides) [
|
||||
diameter = diameter + sin(angles*i)
|
||||
if (time() - lasttime >- 1) [
|
||||
log((time() - timing) / i)
|
||||
lasttime = time()
|
||||
]
|
||||
i++
|
||||
]
|
||||
log('pi is',sides/diameter)
|
||||
log('pi is', sides/diameter)
|
||||
log('completed in', time()-timing, 'seconds')
|
||||
Reference in new issue
Block a user