maslearn py -(continued class simulategame(displayable)def __init__(selfgameagents)self game game self agents agents list of agents self action_history [self reward_history [self dist_history [self actions tuple(ag init_action(for ag in self agentsself num_steps def go(selfsteps)for in range(steps)self num_steps + self rewards self game play(self actionsself reward_history append(self rewardsself actions tuple(self agents[iselect_action(self rewards[ ]for in range(self game num_agents)self action_history append(self actionsself dist_history append([normalize(ag distfor ag in self agents]print("scores:"join( "agent {ag idaverage reward={ag total_score/self num_steps}for ag in self agents)#return self reward_historyself action_history def action_dist(self,which_actions=[ , ])""which actions is [ , returns the empirical disctribition of actions for agentswhere ai specifies the index of the actions for agent ""return [sum( for in sim action_history if [ ]==gm actions[ ][which_actions[ ]])/len(sim action_historyfor in range( )maslearn py -(continued def plot_dynamics(selfx_action= y_action= )#plt ion(make it interactive agents self agents x_act self game actions[ ][x_actiony_act self game actions[ ][y_actionplt xlabel( "probability {self game players[ ]{self agents[ actions[x_action]}"plt ylabel( "probability {self game players[ ]{self agents[ actions[y_action]}"plt plot([self dist_history[ ][ ][x_actfor in range(len(self dist_history))][self dist_history[ ][ ][y_actfor in version june