A new feature for MageBot - POKER!

MageKing177 years ago

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!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 &gt; 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:[quote]&lt;!MageKing17&gt; Poker.
&lt;+MageBot&gt; 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.
&lt;!MageKing17&gt; Ante 5.
&lt;+MageBot&gt; MageKing17 kicks things off by anteing 5 chips!
&lt;+MageBot&gt; It appears MageKing17 has no friends; with no other antes within 60 seconds, MageKing17's ante of 5 chips is returned.
&lt;!MageKing17&gt; Ante 5.
&lt;+MageBot&gt; MageKing17 kicks things off by anteing 5 chips!
&lt;!MageKing17&gt; Poker.
&lt;+MageBot&gt; MageKing17: You are the only person playing right now, and have 95 chips. A hand cannot begin without at least two players.
&lt;+MageBot&gt; It appears MageKing17 has no friends; with no other antes within 60 seconds, MageKing17's ante of 5 chips is returned.
&lt;%Shingo&gt; Poker.
&lt;+MageBot&gt; Shingo has joined the game with 100 chips!
&lt;%Shingo&gt; Ante 5.
&lt;+MageBot&gt; Shingo kicks things off by anteing 5 chips!
&lt;!MageKing17&gt; Ante 5.
&lt;+MageBot&gt; MageKing17 matches the ante of 5 chips. The pot is now 10 chips.
-MageBot- Your hand: K D and 3 S
&lt;+MageBot&gt; Betting will now begin, starting with Shingo.
&lt;%Shingo&gt; Check.
&lt;+MageBot&gt; Shingo checks.
&lt;+MageBot&gt; MageKing17, it's now your turn to bet (current bet: 5).
&lt;!MageKing17&gt; Raise 2.
&lt;+MageBot&gt; MageKing17 raises to 7! The pot is now 12 chips.
&lt;+MageBot&gt; Shingo, it's now your turn to bet (current bet: 7).
&lt;%Shingo&gt; Call.
&lt;+MageBot&gt; Shingo calls. The pot is now 14 chips.
&lt;+MageBot&gt; Drawing communal cards... 5 S, 10H, 4 S. Betting shall commence once more, starting with SHINGO.
&lt;!MageKing17&gt; Poker.
&lt;+MageBot&gt; 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. [i](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.)[/i]
&lt;%Shingo&gt; Check.
&lt;+MageBot&gt; Shingo checks.
&lt;+MageBot&gt; MageKing17, it's now your turn to bet (current bet: 7).
&lt;!MageKing17&gt; Raise 2.
&lt;+MageBot&gt; MageKing17 raises to 9! The pot is now 16 chips.
&lt;+MageBot&gt; Shingo, it's now your turn to bet (current bet: 9).
&lt;!MageKing17&gt; BTW, I'm putting a log of this on the instantkingdom forums to show off the new stuff.
&lt;!MageKing17&gt; So MageBot, you'd better not crash. :P
&lt;!MageKing17&gt; I think I'll also need a function to remind me of my hand, because I can't remember. &gt;.&lt;
&lt;%Shingo&gt; Poker.
&lt;+MageBot&gt; 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.
&lt;%Shingo&gt; Check.
&lt;+MageBot&gt; Shingo: You haven't matched the current bet, so you can't check (try "call" instead).
&lt;!MageKing17&gt; Poker.
&lt;+MageBot&gt; 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.
&lt;%Shingo&gt; Poker.
&lt;+MageBot&gt; 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.
&lt;%Shingo&gt; Ah.
&lt;%Shingo&gt; Check.
&lt;+MageBot&gt; Shingo: You haven't matched the current bet, so you can't check (try "call" instead).
&lt;%Shingo&gt; Call.
&lt;+MageBot&gt; Shingo calls. The pot is now 18 chips.
&lt;+MageBot&gt; Drawing another communal card. The communal cards are now 5 S, 10H, 4 S, 2 D. Betting shall restart with SHINGO.
&lt;%Shingo&gt; &gt;&lt;
&lt;%Shingo&gt; Check.
&lt;+MageBot&gt; Shingo checks.
&lt;+MageBot&gt; MageKing17, it's now your turn to bet (current bet: 9).
&lt;!MageKing17&gt; Raise 1.
&lt;+MageBot&gt; MageKing17 raises to 10! The pot is now 19 chips.
&lt;+MageBot&gt; Shingo, it's now your turn to bet (current bet: 10).
&lt;%Shingo&gt; Raise 20.
&lt;+MageBot&gt; Shingo raises to 30! The pot is now 40 chips.
&lt;+MageBot&gt; MageKing17, it's now your turn to bet (current bet: 30).
&lt;!MageKing17&gt; Call.
&lt;+MageBot&gt; MageKing17 calls. The pot is now 60 chips.
&lt;+MageBot&gt; 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.
&lt;%Shingo&gt; Bet 7.
&lt;+MageBot&gt; Shingo: You can't bet lower than the current bet unless you're going all in.
&lt;%Shingo&gt; Oh, right.
&lt;%Shingo&gt; Check.
&lt;+MageBot&gt; Shingo checks.
&lt;+MageBot&gt; MageKing17, it's now your turn to bet (current bet: 30).
&lt;!MageKing17&gt; Raise 10.
&lt;+MageBot&gt; MageKing17 raises to 40! The pot is now 70 chips.
&lt;+MageBot&gt; Shingo, it's now your turn to bet (current bet: 40).
&lt;%Shingo&gt; All in.
&lt;+MageBot&gt; Shingo raises to 100! The pot is now 140 chips.
&lt;+MageBot&gt; MageKing17, it's now your turn to bet (current bet: 100).
&lt;!MageKing17&gt; All in.
&lt;%Shingo&gt; Hehe
&lt;+MageBot&gt; MageKing17 calls. The pot is now 200 chips.
&lt;+MageBot&gt; Showdown!
* MageBot has quit (Client closed connection)
&lt;!MageKing17&gt; Oh fuck.
&lt;%Shingo&gt; D'oh.[/quote]...Okay, so we're still working out bugs. But it will be awesome, I promise!

