So, I spent the night whipping up some code for a somewhat-bizarre not-fully-tested-and-probably-buggy feature: Texas hold 'em poker. It's fairly intuitive (saying "call" calls, saying "check" checks, saying "raise 10" raises the bet by 10, saying "fold" folds, et cetera). The only unintuitive things are how to force a deal of the hand when there are some people who are "in game" but not anted (a majority > 50% of the players that have anted must say "start"), taking that back ("don't start"), and quitting the game (which basically deletes your chip total and makes it so people don't have to vote to start the game with the "start" command), which is done by saying "I'm done".
Here's a quick log to demonstrate:<!MageKing17> Poker. <+MageBot> A game of Texas hold 'em poker has begun! Players start with 100 chips. Players can join at any time; two players are required for a hand to start. To start a hand, one player must ante. Any other players wishing to participate must also ante. Play will proceed in the order that players anted. Once all players have anted (or a majority of the participating players have voted to start), the hand begins. <!MageKing17> Ante 5. <+MageBot> MageKing17 kicks things off by anteing 5 chips! <+MageBot> It appears MageKing17 has no friends; with no other antes within 60 seconds, MageKing17's ante of 5 chips is returned. <!MageKing17> Ante 5. <+MageBot> MageKing17 kicks things off by anteing 5 chips! <!MageKing17> Poker. <+MageBot> MageKing17: You are the only person playing right now, and have 95 chips. A hand cannot begin without at least two players. <+MageBot> It appears MageKing17 has no friends; with no other antes within 60 seconds, MageKing17's ante of 5 chips is returned. <%Shingo> Poker. <+MageBot> Shingo has joined the game with 100 chips! <%Shingo> Ante 5. <+MageBot> Shingo kicks things off by anteing 5 chips! <!MageKing17> Ante 5. <+MageBot> MageKing17 matches the ante of 5 chips. The pot is now 10 chips. -MageBot- Your hand: K D and 3 S <+MageBot> Betting will now begin, starting with Shingo. <%Shingo> Check. <+MageBot> Shingo checks. <+MageBot> MageKing17, it's now your turn to bet (current bet: 5). <!MageKing17> Raise 2. <+MageBot> MageKing17 raises to 7! The pot is now 12 chips. <+MageBot> Shingo, it's now your turn to bet (current bet: 7). <%Shingo> Call. <+MageBot> Shingo calls. The pot is now 14 chips. <+MageBot> Drawing communal cards... 5 S, 10H, 4 S. Betting shall commence once more, starting with SHINGO. <!MageKing17> Poker. <+MageBot> MageKing17: The pot has 14 chips in it. Shingo (93 chips, bet 7) and you (93 chips, bet 7)are participating in this hand. are also playing. The communal cards are 5 S, 10H, and 4 S, . The current bet is 7. (As you can see, he still has a couple bugs to be worked out. The problems here are a missing space, a lack of a conditional check for whether or not there are players outside this hand, and fucking up with displaying the communal cards.) <%Shingo> Check. <+MageBot> Shingo checks. <+MageBot> MageKing17, it's now your turn to bet (current bet: 7). <!MageKing17> Raise 2. <+MageBot> MageKing17 raises to 9! The pot is now 16 chips. <+MageBot> Shingo, it's now your turn to bet (current bet: 9). <!MageKing17> BTW, I'm putting a log of this on the instantkingdom forums to show off the new stuff. <!MageKing17> So MageBot, you'd better not crash. <!MageKing17> I think I'll also need a function to remind me of my hand, because I can't remember. >.< <%Shingo> Poker. <+MageBot> Shingo: The pot has 16 chips in it. You (93 chips, bet 7) and MageKing17 (91 chips, bet 9)are participating in this hand. are also playing. The communal cards are 5 S, 10H, and 4 S, . The current bet is 9. <%Shingo> Check. <+MageBot> Shingo: You haven't matched the current bet, so you can't check (try "call" instead). <!MageKing17> Poker. <+MageBot> MageKing17: The pot has 16 chips in it. Shingo (93 chips, bet 7) and you (91 chips, bet 9)are participating in this hand. are also playing. The communal cards are 5 S, 10H, and 4 S, . The current bet is 9. <%Shingo> Poker. <+MageBot> Shingo: The pot has 16 chips in it. You (93 chips, bet 7) and MageKing17 (91 chips, bet 9)are participating in this hand. are also playing. The communal cards are 5 S, 10H, and 4 S, . The current bet is 9. <%Shingo> Ah. <%Shingo> Check. <+MageBot> Shingo: You haven't matched the current bet, so you can't check (try "call" instead). <%Shingo> Call. <+MageBot> Shingo calls. The pot is now 18 chips. <+MageBot> Drawing another communal card. The communal cards are now 5 S, 10H, 4 S, 2 D. Betting shall restart with SHINGO. <%Shingo> >< <%Shingo> Check. <+MageBot> Shingo checks. <+MageBot> MageKing17, it's now your turn to bet (current bet: 9). <!MageKing17> Raise 1. <+MageBot> MageKing17 raises to 10! The pot is now 19 chips. <+MageBot> Shingo, it's now your turn to bet (current bet: 10). <%Shingo> Raise 20. <+MageBot> Shingo raises to 30! The pot is now 40 chips. <+MageBot> MageKing17, it's now your turn to bet (current bet: 30). <!MageKing17> Call. <+MageBot> MageKing17 calls. The pot is now 60 chips. <+MageBot> Drawing another communal card. The communal cards are now 5 S, 10H, 4 S, 2 D, 8 C. The final betting round shall start with SHINGO. <%Shingo> Bet 7. <+MageBot> Shingo: You can't bet lower than the current bet unless you're going all in. <%Shingo> Oh, right. <%Shingo> Check. <+MageBot> Shingo checks. <+MageBot> MageKing17, it's now your turn to bet (current bet: 30). <!MageKing17> Raise 10. <+MageBot> MageKing17 raises to 40! The pot is now 70 chips. <+MageBot> Shingo, it's now your turn to bet (current bet: 40). <%Shingo> All in. <+MageBot> Shingo raises to 100! The pot is now 140 chips. <+MageBot> MageKing17, it's now your turn to bet (current bet: 100). <!MageKing17> All in. <%Shingo> Hehe <+MageBot> MageKing17 calls. The pot is now 200 chips. <+MageBot> Showdown! * MageBot has quit (Client closed connection) <!MageKing17> Oh fuck. <%Shingo> D'oh. ...Okay, so we're still working out bugs. But it will be awesome, I promise!
|