On Apr 21, 5:37 am, Ivan Illarionov <ivan.illario...@gmail.com> wrote: > On Apr 18, 3:39 pm, BJörn Lindqvist <bjou...@gmail.com> wrote: > > > I first started programming basic and i don't think it has hurt me much. > > > I can somewhat sympathise with the op, neither python nor any other > > mainstream language can still do this: > > > SCREEN 13 > > PSET 160,100,255 > > This is not true. It's trivial with pygame or equivalent SDL > bindings in other mainstream languages: > > basic.py: > ------------------------------------------------------------------------------- > import sys > import pygame > > class BasicInterpreter: > def SCREEN(self, x): > self.surface = pygame.display.set_mode( > (320, 200), pygame.FULLSCREEN, 8) > > def PSET(self, x, y, c): > self.surface.set_at((x, y), c) > pygame.display.flip() > > if __name__ == '__main__' and len(sys.argv) > 1: > basic = BASIC() > with open(sys.argv[1]) as bas: > for line in bas: > eval("basic.%s(%s)" % tuple(x.strip() for x in line.split > (' ', 1))) > while True: > for event in pygame.event.get(): > if event.type in (pygame.QUIT, pygame.KEYDOWN): > sys.exit(0) > > ------------------------------------------------------------------------------- > > This will execute your BASIC program.
And you did it without Goto? Wow. > > -- > Ivan -- http://mail.python.org/mailman/listinfo/python-list