Пример #1
0
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.state = 0  #State0 try to find exit, State1 bomb is planted run away
     self.bombTimer = 0
     self.bombX = 0
     self.bombY = 0
     self.bombActive = 0
Пример #2
0
 def restart(self, wrld):
     CharacterEntity.__init__(self, self.name, self.avatar, self.startX,
                              self.startY)
     self.agentX, self.angetY = self.startX, self.startY
     self.agentLX, self.agentLY = self.startX, self.startY
     self.bombTimer = 11
     self.bombX, self.bombY = -1, -1
Пример #3
0
 def __init__(self, n, d, x, y, wrld):
     CharacterEntity.__init__(self, n, d, x, y)
     #self.pathMaker = Astar(wrld)
     #self.path = self.pathMaker.findpathtoend(self.x, self.y)
     #print('path length: ', len(self.path))
     self.path = self.makepath(wrld)
     self.i = 0
Пример #4
0
 def __init__(
     self,
     name,
     avatar,
     x,
     y,
 ):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.exit = None
Пример #5
0
    def __init__(self, name, avatar, x, y):
        CharacterEntity.__init__(self, name, avatar, x, y)

        self.state = "go"
        self.hasMoved = False
        self.dxdy = (-1, -1)
        self.bomb_locations = [(7, 2, True), (7, 6, True), (7, 10, True),
                               (7, 12, True), (7, 18, False)]
        self.location_index = 0
Пример #6
0
 def __init__(self, name, player, x, y, weights):
     CharacterEntity.__init__(self, name, player, x, y)
     self.learning_rate = 0.2
     self.discount_factor = 0.9
     self.epsilon = 0.2
     self.last_q = 0
     self.current_action = (0, 0)
     self.weights = weights
     self.current_pos = (0, 0)
     self.last_pos = (0, 0)
Пример #7
0
 def __init__(
     self,
     name,
     avatar,
     x,
     y,
 ):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.bomb_timer = 0
     self.loc = []
Пример #8
0
 def __init__(self, name, avatar, x, y, varient=1):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.varient = varient
     self.path = []
     # (x,y) tuple for location of the exit
     self.goal = None
     self.bombs = []
     self.toBomb = (4, 2)
     self.newbomb_flag = 0
     self.old_state = None
     self.timer = -1
     self.state = STATE_SNEAK
Пример #9
0
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.learning_limit = 100
     self.learning_step = self.learning_limit
     self.is_learning = False
     self.discount = 0.9
     self.epsilon_start = 0.95
     self.epsilon = self.epsilon_start
     self.epsilon_rate = 0.3  # How fast should epsilon decrease
     self.path = []
     self.path_search = 0
     self.danger_radius = 5
     seed(10)
Пример #10
0
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.name = name
     self.avatar = avatar
     self.startX, self.startY = x, y
     self.wrld = None
     self.bombPlaced = False
     self.bombTimer = 11
     self.agentX, self.agentY = self.startX, self.startY
     self.agentLX, self.agentLY = self.startX, self.startY
     self.exitX, self.exitY = -1, -1
     self.bombX, self.bombY = -1, -1
     self.locations = set('0,0')
Пример #11
0
 def __init__(self, name, avatar, x, y, inter):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.name = name
     self.avatar = avatar
     self.startX, self.startY = x, y
     self.wrld = None
     self.bombPlaced = False
     self.bombTimer = 11
     self.agentX, self.agentY = self.startX, self.startY
     self.agentLX, self.agentLY = self.startX, self.startY
     self.exitX, self.exitY = -1, -1
     self.bombX, self.bombY = -1, -1
     self.inter = inter
     self.lastState = ''
     self.QTable = ""
     self.readQTable()
     self.nextAction = 0
Пример #12
0
 def __init__(self,name,avatar,x,y, qFile, learn):
     CharacterEntity.__init__(self,name,avatar,x,y)
     self.name = name
     self.avatar = avatar
     self.startX, self.startY = x,y
     self.wrld = None
     self.bombPlaced = False
     self.bombTimer = 10
     self.agentX, self.agentY = self.startX,self.startY
     self.agentLX,self.agentLY = self.startX,self.startY
     self.exitX, self.exitY = -1,-1
     self.bombX, self.bombY = -1, -1
     self.lastState = ''
     self.lastAction = ''
     self.q_file = qFile
     self.q_table =self.init_q(qFile)
     self.learn = learn
Пример #13
0
	def __init__(self, name, avatar, x, y, q_learner, train, iteration):
		CharacterEntity.__init__(self, name, avatar, x, y)

		self.q_learner = q_learner
		self.train = train
		self.iteration = iteration 

		self.epsilon = 1 / (self.iteration + 1) ** 0.5
		self.prev_wrld = None
		self.best_wrld = None
		self.iterations = 0
		self.qLearning = False
		self.bomb = False
  
		self.state = "go"
		self.dxdy = (-1, -1)
		self.bomb_locations = [(0, 2, True), (0, 3, True),(1, 3, True), (2, 3,True), (3, 3, True),(4, 3, True),(5, 3, True), (7, 3, True), (7, 10, True), (4, 9, False), (7, 12, True), (7, 18, False)]
		self.location_index = 0
Пример #14
0
    def __init__(self, name, avatar, x, y, active_features, decay, lr):
        CharacterEntity.__init__(self, name, avatar, x, y)
        # Weights turned on (if 0 in 6th spot 6th feature turned off)
        self.on = [0.0] * self.NUM_FEATURES
        for feat_num, weight in active_features:
            self.on[feat_num] = weight

        self.weightArray = self.on  # Array of weights
        self.featureArray = [0.0] * self.NUM_FEATURES  # Array of features
        self.gamma = 0.9  # Reward Decay
        self.lr = lr  # Learning Rate
        self.decay = decay  # Decay
        self.wins = 0  # Number of wins so far
        self.losses = 0  # Number of losses so far
        self.debug = False  # Turn off to reduce prints
        self.oldState1 = self.on  # Used to save a state to revert back to later
        self.oldState2 = [
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -5.0, 0.0, 0.0, 0.0, 0.0, 0.0
        ]  # Used to save rush state
        self.state = 1  # State the bot is currently in

        self.monster_aggro_range = 2
Пример #15
0
    def __init__(self,
                 name,
                 avatar,
                 x,
                 y,
                 q_learner,
                 train,
                 iteration,
                 stateMachine=False):
        CharacterEntity.__init__(self, name, avatar, x, y)

        self.q_learner = q_learner
        self.train = train
        self.iteration = iteration

        self.epsilon = 1 / (self.iteration + 1)**0.5
        self.prev_wrld = None
        self.best_wrld = None
        self.count = 0
        self.iterations = 0
        self.pastMoves = []
        self.identity = "A-Star"
        self.stateMachine = stateMachine
Пример #16
0
 def __init__(self, name, avatar, x, y, sensitivity):
     CharacterEntity.__init__(self, name, avatar, x, y)
     # sensitivity is a number that weight the distance to monster evaluation
     # higher value means stay further away from nearest monster (usually 100~1000)
     self.sensitivity = sensitivity
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.ticked = False
Пример #18
0
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.ticked = False
     self.oldwrld = None
     self.currwrld = None
Пример #19
0
	def __init__(self, name, avatar, x, y, scenario_num, variant_num):
		CharacterEntity.__init__(self, name, avatar, x, y)
		self.scenario_num = scenario_num
		self.variant_num = variant_num
Пример #20
0
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.monster_dist = 1
     self.best = 10000000
     self.worst = -self.best * 1000
     self.max_depth = 2
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
Пример #22
0
 def __init__(self, name, avatar, x, y, d):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.sensitivity = d  # d is distance to monster ,higher means stay further away from a monster near u
Пример #23
0
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.first = True
     self.path = None
Пример #24
0
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.state = 'm'
     self.bomb_at = []
Пример #25
0
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.reward = 0
     self.q_learn = Qlearning(0)
Пример #26
0
 def __init__(self, name, avatar, x, y):
     CharacterEntity.__init__(self, name, avatar, x, y)
     self.state = "aStar"
    def __init__(self, name, avatar, x, y):
        CharacterEntity.__init__(self, name, avatar, x, y)

        self.need_search = True
        self.movelist = []