Beispiel #1
0
def main():
    args = vars(parse_args())
    try:
        command = args.pop('command')
        commands.handle(command, **args)
    except Exception as e:
        console.cprint((e, console.styles.red))
Beispiel #2
0
 def describe(self):
     """dump all config values"""
     print ('-' * 40)
     for section in self.config.sections():
         cprint("<green:%s:/>" % (section))
         for option in self.config.options(section):
             print (' ' * 3), ("%s:" % option), self.config.get(section, option)
     print ('-' * 40)
Beispiel #3
0
def remove(path):
    template_file = os.path.join(_TEMPLATES_DIR, path)
    try:
        os.remove(template_file)
        cprint(('Template \'{}\' removed successfully.'.format(path),
                styles.blue))
    except OSError as e:
        if os.path.exists(template_file):
            raise e
Beispiel #4
0
def load_obj_from_file(file_path):
    obj = None
    try:
        fh = file(file_path, 'rb')
        obj = cPickle.load(fh)
    except IOError:
        cprint("<red:load file not found: %s/>" % file_path)
        pass
    return obj
Beispiel #5
0
import actor
import graphics
import controller
import console
import player_controller  #wrap this stuff up probably
import basic_net_controller
from ai_controllers import *
import sys
import traceback
import time

running = True
try:
    pygame.init()
    console = console.Console(RULES["CONSOLE"])
    console.cprint("Starting")
    world = actor.World(console.cprint, console.cset, RULES)
    display = graphics.Display(RULES["GRAPHICS"], world, console)

    def graphics_create_projectile(projectile):
        p = graphics.ProjectileSprite(projectile, display.screen)
        display.projectile_spts.append(p)

    world.g_proj = graphics_create_projectile
    controllers = [DodgeAimBot(a) for a in world.actors[1:]]
    #controllers = []
    #controllers.append(player_controller.PlayerController(world.actors[0]))
    controllers.append(MobileBot(world.actors[0]))

    #controllers.append( VolleyBot(world.actors[0]) )
except: