From dc8e79a9fa474bb77a5213706ca248968cd35bb3 Mon Sep 17 00:00:00 2001 From: Zander Thannhauser Date: Wed, 4 Jun 2025 15:56:03 -0500 Subject: [PATCH] better repl message --- main.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index ee17b48..8857af0 100755 --- a/main.py +++ b/main.py @@ -397,12 +397,16 @@ def evaluate(expr): def repl(args, cost, lookup): import readline; - print(""" -Give a boolean expression using the variables 'w', 'x', 'y' and 'z'. -Operations: not ('!'), or ('||'), and ('&&'). -Extended operations: nor ('!|'), orn ('|!'), nand ('!&'), andn ('&!'), xor ('!='), -Extended operations: nxor ('==') - """); + print("Give a boolean expression using the variables 'w', 'x', 'y' and 'z'."); + print("Operations: not ('!'), or ('||'), and ('&&')."""); + + print(); + + if args.extended_operators: + print("Extended operations: nor ('!|'), orn ('|!'), nand ('!&'), "); + print("andn ('&!'), xor ('!='), and nxor ('==')"); + + print(); # print(f'I can do anything in {max(cost.values())} operations.') # print(); @@ -414,7 +418,11 @@ Extended operations: nxor ('==') line = input(">>> "); except EOFError: return; - + + line = line.strip(); + + if not line: continue; + truthtable = evaluate(parse(parser, line)); if truthtable in lookup: