All,
I intentionally didn't explain too much about the game for a couple of reasons. The first is because I haven't finalized the rules in my variation of the game. The second is because I didn't want people to focus too much on the game but rather on the guessing algorithm. Thanks to a private /msg, I realize knowing more about the game play can affect an implementation of guess().
Turns and Control
Players alternate who has control each time a new target word is presented. The player with control keeps control until they have guessed the secret word or lose control due to a violation of the rules or the total number of guesses reaches five. Both opponents have visibility to all information about the secret word regardless of who obtained the information.
Losing Control For Too Many Guesses
For each secret word, there are a total of five guesses where control can be retained. This is not per-opponent but total for the secret word. If player 1 guesses three times and loses control to player 2, player 2 only has two guesses before losing control. Once there have been five guesses for a secret word, the first unknown letter in the secret word is filled in and control passes to the opponent. If the opponent is unable to guess the word, the next unknown letter is filled in an controll passes again. This continues until all but one of the secret letters is revealed. If both players fail to guess the word at this stage - the secret word is declared a draw.
Example Scenarios
- Player 1 has control and guesses the secret word in 3 guesses
- Player 2 gets control for the next secret word
- Player 1 mispells a word on the 3rd guess
- Player 2 gets control, sees everything player 1 did, and guesses the secret word
- Player 1 gets control for the next secret word
- Player 1 exceeds the time limit on the second guess
- Player 2 gets control and mispells a word on the 4th guess
- Player 1 regains control and guesses the secret word
- Player 2 gets control for the next secret word
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.