示例#1
0
def initializationCode (mazeWidth, mazeHeight, mazeMap, timeAllowed, playerLocation, opponentLocation, coins) :
    t0 = time.time()

    # First we protect ourself from killing
    connard.preventFromKilling ()

    
    # We add global variables
    global METAGRAPH
    global BESTPATHES
    global FORMICMETAGRAPH

    global GLOBALPATH
    global ACTUALPATH
    global GOALLOCATION


    # Let's define global variables
    METAGRAPH, BESTPATHES = th.generateMetaGraph(mazeMap, playerLocation, coins)
    GOALLOCATION = playerLocation
    
    t1 = time.time()
#    ut.timeline ("Computed meta-graph and best pathes", t0, t0, t1)

    # Now let's send a looooot of ants
    FORMICMETAGRAPH = aco.generateFormicMetaGraph (METAGRAPH, playerLocation, (timeAllowed-(t1-t0))*PERCENTTIMEALLOWEDFORANTSBEGINNING)

    
    t2 = time.time()
示例#2
0
文件: greedy.py 项目: dimtion/jml
def initializationCode (mazeWidth, mazeHeight, mazeMap, timeAllowed, playerLocation, opponentLocation, coins) :
    global METAGRAPH
    global BESTPATHS
    iniTime = time.time()
    METAGRAPH, BESTPATHS = th.generateMetaGraph(mazeMap, playerLocation, coins)
    api.debug(time.time() - iniTime)
    return "Everything seems fine, let's start !"
示例#3
0
def initializationCode(mazeWidth, mazeHeight, mazeMap, timeAllowed,
                       playerLocation, opponentLocation, coins):
    global METAGRAPH
    global BESTPATHS
    iniTime = time.time()
    METAGRAPH, BESTPATHS = th.generateMetaGraph(mazeMap, playerLocation, coins)
    api.debug(time.time() - iniTime)
    return "Everything seems fine, let's start !"