Author Topic: 掷硬币序列  (Read 39623 times)

warren

  • Full Member
  • ***
  • Posts: 148
掷硬币序列
« on: 十一月 08, 2004, 01:03:41 pm »
1) 两个人A和B玩游戏。方法是:A选定一个长度为3的正反序列,比方说“正反反”,B选定另一个不同
的长度为3的正反序列,比方说“正正反”。现在开始反复丢一枚出现正反的可能性都是1/2的硬币,直到
出现A或B选定的正反序列为止。谁的序列出现了,谁就是赢家。问A和B获胜的概率各是多少?

2)有三个人A,B,C参加游戏,A选“正正正正反”,B选“反正正正正”,C选“反正反正反”,
各人赢的可能分别是多少?

3)一般情况,有K人参加游戏,每个人指定一个正反序列,在丢硬币过程中谁指定的序列先出现谁获胜。
如何计算各人获胜的概率?

idiot94

  • Sr. Member
  • ****
  • Posts: 484
掷硬币序列
« Reply #1 on: 十一月 08, 2004, 02:03:44 pm »
Maybe I did not get your point in this trick... but it seems to me that each distinct sequence with the same length will have exactly the same probabilty of appearing. Thus all K people will have equal chance to win (1/K). Where is the tricky thing tho?
In general, the men of lower intelligence won out. Afraid of of their own shortcomings ... they boldly moved into action. Their enemies, ...  thought there was no need to take by action what they could win by their brains. Thucydides, History

warren

  • Full Member
  • ***
  • Posts: 148
掷硬币序列
« Reply #2 on: 十一月 08, 2004, 02:20:48 pm »
Quote from: idiot94
Maybe I did not get your point in this trick... but it seems to me that each distinct sequence with the same length will have exactly the same probabilty of appearing. Thus all K people will have equal chance to win (1/K). Where is the tricky thing tho?


各人获胜概率是不等的。以2)为例,容易看出,A要获胜必须前4次都出现正面。

idiot94

  • Sr. Member
  • ****
  • Posts: 484
掷硬币序列
« Reply #3 on: 十一月 08, 2004, 02:24:56 pm »
Quote from: warren
Quote from: idiot94
Maybe I did not get your point in this trick... but it seems to me that each distinct sequence with the same length will have exactly the same probabilty of appearing. Thus all K people will have equal chance to win (1/K). Where is the tricky thing tho?


各人获胜概率是不等的。以2)为例,容易看出,A要获胜必须前4次都出现正面。

So? :D

I guess I did not get your point, apparently so :D
In general, the men of lower intelligence won out. Afraid of of their own shortcomings ... they boldly moved into action. Their enemies, ...  thought there was no need to take by action what they could win by their brains. Thucydides, History

fzy

  • Hero Member
  • *****
  • Posts: 520
掷硬币序列
« Reply #4 on: 十一月 08, 2004, 04:24:47 pm »
Did B choose his sequence after he saw A's sequence, or they choose independently?

Elixir

  • Jr. Member
  • **
  • Posts: 32
掷硬币序列
« Reply #5 on: 十一月 08, 2004, 05:30:32 pm »
Deleted my garbage

Elixir

  • Jr. Member
  • **
  • Posts: 32
掷硬币序列
« Reply #6 on: 十一月 08, 2004, 06:01:09 pm »
Delete my garbage

fzy

  • Hero Member
  • *****
  • Posts: 520
掷硬币序列
« Reply #7 on: 十一月 08, 2004, 06:11:35 pm »
1) For the sequeces given (A: PNN, B: PPN), the winning ratio is 1:2.

Among the four possible results following a P, A wins NN, B wins PN and PP. Nobody wins for NP.

2) A wins 1/16 of the time (Sequence starts with PPPP). B and C split the rest 5:4.

Among the 8 results following an NP, C wins NPN, B wins PPP and 1/4 of NPP. Nobody wins for the rest.

3) Not sure there is a simple way. The winning sequeces go in circles: PPN beats PNN beats NNP beets NPP beats PPN.

idiot94

  • Sr. Member
  • ****
  • Posts: 484
掷硬币序列
« Reply #8 on: 十一月 09, 2004, 09:18:31 am »
lol ... now I see the point... oops, actually iti s interesting :)
In general, the men of lower intelligence won out. Afraid of of their own shortcomings ... they boldly moved into action. Their enemies, ...  thought there was no need to take by action what they could win by their brains. Thucydides, History

warren

  • Full Member
  • ***
  • Posts: 148
掷硬币序列
« Reply #9 on: 十一月 10, 2004, 08:38:56 pm »
Quote from: fzy
Did B choose his sequence after he saw A's sequence, or they choose independently?


If B choose his sequence after he saw A's sequence, it's unfair to A since B could always choose a sequence in favor of B if the lengths of the chosen sequences were the same.

warren

  • Full Member
  • ***
  • Posts: 148
掷硬币序列
« Reply #10 on: 十一月 10, 2004, 08:50:36 pm »
Quote from: fzy

3) Not sure there is a simple way. The winning sequeces go in circles: PPN beats PNN beats NNP beets NPP beats PPN.


There are some general algorithms to compute the probabilities, even apply to  situations when lengths of chosen sequences are unequal.

warren

  • Full Member
  • ***
  • Posts: 148
掷硬币序列
« Reply #11 on: 十一月 15, 2004, 06:27:26 pm »
Is there anyone be working on this problem? There is a simple and wonderful general method to calculate the probabilities.

idiot94

  • Sr. Member
  • ****
  • Posts: 484
掷硬币序列
« Reply #12 on: 十一月 16, 2004, 09:09:37 am »
LoL .. .I am rather waiting for the sunshine of your wisdom, buddy :)
In general, the men of lower intelligence won out. Afraid of of their own shortcomings ... they boldly moved into action. Their enemies, ...  thought there was no need to take by action what they could win by their brains. Thucydides, History

Elixir

  • Jr. Member
  • **
  • Posts: 32
掷硬币序列
« Reply #13 on: 十一月 17, 2004, 11:13:42 am »
Quote from: warren
Is there anyone be working on this problem? There is a simple and wonderful general method to calculate the probabilities.


I cannot figure out a simple and wonderful method, but with the help of Mathematica, the following small program can compute the probability in a split second.

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]]);

To use, just type, e.g. coin["PPN", "PNN"]
It handles 2 players with sequences of same or different lengths and can be augmented to handle n players.

万精油

  • Administrator
  • Hero Member
  • *****
  • Posts: 1830
掷硬币序列
« Reply #14 on: 十一月 17, 2004, 05:05:44 pm »
Code: [Select]
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.