multiagent systems self display( , "agent {self iddid {self act}"return self act maslearn py -(continued class stochasticqagent(gameagent)"""this agent maintains the -function for each state (or just the average reward as the future state is all the samechooses the best action using ""def __init__(selfactionsalpha= q_init= p_init= )""actions is the set of actions the agent can do alpha is the step size q_init is the initial -values p_init is the initial counts for ""gameagent __init__(selfactionsself { :q_init for in self actionsself dist { :p_init for in self actionsstart with random dist self alpha alpha self num_steps def select_action(selfreward)self total_score +reward self display( , "the reward for agent {self idwas {reward}"self [self act+self alpha*(reward-self [self act]a_best utilities argmaxall(self items()for in a_bestself dist[ + self display( , "distribution for agent {self idis {self dist}"self act select_from_dist(self distself display( , "agent {self iddid {self act}"return self act def normalize(dist)"""unnorm dict is {value:numberdictionarywhere the numbers are all non-negative returns dict where the numbers sum to one ""tot sum(dist values()return {var:val/tot for (var,valin dist items() def select_from_dist(dist)rand random random(for (act,probin normalize(distitems()rand -prob if rand return act the simulator takes game and simulates the gameversion june