Skip to content

Commit 2e46371

Browse files
committed
Add a static cell size instead of a dynamic one
1 parent 4161716 commit 2e46371

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

main.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
# Libreria necesaria para los argumentos.
88
from sys import *
99

10+
11+
# Longitud maxima de las celdas
12+
LEN = 80000
13+
1014
# Comprueba que los argumentos sean correctos
1115
if len(argv) < 2 or len(argv) > 3:
1216
print(f"\n\nUsage: {argv[0]} [path/to/file.bf] [args]\n")
@@ -59,21 +63,6 @@ def checkErrors(source, argv):
5963
print(f"\nCode returned {err}.")
6064
exit(err)
6165

62-
# Calcula el numero necesario de celdas
63-
# para que el programa funcione correctamente
64-
# usando el minimo numero de recursos.
65-
def getCells(source):
66-
num = cells = 0
67-
for i in source:
68-
if i == ">":
69-
num += 1
70-
elif i == "<":
71-
num -= 1
72-
if num > cells:
73-
cells = num
74-
return cells
75-
76-
7766
# Obtiene el input y se lo mete a 'stdin'
7867
if len(argv) == 3:
7968
stdin = argv[2]
@@ -93,7 +82,7 @@ def getCells(source):
9382
# Le agrega el numero necesario de celdas necesarias + 2,
9483
# para situaciones inesperadas
9584
cells = []
96-
for i in range(getCells(source) + 2):
85+
for i in range(LEN):
9786
cells.append(0)
9887

9988
# Interpretador.

0 commit comments

Comments
 (0)