Remove commented code

This commit is contained in:
noelle 2025-06-01 22:25:22 -04:00
parent 93a8273b6d
commit db1464c2d2
Signed by: noelle
SSH Key Fingerprint: SHA256:30qkkOn+Czx9ud36Ekl0NB/y+W4c25oREt+qmasrU9w

View File

@ -167,9 +167,6 @@ def test_user_car():
print("Yours contained " + bad_chars) print("Yours contained " + bad_chars)
sys.exit(1) sys.exit(1)
# print("")
# print("Test results:")
train_height = len(choochoo_list) train_height = len(choochoo_list)
train_length = len(max(choochoo_list, key=len)) train_length = len(max(choochoo_list, key=len))
@ -238,7 +235,6 @@ def print_all_cars():
for fname in glob.glob('/home/*/' + traincarFN): for fname in glob.glob('/home/*/' + traincarFN):
try: try:
with open(fname, 'r') as myfile: with open(fname, 'r') as myfile:
# print fname # debug, print file path and name
choochoo_string = myfile.read() choochoo_string = myfile.read()
choochoo_list = choochoo_string.split("\n") choochoo_list = choochoo_string.split("\n")
if len(choochoo_list) > max_y+1: if len(choochoo_list) > max_y+1:
@ -250,10 +246,8 @@ def print_all_cars():
print(fname + ":") print(fname + ":")
print("\n".join(car)) # print the car to stdout print("\n".join(car)) # print the car to stdout
# HOW TO CLOSE THE FILE HANDLE? fname.close(), close(fname), ...?
except: except:
pass; pass;
# print "Cannot open " + fname # for debuggering purposes
def chuggachugga(stdscr: curses.window): def chuggachugga(stdscr: curses.window):
@ -264,37 +258,19 @@ def chuggachugga(stdscr: curses.window):
while True: while True:
for idx,train_layer in enumerate(reversed(train)): for idx,train_layer in enumerate(reversed(train)):
# screen.print_at(train_layer, x_pos, (y_pos-idx))
# stdscr.addstr((y_pos-idx),x_pos,train_layer)
train_snip_start = 0 if (x_pos >= 0) else min(abs(x_pos), len(train_layer)) train_snip_start = 0 if (x_pos >= 0) else min(abs(x_pos), len(train_layer))
train_snip_end = w-x_pos if (w-x_pos <= len(train_layer)) else len(train_layer) train_snip_end = w-x_pos if (w-x_pos <= len(train_layer)) else len(train_layer)
# train_snip_end = min(len(train_layer),w-x_pos)
x = max(0, x_pos) x = max(0, x_pos)
# stdscr.addstr(2,2,"start: " + str(train_snip_start))
# stdscr.addstr(3,2,"end: "+ str(train_snip_end))
# stdscr.addstr(4,2,"x_pos: " + str(x_pos))
# stdscr.addstr(5,2,"train len: " + str(len(train_layer)))
stdscr.addstr((y_pos-idx),x,train_layer[train_snip_start:train_snip_end]) stdscr.addstr((y_pos-idx),x,train_layer[train_snip_start:train_snip_end])
x_pos -= 1 x_pos -= 1
if x_pos == -train_len: if x_pos == -train_len:
# stdscr.addstr(2,5,"here we are!")
# time.sleep(10)
return return
stdscr.refresh() stdscr.refresh()
time.sleep(.03) time.sleep(.03)
# ev = stdscr.getch() # seems like curses waits for input, which won't work here.
# if ev in (ord('Q'), ord('q')):
# return
# elif ev == curses.KEY_UP: # up
# y_pos += 1
# elif ev == curses.KEY_DOWN: # down
# y_pos -= 1
def handler(signal_received, frame): def handler(signal_received, frame):
print("Oops. The train broke. The engineer is looking into it!") print("Oops. The train broke. The engineer is looking into it!")
print("(Note: the train does not work in all terminals yet.)") print("(Note: the train does not work in all terminals yet.)")
@ -333,10 +309,8 @@ for fname in glob.glob('/home/*/' + traincarFN):
if car != 0: if car != 0:
cars.append(car) # start a list of lists (list of cars) here. cars.append(car) # start a list of lists (list of cars) here.
# HOW TO CLOSE THE FILE HANDLE? fname.close(), close(fname), ...?
except: except:
pass; pass;
#print "Cannot open " + fname # for debuggering purposes
while len(cars) < max_cars: while len(cars) < max_cars:
cars.append([*default_car]) # add copies of default cars if train too short cars.append([*default_car]) # add copies of default cars if train too short