Commit 2f1fe76b authored by Julian Rudolf's avatar Julian Rudolf
Browse files

added plot functionality to experiment.py

parent 53bbaaa8
......@@ -116,6 +116,7 @@ def play_game_learning(qagent, q_0, poss_dirs_0):
qagent.update(state, next_state, action, reward)
state = next_state
return game_over
......
......@@ -125,6 +125,8 @@ apples = [(set([]), green_apple), (set([]), purple_apple)]
#bombs = [(set([]), bomb_img)]
overall_score = [0, 0]
debug = False
class Snake:
......@@ -899,6 +901,7 @@ def select_map():
global map_filename
global startsnake1, startsnake2
global snake_length
global debug
Display.fill(white)
pos1 = (-300, 0)
pos2 = (0, 0)
......@@ -916,7 +919,6 @@ def select_map():
p1_map_filename = '../Shield/maps/map3.pickle'
p1_start = maps.start3
p1_length = snake_length
debug = False
while map_select:
for event in pygame.event.get():
......@@ -1083,7 +1085,7 @@ def game_loop():
snake1 = Snake(startsnake1["pos"], startsnake1["vel"], startsnake1["angle"], 0, img=p1_snake[0], color=p1_snake[1],
apple_img=green_apple, act_shield=True, length=snake_length)
snake2 = Snake(startsnake2["pos"], startsnake2["vel"], startsnake2["angle"], 1, img=p2_snake[0], color=p2_snake[1],
apple_img=purple_apple, act_shield=True, length=snake_length, dir=False)
apple_img=purple_apple, act_shield=not debug, length=snake_length, dir=False)
snake1.set_enemy_snake(snake2.shield_snake)
snake2.set_enemy_snake(snake1.shield_snake)
snake1.set_enemy_norm_snake(snake2)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment