In the following code we have:
pairings: variable that tries to represent pairs of players. In the example, player 1 plays with player 2 and player 3 plays with player 4.
V1, V2, V3, V4: are variants or symbols that players show their opponents in the couple.
Senal_observadaX: are dictionaries where we want to store the signals that each participant observes of his opponent.
As you can see, the code works, but I would like to store the signals in a more elegant and efficient way. That is, I would like to exchange the values (players) in the initial lists (for example, change to ([[1,3],[2,4]])
, the program correctly store the signals that each player has observed.) That is, the memories of the players always keep The signal that has been assigned to your partner in the initial list, that if player 1 plays with 2 stores in his dictionary V2, that if he plays with 3 stores V3 and that if he plays with 4 stores V4.
emparejamientos= ([[1,2],[3,4]])
V1="V1"
V2="V2"
V3="V3"
V4="V4"
Senal_observada1 = {"V1":0,"V2":0,"V3":0,"V4":0}
Senal_observada2 = {"V1":0,"V2":0,"V3":0,"V4":0}
Senal_observada3 = {"V1":0,"V2":0,"V3":0,"V4":0}
Senal_observada4 = {"V1":0,"V2":0,"V3":0,"V4":0}
#Almacén de senales observadas en la memoria
if emparejamientos[0]==[1,2]:
Senal_observada1[V2] +=1
Senal_observada2[V1] +=1
if emparejamientos[1]==[3,4]:
Senal_observada3[V4] += 1
Senal_observada4[V3] += 1