Anonymous user
Penney's game: Difference between revisions
m
no edit summary
Thundergnat (talk | contribs) (Revert several unexplained deletions of the phrase "Rosetta Code" from several examples) |
mNo edit summary |
||
Line 1:
{{task|Games}}
[[wp:Penney's_game|Penney's game]]
It is common to agree on a sequence length of three then one player will openly choose a sequence, for example:
Heads, Tails, Heads, or '''HTH''' for
The other player on seeing the first players choice will choose his sequence. The coin is tossed and the first player to see his sequence in the sequence of coin tosses wins.▼
▲The coin is tossed and the first player to see his sequence in the sequence of coin tosses wins.
;Example:
One player might choose the sequence
Successive coin tosses of
;Task
Create a program that tosses the coin, keeps score and plays Penney's game against a human opponent.
<br>
Line 28 ⟶ 25:
;See also
*
*
<br><br>
|