def main(): console_type = 'curses' if '--pygame' in sys.argv: console_type = 'pygame' if PLATFORM_SYSTEM == 'Windows': console_type = 'pygame' # # Snake is a good go-to program for testing. Hence, I like to leave this # in, commented out. ''' init_network_logging( mtu=MTU, addr='127.255.255.255', port=7789, label='snake') ''' # engine = Engine(mtu=MTU) try: engine.default_timeout = 0.01 init_nearcast(engine=engine, console_type=console_type) # engine.event_loop() except SolentQuitException: pass finally: engine.close()
def main(): console_type = 'curses' if '--pygame' in sys.argv: console_type = 'pygame' elif sys.platform in ('msys', 'win32', 'win64'): b_ok = True try: import pygame console_type = 'pygame' except: print("[!] On Windows, snake needs pygame. (But, try winsnake!).") sys.exit(1) # engine = Engine( mtu=MTU) try: engine.default_timeout = 0.01 init_nearcast( engine=engine, console_type=console_type) # engine.event_loop() except SolentQuitException: pass finally: engine.close()
def launch(console_type): engine = Engine(mtu=MTU) try: engine.default_timeout = 0.01 init_nearcast(engine=engine, console_type=console_type) # engine.event_loop() except SolentQuitException: pass finally: engine.close()
def main(): print("This is stub code to allow us to create a native-Windows console") print("At the time of writing, that console is unfinished.") print("(Hence, this will crash shortly.)") # console_type = 'windows' # engine = Engine( mtu=MTU) try: engine.default_timeout = 0.01 launch( engine=engine, console_type=console_type) except SolentQuitException: pass finally: engine.close()
def main(): init_logging() # engine = None try: engine = Engine( mtu=MTU) engine.default_timeout = 0.04 # orb = engine.init_orb( i_nearcast=I_NEARCAST_SCHEMA) orb.init_cog(CogInterpreter) orb.init_cog(CogTerm) engine.event_loop() except SolentQuitException: pass except: traceback.print_exc() finally: if engine != None: engine.close()
def main(): p = sys.platform # if p not in ('msys', 'win32', 'win64'): m = ' '.join([ "ERROR: winsnake only works on windows.", "Try solent.demo.snake for other platforms.", "(sys.platform: |%s|)" % (p) ]) print(m) sys.exit(1) # engine = Engine(mtu=MTU) engine.default_timeout = 0.01 # try: init_nearcast(engine=engine, game_name=GAME_NAME) engine.event_loop() except SolentQuitException: pass finally: engine.close()