示例#1
0
## fetch the args
(options, args) = parser.parse_args()

## override the evolight defaults with parameters
if options.length:
    evolight.__length__ = options.length

if options.populationsize:
    evolight.__population_size__ = options.populationsize

if options.mutationrate:
    evolight.__persitemutationrate__ = options.mutationrate

## init the log
debug_handle = DebugLog()
debug_handle.init()

## defaults for processing
__color_offset__ = 16
__ticks__ = 256
__busy_loop_time__ = 8000

## init the colors so they aren't all black when we start up
def init_default_colors():
    for i in range(evolight.__length__):        
        colornum = i + __color_offset__
        curses.init_pair(colornum, -1, -1) ## this is the key bit

## set up the curses environment
stdscr = curses.initscr()
if not (curses.has_colors() and curses.can_change_color()):
示例#2
0
# Set up options
usage = """usage: %prog [options]
"""
parser = OptionParser(usage)
parser.add_option("-d",
                  "--debug_messages",
                  action="store_true",
                  dest="debug_messages",
                  default=False,
                  help="print debug messages to stdout")

## fetch the args
(options, args) = parser.parse_args()

debug_handle = DebugLog()
debug_handle.init()


class map_type:
    def __init__(self):
        self.description = "This is a map tile."

    def __str__(self):
        return str(self.description)


class at_location:
    def __init__(self):
        self.inventory = []

    def __str__(self):