`f[{a_, a_}, _] = 1;f[_, {b_, b_}] = 0; `

f[a_, b_] := (If[MemberQ[s, {a, b}], ,s = Append[s, {a, b}];

Module[{t}, t=f[n[a, "P"], n[b, "P"]]; t1=f[n[a, "N"], n[b, "N"]];

m = Append[m, p[{a, b}] == t/2+t1/2]]];p[{a, b}]);

n[{x_, y_}, c_]:=If [StringMatchQ[y, x <> c <> "*"], {x <> c, y},

n[{StringDrop[x<>c, 1], y}, ""]];

coin[a_, b_] := (s = {}; m = {}; f[{"", a}, {"", b}]; Solve[m, Map[p,s]][[1,1,2]]);

I am very much interested in how the code works. Unfortunately, I don't know much about MATHEMATICA. I used it about 20 years ago for simple computation and plotting. I still remember the first time I heard about MATHEMATICA. It was a talk given by Steven Walfram himself, adverticing his new mathematics tools. It was a very impressive talk, so I started to use it, very limitted use though. If you could add comments on each of the statement, that would be great.

Incidently, at the begining of this year, at the Annual AMS joint meeting, I attended another talk given by Steven Walfram, it's not about MATHEMATICA this time, it is about his "New Science". Also, very interesting and impressive.