Commit 988d550e authored by Prathisha Kunnumbrath Manden's avatar Prathisha Kunnumbrath Manden
Browse files

Combined experiments for top-agent and bottom-agent

parent e6ee2c63
grid_size,color_end,agent
"5, 5",5,top-agent
"5, 5",10,top-agent
"5, 5",15,top-agent
"5, 5",20,top-agent
"5, 5",25,top-agent
"5, 5",30,top-agent
"5, 5",35,top-agent
"5, 5",40,top-agent
"5, 5",45,top-agent
"5, 5",50,top-agent
"5, 5",55,top-agent
"5, 5",60,top-agent
"5, 5",65,top-agent
"5, 5",70,top-agent
"5, 5",75,top-agent
"5, 5",80,top-agent
"5, 5",85,top-agent
"5, 5",90,top-agent
"5, 5",95,top-agent
"5, 5",100,top-agent
"5, 5",105,top-agent
"5, 5",110,top-agent
"5, 5",115,top-agent
"5, 5",120,top-agent
"5, 5",125,top-agent
"5, 5",130,top-agent
"5, 5",135,top-agent
"5, 5",140,top-agent
"5, 5",145,top-agent
"5, 5",150,top-agent
"5, 5",155,top-agent
"5, 5",160,top-agent
"5, 5",165,top-agent
"5, 5",170,top-agent
"5, 5",175,top-agent
"5, 5",180,top-agent
"5, 5",185,top-agent
"5, 5",190,top-agent
"5, 5",195,top-agent
"5, 5",200,top-agent
"10, 10",5,top-agent
"10, 10",10,top-agent
"10, 10",15,top-agent
"10, 10",20,top-agent
"10, 10",25,top-agent
"10, 10",30,top-agent
"10, 10",35,top-agent
"10, 10",40,top-agent
"10, 10",45,top-agent
"10, 10",50,top-agent
"10, 10",55,top-agent
"10, 10",60,top-agent
"10, 10",65,top-agent
"10, 10",70,top-agent
"10, 10",75,top-agent
"10, 10",80,top-agent
"10, 10",85,top-agent
"10, 10",90,top-agent
"10, 10",95,top-agent
"10, 10",100,top-agent
"10, 10",105,top-agent
"10, 10",110,top-agent
"10, 10",115,top-agent
"10, 10",120,top-agent
"10, 10",125,top-agent
"10, 10",130,top-agent
"10, 10",135,top-agent
"10, 10",140,top-agent
"10, 10",145,top-agent
"10, 10",150,top-agent
"10, 10",155,top-agent
"10, 10",160,top-agent
"10, 10",165,top-agent
"10, 10",170,top-agent
"10, 10",175,top-agent
"10, 10",180,top-agent
"10, 10",185,top-agent
"10, 10",190,top-agent
"10, 10",195,top-agent
"10, 10",200,top-agent
"15, 15",5,top-agent
"15, 15",10,top-agent
"15, 15",15,top-agent
"15, 15",20,top-agent
"15, 15",25,top-agent
"15, 15",30,top-agent
"15, 15",35,top-agent
"15, 15",40,top-agent
"15, 15",45,top-agent
"15, 15",50,top-agent
"15, 15",55,top-agent
"15, 15",60,top-agent
"15, 15",65,top-agent
"15, 15",70,top-agent
"15, 15",75,top-agent
"15, 15",80,top-agent
"15, 15",85,top-agent
"15, 15",90,top-agent
"15, 15",95,top-agent
"15, 15",100,top-agent
"15, 15",105,top-agent
"15, 15",110,top-agent
"15, 15",115,top-agent
"15, 15",120,top-agent
"15, 15",125,top-agent
"15, 15",130,top-agent
"15, 15",135,top-agent
"15, 15",140,top-agent
"15, 15",145,top-agent
"15, 15",150,top-agent
"15, 15",155,top-agent
"15, 15",160,top-agent
"15, 15",165,top-agent
"15, 15",170,top-agent
"15, 15",175,top-agent
"15, 15",180,top-agent
"15, 15",185,top-agent
"15, 15",190,top-agent
"15, 15",195,top-agent
"15, 15",200,top-agent
"20, 20",5,top-agent
"20, 20",10,top-agent
"20, 20",15,top-agent
"20, 20",20,top-agent
"20, 20",25,top-agent
"20, 20",30,top-agent
"20, 20",35,top-agent
"20, 20",40,top-agent
"20, 20",45,top-agent
"20, 20",50,top-agent
"20, 20",55,top-agent
"20, 20",60,top-agent
"20, 20",65,top-agent
"20, 20",70,top-agent
"20, 20",75,top-agent
"20, 20",80,top-agent
"20, 20",85,top-agent
"20, 20",90,top-agent
"20, 20",95,top-agent
"20, 20",100,top-agent
"20, 20",105,top-agent
"20, 20",110,top-agent
"20, 20",115,top-agent
"20, 20",120,top-agent
"20, 20",125,top-agent
"20, 20",130,top-agent
"20, 20",135,top-agent
"20, 20",140,top-agent
"20, 20",145,top-agent
"20, 20",150,top-agent
"20, 20",155,top-agent
"20, 20",160,top-agent
"20, 20",165,top-agent
"20, 20",170,top-agent
"20, 20",175,top-agent
"20, 20",180,top-agent
"20, 20",185,top-agent
"20, 20",190,top-agent
"20, 20",195,top-agent
"20, 20",200,top-agent
"5, 5",5,bottom-agent
"5, 5",10,bottom-agent
"5, 5",15,bottom-agent
"5, 5",20,bottom-agent
"5, 5",25,bottom-agent
"5, 5",30,bottom-agent
"5, 5",35,bottom-agent
"5, 5",40,bottom-agent
"5, 5",45,bottom-agent
"5, 5",50,bottom-agent
"5, 5",55,bottom-agent
"5, 5",60,bottom-agent
"5, 5",65,bottom-agent
"5, 5",70,bottom-agent
"5, 5",75,bottom-agent
"5, 5",80,bottom-agent
"5, 5",85,bottom-agent
"5, 5",90,bottom-agent
"5, 5",95,bottom-agent
"5, 5",100,bottom-agent
"5, 5",105,bottom-agent
"5, 5",110,bottom-agent
"5, 5",115,bottom-agent
"5, 5",120,bottom-agent
"5, 5",125,bottom-agent
"5, 5",130,bottom-agent
"5, 5",135,bottom-agent
"5, 5",140,bottom-agent
"5, 5",145,bottom-agent
"5, 5",150,bottom-agent
"5, 5",155,bottom-agent
"5, 5",160,bottom-agent
"5, 5",165,bottom-agent
"5, 5",170,bottom-agent
"5, 5",175,bottom-agent
"5, 5",180,bottom-agent
"5, 5",185,bottom-agent
"5, 5",190,bottom-agent
"5, 5",195,bottom-agent
"5, 5",200,bottom-agent
"10, 10",5,bottom-agent
"10, 10",10,bottom-agent
"10, 10",15,bottom-agent
"10, 10",20,bottom-agent
"10, 10",25,bottom-agent
"10, 10",30,bottom-agent
"10, 10",35,bottom-agent
"10, 10",40,bottom-agent
"10, 10",45,bottom-agent
"10, 10",50,bottom-agent
"10, 10",55,bottom-agent
"10, 10",60,bottom-agent
"10, 10",65,bottom-agent
"10, 10",70,bottom-agent
"10, 10",75,bottom-agent
"10, 10",80,bottom-agent
"10, 10",85,bottom-agent
"10, 10",90,bottom-agent
"10, 10",95,bottom-agent
"10, 10",100,bottom-agent
"10, 10",105,bottom-agent
"10, 10",110,bottom-agent
"10, 10",115,bottom-agent
"10, 10",120,bottom-agent
"10, 10",125,bottom-agent
"10, 10",130,bottom-agent
"10, 10",135,bottom-agent
"10, 10",140,bottom-agent
"10, 10",145,bottom-agent
"10, 10",150,bottom-agent
"10, 10",155,bottom-agent
"10, 10",160,bottom-agent
"10, 10",165,bottom-agent
"10, 10",170,bottom-agent
"10, 10",175,bottom-agent
"10, 10",180,bottom-agent
"10, 10",185,bottom-agent
"10, 10",190,bottom-agent
"10, 10",195,bottom-agent
"10, 10",200,bottom-agent
"15, 15",5,bottom-agent
"15, 15",10,bottom-agent
"15, 15",15,bottom-agent
"15, 15",20,bottom-agent
"15, 15",25,bottom-agent
"15, 15",30,bottom-agent
"15, 15",35,bottom-agent
"15, 15",40,bottom-agent
"15, 15",45,bottom-agent
"15, 15",50,bottom-agent
"15, 15",55,bottom-agent
"15, 15",60,bottom-agent
"15, 15",65,bottom-agent
"15, 15",70,bottom-agent
"15, 15",75,bottom-agent
"15, 15",80,bottom-agent
"15, 15",85,bottom-agent
"15, 15",90,bottom-agent
"15, 15",95,bottom-agent
"15, 15",100,bottom-agent
"15, 15",105,bottom-agent
"15, 15",110,bottom-agent
"15, 15",115,bottom-agent
"15, 15",120,bottom-agent
"15, 15",125,bottom-agent
"15, 15",130,bottom-agent
"15, 15",135,bottom-agent
"15, 15",140,bottom-agent
"15, 15",145,bottom-agent
"15, 15",150,bottom-agent
"15, 15",155,bottom-agent
"15, 15",160,bottom-agent
"15, 15",165,bottom-agent
"15, 15",170,bottom-agent
"15, 15",175,bottom-agent
"15, 15",180,bottom-agent
"15, 15",185,bottom-agent
"15, 15",190,bottom-agent
"15, 15",195,bottom-agent
"15, 15",200,bottom-agent
"20, 20",5,bottom-agent
"20, 20",10,bottom-agent
"20, 20",15,bottom-agent
"20, 20",20,bottom-agent
"20, 20",25,bottom-agent
"20, 20",30,bottom-agent
"20, 20",35,bottom-agent
"20, 20",40,bottom-agent
"20, 20",45,bottom-agent
"20, 20",50,bottom-agent
"20, 20",55,bottom-agent
"20, 20",60,bottom-agent
"20, 20",65,bottom-agent
"20, 20",70,bottom-agent
"20, 20",75,bottom-agent
"20, 20",80,bottom-agent
"20, 20",85,bottom-agent
"20, 20",90,bottom-agent
"20, 20",95,bottom-agent
"20, 20",100,bottom-agent
"20, 20",105,bottom-agent
"20, 20",110,bottom-agent
"20, 20",115,bottom-agent
"20, 20",120,bottom-agent
"20, 20",125,bottom-agent
"20, 20",130,bottom-agent
"20, 20",135,bottom-agent
"20, 20",140,bottom-agent
"20, 20",145,bottom-agent
"20, 20",150,bottom-agent
"20, 20",155,bottom-agent
"20, 20",160,bottom-agent
"20, 20",165,bottom-agent
"20, 20",170,bottom-agent
"20, 20",175,bottom-agent
"20, 20",180,bottom-agent
"20, 20",185,bottom-agent
"20, 20",190,bottom-agent
"20, 20",195,bottom-agent
"20, 20",200,bottom-agent
\ No newline at end of file
grid_size,color_end
"5, 5",4
"5, 5",5
"5, 5",10
"5, 5",15
"5, 5",20
"5, 5",25
"5, 5",30
"10, 10",5
"10, 10",10
"10, 10",15
"10, 10",20
"10, 10",25
"10, 10",30
"10, 10",35
"10, 10",40
"10, 10",45
"10, 10",50
"10, 10",60
"10, 10",70
"10, 10",80
"10, 10",90
"10, 10",100
"15, 15",5
"15, 15",10
"15, 15",15
"15, 15",20
"15, 15",25
"15, 15",30
"15, 15",35
"15, 15",40
"15, 15",45
"15, 15",50
"15, 15",100
"15, 15",150
"15, 15",200
"15, 15",225
"20, 20",5
"20, 20",10
"20, 20",15
"20, 20",20
"20, 20",25
"20, 20",30
"20, 20",35
"20, 20",40
"20, 20",45
"20, 20",50
"20, 20",100
"20, 20",150
"20, 20",200
"20, 20",250
"20, 20",300
"20, 20",350
"20, 20",400
\ No newline at end of file
......@@ -3,21 +3,16 @@ import random
class Agent:
moves = []
game_board = []
agent = ''
board_config = []
def __init__(self, agent_name):
self.agent = agent_name
# current_solution = []
# def prepare_agent(self, solution):
# self.current_solution = solution
def select_move(self, config):
def select_move(self, config, possible_moves):
self.board_config = config
available_moves = []
possible_moves = self.find_possible_moves(config)
# possible_moves = self.find_possible_moves(config)
row_moves = self.find_row_moves(possible_moves)
if not row_moves:
available_moves = possible_moves
......@@ -48,7 +43,7 @@ class Agent:
for i in range(len(config) - 1):
for j in range(len(config[0])):
board_copy = config.copy()
board_copy[i][j], board_copy[i + 1][j] = board_copy[i + 1][j], board_copy[i][j]
board_copy[i, j], board_copy[i + 1, j] = board_copy[i + 1, j], board_copy[i, j]
match = self.check_matches(board_copy)
if match:
co_ords.append([(i, j), (i + 1, j)])
......@@ -57,7 +52,7 @@ class Agent:
for i in range(len(config)):
for j in range(len(config[0]) - 1):
board_copy = config.copy()
board_copy[i][j], board_copy[i][j + 1] = board_copy[i][j + 1], board_copy[i][j]
board_copy[i, j], board_copy[i, j + 1] = board_copy[i, j + 1], board_copy[i, j]
match = self.check_matches(board_copy)
if match:
co_ords.append([(i, j), (i, j + 1)])
......@@ -69,7 +64,7 @@ class Agent:
for j in range(len(board[0])):
count = 1
for i in range(len(board) - 1):
if board[i][j] == board[i + 1][j]:
if board[i, j] == board[i + 1, j]:
count += 1
else:
count = 1
......@@ -80,7 +75,7 @@ class Agent:
for i in range(len(board)):
count = 1
for j in range(len(board[0]) - 1):
if board[i][j] == board[i][j + 1]:
if board[i, j] == board[i, j + 1]:
count += 1
else:
count = 1
......
NUM_OF_DEADLOCK_RETRIES = 1000
NUM_OF_MOVES_PER_GAME = 20
NUM_OF_MOVES_PER_GAME = 5
NORMAL_BOARD_SIZE = (7, 7)
NORMAL_BOARD_SIZE = (5, 5)
NORMAL_COLOR_RANGE = 6
NORMAL_REPEAT = 1
NORMAL_AGENT = "bottom-agent"
NORMAL_AGENT = "random-agent"
EXP_REPEAT = 10000
EXP_SAME_BOARD_REPEAT = 50
......
......@@ -36,7 +36,17 @@ class Experiment:
self.total_first_move_user_score = 0
self.total_first_move_avalanche_score = 0
# def reset_exp_2_metrics(self):
def reset_agent_metrics(self):
self.exp_total_score = 0 # total score for a given setting across multiple plays
self.exp_total_num_shuffles = 0 # count for getting total number of shuffles
self.exp_total_moves = 0 # count for getting average number of moves per shuffle
self.exp_total_possible_moves_count = 0 # count of total number of possible moves
self.exp_total_avalanche_match_count = 0 # count the number of avalanche matches occurred
self.total_user_move_count = 0
self.total_avalanche_count = 0
self.total_user_move_score = 0
self.total_avalanche_score = 0
self.first_move_user_count = 0
self.first_move_avalanche_count = 0
self.first_move_user_score = 0
......@@ -47,6 +57,7 @@ class Experiment:
self.total_first_move_user_score = 0
self.total_first_move_avalanche_score = 0
def store_exp_2_result(self, grid_size, number_of_colors):
file_exists = os.path.isfile("exp_2_results.csv")
with open('exp_2_results.csv', 'a+', newline='') as csv_file:
......
This diff is collapsed.
Markdown is supported
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