"MageKing17" said:So, I spent the night whipping up some code for a somewhat-bizarre not-fully-tested-and-probably-buggy feature: Texas hold 'em poker.

HOLD IT!

There's a contradiction in the witness' testimony!

But yeah, on a purely coding point of view, nicely done.[quote="MageKing17"][b]it will be awesome, I promise![/b][/quote]
[quote="MageKing17"]So, I spent the night whipping up some code for a somewhat-bizarre not-fully-tested-and-probably-buggy feature: [b]Texas hold 'em poker[/b].[/quote]
[size=200]HOLD IT![/size]
There's a contradiction in the witness' testimony! :P
But yeah, on a purely coding point of view, nicely done.

"Grim Reaper" said:But yeah, on a purely coding point of view, nicely done.

Yeah, and before I went to bed, we even got it to handle a showdown properly.

Of course, it didn't eject the player who busted on all their chips from the game, which is kinda silly, but whatever. I can fix it later. [quote="Grim Reaper"]There's a contradiction in the witness' testimony! :P[/quote]I like Red Dead Redemption, okay?
[quote="Grim Reaper"]But yeah, on a purely coding point of view, nicely done.[/quote]Yeah, and before I went to bed, we even got it to handle a showdown properly. :P
Of course, it didn't eject the player who busted on all their chips from the game, which is kinda silly, but whatever. I can fix it later. :P

"MageKing17" said:Of course, it didn't eject the player who busted on all their chips from the game, which is kinda silly, but whatever. I can fix it later.

*you bet 9001 chips*"E_net4 now has -8742 chips!"I know it doesn't happen, but how fun would it be?[quote="MageKing17"]Of course, it didn't eject the player who busted on all their chips from the game, which is kinda silly, but whatever. I can fix it later. :P[/quote]
*you bet 9001 chips*
"E_net4 now has -8742 chips!"
I know it doesn't happen, but how fun would it be?

