mirror of
https://github.com/Open-Argon/Argon.git
synced 2026-10-28 09:43:38 +00:00
change stuff
This commit is contained in:
1 parent
c1f4d7f985
commit
f932e5dab8
3 files changed
+16
-9
No files matched your search
@@ -1,2 +1,2 @@
|
|||||||
language = "python3.8"
|
language = "python3.8"
|
||||||
run = "python argon.py example.ar"
|
run = "python argon.py 'complex example'"
|
||||||
@@ -107,6 +107,9 @@ def log(*args):
|
|||||||
newargs.append(valToArgonString(args[i]))
|
newargs.append(valToArgonString(args[i]))
|
||||||
print(*newargs)
|
print(*newargs)
|
||||||
|
|
||||||
|
def substring(string, start=None, end=None, step=None):
|
||||||
|
return string[start:end:step]
|
||||||
|
|
||||||
|
|
||||||
def boxify(text, length=0, align="left"):
|
def boxify(text, length=0, align="left"):
|
||||||
if align not in ['left', 'right', 'center']:
|
if align not in ['left', 'right', 'center']:
|
||||||
@@ -163,6 +166,7 @@ vars = {
|
|||||||
'abs': {'type': 'init', 'py': abs},
|
'abs': {'type': 'init', 'py': abs},
|
||||||
'round': {'type': 'init', 'py': round},
|
'round': {'type': 'init', 'py': round},
|
||||||
'length': {'type': 'init', 'py': len},
|
'length': {'type': 'init', 'py': len},
|
||||||
|
'sub': {'type': 'init', 'py': substring},
|
||||||
'upper': {'type': 'init', 'py': lambda x: x.upper()},
|
'upper': {'type': 'init', 'py': lambda x: x.upper()},
|
||||||
'lower': {'type': 'init', 'py': lambda x: x.lower()},
|
'lower': {'type': 'init', 'py': lambda x: x.lower()},
|
||||||
'append': {'type': 'init', 'py': lambda list, value: list.append(value)},
|
'append': {'type': 'init', 'py': lambda list, value: list.append(value)},
|
||||||
@@ -189,6 +193,7 @@ vars = {
|
|||||||
'boxify': {'type': 'init', 'py': boxify},
|
'boxify': {'type': 'init', 'py': boxify},
|
||||||
'whole': {'type':'init', 'py': int},
|
'whole': {'type':'init', 'py': int},
|
||||||
'book': {'type':'init', 'py': dict},
|
'book': {'type':'init', 'py': dict},
|
||||||
|
'items': {'type': 'init', 'py': list},
|
||||||
'exec': {"type": "init", "py": code_Aexec},
|
'exec': {"type": "init", "py": code_Aexec},
|
||||||
'eval': {"type": "init", "py": code_Aeval},
|
'eval': {"type": "init", "py": code_Aeval},
|
||||||
'range': {'type': 'init', 'py': Arange},
|
'range': {'type': 'init', 'py': Arange},
|
||||||
@@ -465,7 +470,7 @@ def val_Aexec(string, eval=False, vars=vars) -> Tuple[bool, Any]: # returns a tu
|
|||||||
val = vars[varname]['value']
|
val = vars[varname]['value']
|
||||||
for i in range(len(bracketslist)-1):
|
for i in range(len(bracketslist)-1):
|
||||||
val = val[bracketslist[i]]
|
val = val[bracketslist[i]]
|
||||||
val.pop(bracketslist[-1])
|
del val[bracketslist[-1]]
|
||||||
else:
|
else:
|
||||||
del vars[varname]
|
del vars[varname]
|
||||||
else:
|
else:
|
||||||
@@ -670,7 +675,7 @@ def Aexec(string, eval=False, vars=vars) -> Tuple[bool, str]: # Aexec stands for
|
|||||||
pass
|
pass
|
||||||
elif (eval and cobinedcompiled.fullmatch(string)) or (not eval and cobinedevalcompiled.fullmatch(string)):
|
elif (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)
|
||||||
processes = ["&&", "||", "!@", "@", "<=", ">=", "<-", ">-", "!=", "==", "/", "%", "$","*","^", '+',"-"]
|
processes = ["&&", ' and ', "||", ' or ', "!@", "@", "<=", ">=", "<-", ">-", "!=", "==", "/", "%", "$","*","^", '+',"-"]
|
||||||
didprocess = False
|
didprocess = False
|
||||||
for x in range(len(processes)):
|
for x in range(len(processes)):
|
||||||
currentprocesser = processes[x]
|
currentprocesser = processes[x]
|
||||||
|
|||||||
+8
-6
@@ -21,24 +21,26 @@ const dice = ['f2', 'f1', 'b2', 'b1', 'l1', 'r1']
|
|||||||
const boardSize = {'x': 6, 'y': 6}
|
const boardSize = {'x': 6, 'y': 6}
|
||||||
|
|
||||||
sub displayBoard() [
|
sub displayBoard() [
|
||||||
|
var output = []
|
||||||
var i = 0
|
var i = 0
|
||||||
while (i<-boardSize['y']) [
|
while (i<-boardSize['y']) [
|
||||||
var j = 0
|
var j = 0
|
||||||
while (j<-boardSize['x']) [
|
while (j<-boardSize['x']) [
|
||||||
if ((i==playerPos['y']) && (j==playerPos['x'])) [
|
if ((i==playerPos['y']) && (j==playerPos['x'])) [
|
||||||
logF('██')
|
append(output,'██')
|
||||||
] else [
|
] else [
|
||||||
if (i==cpuPos['y'] && j==cpuPos['x']) [
|
if ((i==cpuPos['y']) && (j==cpuPos['x'])) [
|
||||||
logF('▒▒')
|
append(output,'▒▒')
|
||||||
] else [
|
] else [
|
||||||
logF('░░')
|
append(output,'░░')
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
j++
|
j++
|
||||||
]
|
]
|
||||||
log()
|
append(output, '\n')
|
||||||
i++
|
i++
|
||||||
]
|
]
|
||||||
|
log(join('', output))
|
||||||
]
|
]
|
||||||
|
|
||||||
sub rollDice() [
|
sub rollDice() [
|
||||||
@@ -76,7 +78,7 @@ var win = no
|
|||||||
|
|
||||||
while (gameOver == no) [
|
while (gameOver == no) [
|
||||||
displayBoard()
|
displayBoard()
|
||||||
if (turn==yes) [
|
if (turn) [
|
||||||
log('Player turn')
|
log('Player turn')
|
||||||
input('Press enter to roll')
|
input('Press enter to roll')
|
||||||
var roll = rollDice()
|
var roll = rollDice()
|
||||||
|
|||||||
Reference in new issue
Block a user