Anonymous user
Penney's game: Difference between revisions
m
added a ;See also: (bold) header, corrected a misspelling, added a Wiki link for "fair coin".
No edit summary |
m (added a ;See also: (bold) header, corrected a misspelling, added a Wiki link for "fair coin".) |
||
Line 1:
{{task|Games}}
[[wp: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 short.
The other player on seeing the first players choice will choose his sequence.
;Example:
;The Task:▼
One player might choose the sequence '''HHT''' and the other '''THT'''.
Successive coin tosses of '''HTTHT''' gives the win to the second player as the last three coin tosses are his sequence.
Create a program that tosses the coin, keeps score and plays Penney's game against a human opponent.
:* Who chooses and shows their sequence of three should be chosen randomly.
:* If going first, the computer should randomly choose its sequence of three
:* If going second, the computer should automatically play [[wp:Penney's_game#Analysis_of_the_three-bit_game|the optimum sequence]].
:* Successive coin tosses should be shown.
<br>
Show output of a game where the computer
;See also:
* [https://www.youtube.com/watch?v=OcYnlSenF04 The Penney Ante Part 1] (Video).
* [https://www.youtube.com/watch?v=U9wak7g5yQA The Penney Ante Part 2] (Video).
<br><br>
|