"MageKing17" said:Of course, it didn't eject the player who busted on all their chips from the game, which is kinda silly, but whatever. I can fix it later.

*you bet 9001 chips*"E_net4 now has -8742 chips!"I know it doesn't happen, but how fun would it be?

Not very fun. Going all-in or forcing other people to go all-in is an important part of poker strategy.[quote="E_net4"][quote="MageKing17"]Of course, it didn't eject the player who busted on all their chips from the game, which is kinda silly, but whatever. I can fix it later. :P[/quote]
*you bet 9001 chips*
"E_net4 now has -8742 chips!"
I know it doesn't happen, but how fun would it be?[/quote]Not very fun. Going all-in or forcing other people to go all-in is an important part of poker strategy.

"MageKing17" said:Of course, it didn't eject the player who busted on all their chips from the game, which is kinda silly, but whatever. I can fix it later.

*you bet 9001 chips*"E_net4 now has -8742 chips!"I know it doesn't happen, but how fun would it be?

Not very fun. Going all-in or forcing other people to go all-in is an important part of poker strategy.

Not that there's much strategy right now when you can just re-join as soon as you bust out...

I don't want to implement a "global" chip-tracking system, but what other way to introduce... well, caution is there?[quote="Amarth"][quote="E_net4"][quote="MageKing17"]Of course, it didn't eject the player who busted on all their chips from the game, which is kinda silly, but whatever. I can fix it later. :P[/quote]
*you bet 9001 chips*
"E_net4 now has -8742 chips!"
I know it doesn't happen, but how fun would it be?[/quote]Not very fun. Going all-in or forcing other people to go all-in is an important part of poker strategy.[/quote]Not that there's much strategy right now when you can just re-join as soon as you bust out...
I don't want to implement a "global" chip-tracking system, but what other way to introduce... well, [i]caution[/i] is there?

"Murska" said:If you bust, you get banned from the channel for a few hours?

That's a terrible idea.

Unable to play poker for a few hours, maybe. But not banned from the channel.[quote="Murska"]If you bust, you get banned from the channel for a few hours? :P[/quote]That's a terrible idea.
Unable to play poker for a few hours, maybe. But not banned from the channel.

Unable to join this game while it's still going on?Separate playing rooms? (Losers join a new room with filled back chips)Unable to join this game while it's still going on?
Separate playing rooms? (Losers join a new room with filled back chips)

He already implemented a game ban of 1 hour for those who get busted.But indeed, we might need a separate chatroom for playing poker.He already implemented a game ban of 1 hour for those who get busted.
But indeed, we might need a separate chatroom for playing poker.

That would be a terrible system. One of the whole points of poker is that new people can bring more chips to the table at any time.[quote="Venom31"]Unable to join this game while it's still going on?[/quote]That would be a terrible system. One of the whole points of poker is that new people can bring more chips to the table at any time.

Doesn't MageBot already keep track of usernames, IIRC? You could just keep track of all of the current game's players and losers, and if someone who lost the current game really wants to rejoin after, say, one or two rounds (I no knows me terminologies for poker), they can be voted in.Doesn't MageBot already keep track of usernames, IIRC? You could just keep track of all of the current game's players and losers, and if someone who lost the current game really wants to rejoin after, say, one or two rounds (I no knows me terminologies for poker), they can be voted in.

"Anonymous1157" said:Doesn't MageBot already keep track of usernames, IIRC? You could just keep track of all of the current game's players and losers, and if someone who lost the current game really wants to rejoin after, say, one or two rounds (I no knows me terminologies for poker), they can be voted in.

No. The hour-long ban system stays. I'm too lazy to do something else.[quote="Anonymous1157"]Doesn't MageBot already keep track of usernames, IIRC? You could just keep track of all of the current game's players and losers, and if someone who lost the current game really wants to rejoin after, say, one or two rounds (I no knows me terminologies for poker), they can be voted in.[/quote]No. The hour-long ban system stays. I'm too lazy to do something else.