Hello: I need help with this code. I have done the code the "wrapping of the matrix" via concatenation so I can count all the neighbors. I know the logical steps for the function score and advance but I am not sure how to write them S= Score (A:matrix, b:payoff) Ae= Embed(A) For k= left to right For h= top to bottom Get neighbors of A(h,k) --> not sure how to count all the neighbors and itself Add up cooperators --> not sure either If A=0 Multiply by b End S(h,k) = score Advance (A, S) Se=embed(S) Ae=embed(A) for each element of the matrix Find highest score neighbor take location from S --> How do I take the location for the neighbour of each element? find strategy from A end Thanks
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |