示例#1
0
import os

from hlt import *
from networking import *
import logging
import time
from HaliteBotCode import *
import cProfile

myID, gameMap = getInit()
haliteBot = HaliteBotCode(gameMap)
haliteBot.setMyId(myID)
sendInit("byronwall-halite-1")

if not os.path.isdir("logs"):
    os.mkdir("logs")

if not os.path.isdir("profiles"):
    os.mkdir("profiles")

SHOULD_PROFILE = False

LOG_FILENAME = str(int(time.time())) + "-" + str(myID) + '.log'
logging.basicConfig(filename="logs/" + LOG_FILENAME, level=logging.DEBUG)

#disbale logging when running on the server
user_name = os.environ.get("USER")
if user_name != "byronwall":
    logging.disable(logging.CRITICAL)
    SHOULD_PROFILE = True
示例#2
0
                    help='Time to take while finding moves',
                    type=float)

args = vars(parser.parse_args())

# decide if logging should happen
if args["logging"]:
    if not os.path.isdir("logs"):
        os.mkdir("logs")
    LOG_FILENAME = str(int(time.time())) + "-" + '.log'
    logging.basicConfig(filename="logs/" + LOG_FILENAME, level=logging.DEBUG)
else:
    logging.disable(logging.CRITICAL)

myID, gameMap = hlt.get_init()
haliteBot = HaliteBotCode(gameMap, myID, args)

# do the init steps
haliteBot.do_init()

bot_name = "byronwall-ga1" if args["name"] is None else args["name"]
hlt.send_init(bot_name)

# decide if profiling should happen
SHOULD_PROFILE = args["profile"]
if SHOULD_PROFILE:
    if not os.path.isdir("profiles"):
        os.mkdir("profiles")

frame = 0
示例#3
0
import os

import hlt
from hlt import NORTH, EAST, SOUTH, WEST, STILL, Move, Square

import logging
import time
from HaliteBotCode import *
import cProfile

myID, gameMap = hlt.get_init()
haliteBot = HaliteBotCode(gameMap, myID)

hlt.send_init("byronwall-halite-6")

if not os.path.isdir("logs"):
    os.mkdir("logs")

if not os.path.isdir("profiles"):
    os.mkdir("profiles")

SHOULD_PROFILE = False

LOG_FILENAME = str(int(time.time())) + "-" + str(myID) + '.log'
logging.basicConfig(filename="logs/" + LOG_FILENAME, level=logging.DEBUG)

#disbale logging when running on the server
user_name = os.environ.get("USER")
if user_name != "byronwall":
    logging.disable(logging.CRITICAL)
else: