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