Minor UI bugs.

I should nail this down better.  Command selections like ' []' were
failing to evaluate.
This commit is contained in:
Simon Forman 2018-07-22 11:53:02 -07:00
parent 79a653c08b
commit f2425ae1ae
1 changed files with 7 additions and 12 deletions

View File

@ -91,10 +91,8 @@ class World(object):
return self.stack[0] return self.stack[0]
def interpret(self, command): def interpret(self, command):
if len(command.split()) == 1 and not is_numerical(command): if self.has(command) and self.check(command) == False: # not in {True, None}:
assert self.has(command), repr(command) return
if self.check(command) == False: # not in {True, None}:
return
old_stack = self.stack old_stack = self.stack
try: try:
self.stack, _, self.dictionary = run( self.stack, _, self.dictionary = run(
@ -132,14 +130,11 @@ class StackDisplayWorld(World):
self.relative_STACK_FN = rel_filename self.relative_STACK_FN = rel_filename
def interpret(self, command): def interpret(self, command):
if ( command = command.strip()
is_numerical(command) if self.has(command) and self.check(command) == False: # not in {True, None}:
or len(command.split()) > 1 return
or self.has(command) print '\njoy?', command
and self.check(command) in {True, None} super(StackDisplayWorld, self).interpret(command)
):
print '\njoy?', command
super(StackDisplayWorld, self).interpret(command)
def print_stack(self): def print_stack(self):
print '\n%s <-' % stack_to_string(self.stack) print '\n%s <-' % stack_to_string(self.stack)