Question: How to automate an iteration in Maple

Hello. Two teams A and B (consisting of 2, 3 or even 4 players) compete and the outcome of each game is either a win or a loss. I have a to process the new (gaussian) laws of players given whom beats whom.

Given the initial means and standard deviations of the players, I have a algorithm (RC) which computes the new laws of the players. [the actual algorithm i use is different to the one i am showing here]. 

By way of example consider two teams with 2 players per side. Each person plays 2 games.

The initial laws of A1,A2,B1,B2 are given.

(A1,B1) --->(A1',B1').......[iteration 1. A1 beats B1, resulting in new laws A1' and B1'(computed by RC)]

(B2, A1') --->(B2', A1").......[ iteration 2. B2 beats A1. using A1' from iteration 1. A1 has played twice and is denoted by A1"]

(B2',A2) --->(B2",A2').......[ iteration 3. B2 beats A2. using B2' from iteration 2.  B2 has finished and is denoted by B2"]

(A2',B1') --->( A2",B1")......[ iteration 4. A2 beats B1. using B1' from iteration 1 and A2' from iteration 3. now all players have played their matches]

new laws A1" ,A2", B1" & B2" should be outputted.

my first code gets the result, but it is tedious to enter the iterations in the right place .especially for teams of 3 or more.

my second with parameters gets errors.

So what i want is to enter who beat who:

eg  [[B1, A1], [B2,A1], [B2, A2], [A2, B1]];
and the final laws are computed automatically.

bb_processing_edit.mw

Please Wait...