Trying out a different dsiplay format.

This commit is contained in:
Simon Forman 2020-05-15 07:34:47 -07:00
parent 548709c87a
commit 76ac5eca94
2 changed files with 7 additions and 2 deletions

View File

@ -130,9 +130,12 @@ class StackDisplayWorld(World):
if self.has(command) and self.check(command) == False: # not in {True, None}:
return
# print('\njoy?', command)
print(command)
self.print_command(command)
super(StackDisplayWorld, self).interpret(command)
def print_command(self, command):
print(command)
def print_stack(self):
print('\n%s <-' % stack_to_string(self.stack))
@ -164,7 +167,7 @@ class StackWorld(StackDisplayWorld):
self.viewer.update_stack(self.stack)
def print_stack(self):
# StackDisplayWorld.print_stack(self)
print('%s . ' % stack_to_string(self.stack), end='')
if self.viewer:
self.viewer.update_stack(self.stack)

View File

@ -102,6 +102,7 @@ Ns = list(map(NumberStarJoyType, _R))
Ss = list(map(StackStarJoyType, _R))
# "sec": stack effect comment, like in Forth.
sec0 = stack_effect(t1)()
sec1 = stack_effect(s0, i1)(s1)
sec2 = stack_effect(s0, i1)(a1)
@ -113,6 +114,7 @@ sec_unary_logic = stack_effect(a1)(b1)
sec_unary_math = stack_effect(n1)(n2)
sec_Ns_math = stack_effect((Ns[1], s1),)(n0)
# This is the main dict we're building.
_dictionary = {}