Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14673
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.linkpendium.com!news.linkpendium.com!newspeer1.nac.net!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail |
|---|---|
| From | Dana <dana.onthebeach@hotmail.com> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: tossing a coin |
| Date | Wed, 29 May 2013 07:49:10 +0000 (UTC) |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <ko4btm$5th$1@smc.vnet.net> (permalink) |
| Lines | 54 |
| Organization | Time-Warner Telecom |
| NNTP-Posting-Date | 29 May 2013 07:50:29 GMT |
| NNTP-Posting-Host | 92898f62.news.twtelecom.net |
| X-Trace | DXC=doo]Pi0obND:^L5n5Q6mGEC_A=>8kQj6MMOj3YM9`=aH=LiKeSdD3WMEFiONJ7[GoFVhib[BV6OdA |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | csiph.com comp.soft-sys.math.mathematica:14673 |
Show key headers only | View raw
Hi. Here's just one of a few ways.
In this small example, person #2 had his pattern start at position #6.
One would probably want to have a sample larger than 30 thou.
// represent flips of a coin
k=StringJoin@@RandomChoice[{"h","t"},30]
tthtthththhhttthhhhhtttththttt
StringPosition[k,"hhtt"][[1,1]]
11
StringPosition[k,"htht"][[1,1]]
6
= = = = = = = = = =
HTH :>)
Dana DeLouis
Mac & Mathematica 9
= = = = = = = = = =
On Sunday, May 26, 2013 4:39:04 AM UTC-4, michael partensky wrote:
> Hi everybody!
>
> Here is a classical problem:
>
>
> A and B take turns flipping a coin. H and T designate "heads" and "tails"
>
> respectively.
>
> Each of them chooses a pattern. Say, A picks HHTT and B picks HTHT (the
>
> length of the fragment may vary). One wins if his pattern appears before
>
> the pattern of his opponent.
>
>
> For any two patterns we have to find the answer *experimentally (by
>
> producing many random sequences and computing the frequencies of wins)*.
>
> What would be the most elegant way of detecting the first appearance of a
>
> pattern ?
>
>
>
> Thanks,
>
> Michael Partenskii
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: tossing a coin Dana <dana.onthebeach@hotmail.com> - 2013-05-29 07:49 +0000
csiph-web