PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: ??']['??l? on 26 January, 2007, 14:25:42

Title: Texas Hold`em poker script...
Post by: ??']['??l? on 26 January, 2007, 14:25:42
Is it possible and can some of u scripters make a texas hold`em poker script...???

I wanna make a "casino" to my hub, including slotmachine and 3cardmonty...
But that poker would be the greatest... :)

It should be played in PM against the "poker bot" or in PM against the other players...

Some options which should include to this script...

1.Regular game against the bot
2.Multiplayer game against the other users...
3.Join command (for multiplayer game)
4.Leave command (for multiplayer game)
5.Play command (for game against the bot)
6.Deposit game money command (user from certain ip address can only deposit money once in 24h and that would be something like 1000$)
7.Show command (for topgamers, who got most money winned at that time...)
8.Only 10 users can join to the table at once (If the table is full they get sumkinda message like: Poker table is full...Try again later)
9.Only Vips and op profiles can play this game...
10.There would be a tournament once in a 24h to which u have to report yourself, but u don`t have to deposit money for it....
11.Tournament info would be displayed in mainchat(timer) like:
   
    ===Tournament starts at: 18:00
    ===U have 1h time to report yourself
    ===Theres 7 users joined and 3 free places left

If this is possible to do it would be greatest "fun" script ever... ;D ;D ;D
Title: Re: Texas Hold`em poker script...
Post by: CrazyGuy on 27 January, 2007, 01:50:49
This is to some extend certainly possible, but it will be a sh*tload of work  :P
I came across a template for a BlackJack game 1-7 players against a computer House/Dealer.
This is a C++ template, but I can try and convert it to lua.

Would that be something nice as a startup ? It will make it easier to plan other casino games from that.
I can take it from the template, then add things like user credit and such.

Will see if i can write BlackJack today  :)
Okay, I've made a blackjack game and added it here http://forum.ptokax.org/index.php?topic=6773.0 (http://forum.ptokax.org/index.php?topic=6773.0)

Note it's written in LUA 5.1.1 ( just saw your request is under 5.0.x)
Please add comments about the script in its own post :)
Title: Re: Texas Hold`em poker script...
Post by: Snooze on 27 January, 2007, 02:16:30
Told you already .. I freaking LOVE this game :)

Superb work in a really short time ... amazing!


-Snooze
Title: Re: Texas Hold`em poker script...
Post by: CrazyGuy on 28 January, 2007, 20:10:35
Okay, here I got something to show ya I haven't forgotten about the request.

A demo, game simulation, testing the dealing and scoring

Quote
[19:57:09] <PtokaX> Adding 7 test players
[19:57:09] <?Poker?> Player 1 has joined the table.
[19:57:09] <?Poker?> Player 2 has joined the table.
[19:57:09] <?Poker?> Player 3 has joined the table.
[19:57:09] <?Poker?> Player 4 has joined the table.
[19:57:09] <?Poker?> Player 5 has joined the table.
[19:57:09] <?Poker?> Player 6 has joined the table.
[19:57:09] <?Poker?> Player 7 has joined the table.
[19:57:09] <?Poker?> Table has joined the table.
[19:57:09] <?Poker?> Shuffeling deck...
[19:57:09] <PtokaX> Dealing each player 2 cards
[19:57:09] <PtokaX> Showing the players cards (DEBUG ONLY)
[19:57:09] <Player 1> 9h  Kh
[19:57:09] <Player 2> 10d  8s
[19:57:09] <Player 3> 4s  8c
[19:57:09] <Player 4> 8h  Js
[19:57:09] <Player 5> Kd  5h
[19:57:09] <Player 6> Jh  10s
[19:57:09] <Player 7> 3d  10c
[19:57:09] <?Poker?> The Dealer burns 1 card, and deals the flop
[19:57:09] <Table> 2h  2c  10h
[19:57:09] <?Poker?> The Dealer burns 1 card, and deals the turn
[19:57:09] <Table> 2h  2c  10h  Kc
[19:57:09] <?Poker?> The Dealer burns 1 card, and deals the river
[19:57:09] <Table> 2h  2c  10h  Kc  4h

[19:57:09] <?Poker?> Let's have a look at the hands
[19:57:09] <?Poker?> Player 1 -> Player has a Flush
[19:57:09] <?Poker?> Player 2 -> Player has 2 Pairs
[19:57:09] <?Poker?> Player 3 -> Player has 2 Pairs
[19:57:09] <?Poker?> Player 4 -> Player has 1 Pair
[19:57:09] <?Poker?> Player 5 -> Player has 2 Pairs
[19:57:09] <?Poker?> Player 6 -> Player has 2 Pairs
[19:57:09] <?Poker?> Player 7 -> Player has 2 Pairs
[19:57:09] <?Poker?> I'm sorry, I don't know who won this hand

It's a start ;D, will probably be 1 or 2 more days until i have it working correctly.
As you see, the dealer is not the smartest 1 yet  ;)

So now I'll look into adding players, setting up the game etc etc
Title: Re: Texas Hold`em poker script...
Post by: ??']['??l? on 29 January, 2007, 14:18:18
Looking great.... :)
You`re tha greatest... ;D
Can`t wait until it`s ready, i know that u get it work... :) :) :)
Title: Re: Texas Hold`em poker script...
Post by: CrazyGuy on 31 January, 2007, 23:26:19
Today's updates : The dealer should be all knowing now.
He/She can determine winning hands from a 7-player draw Royal Flush to a 7-Player crap card.

Quote


[01:45:42] <?Poker?> Shuffeling deck...
[01:45:42] <PtokaX> Dealing each player 2 cards
[01:45:42] <PtokaX> Showing the players cards (DEBUG ONLY)
[01:45:42] <Player 1> 8d  Kc
[01:45:42] <Player 2> 7c  As
[01:45:42] <Player 3> 4c  Qd
[01:45:42] <Player 4> 5c  10s
[01:45:42] <Player 5> 5h  8c
[01:45:42] <Player 6> Qc  2d
[01:45:42] <Player 7> 6d  6c
[01:45:42] <?Poker?> The Dealer burns 1 card, and deals the flop
[01:45:42] <Table> 10d  7h  8h
[01:45:42] <?Poker?> The Dealer burns 1 card, and deals the turn
[01:45:42] <Table> 10d  7h  8h  8s
[01:45:42] <?Poker?> The Dealer burns 1 card, and deals the river
[01:45:42] <Table> 10d  7h  8h  8s  Qh

[01:45:42] <?Poker?> Let's have a look at the hands
[01:45:42] <?Poker?> Player 1 has a 3 Of a Kind.   Highest hand: 888KQ
[01:45:42] <?Poker?> Player 2 has 2 Pairs.   Highest hand: 8877A
[01:45:42] <?Poker?> Player 3 has 2 Pairs.   Highest hand: QQ881
[01:45:42] <?Poker?> Player 4 has 2 Pairs.   Highest hand: 1188Q
[01:45:42] <?Poker?> Player 5 has a 3 Of a Kind.   Highest hand: 888Q1
[01:45:42] <?Poker?> Player 6 has 2 Pairs.   Highest hand: QQ881
[01:45:42] <?Poker?> Player 7 has 2 Pairs.   Highest hand: 8866Q
[01:45:42] <?Poker?> Player 1 has won this pot.

Quote


[01:45:40] <?Poker?> Shuffeling deck...
[01:45:40] <PtokaX> Dealing each player 2 cards
[01:45:40] <PtokaX> Showing the players cards (DEBUG ONLY)
[01:45:40] <Player 1> 10d  9s
[01:45:40] <Player 2> 6s  3s
[01:45:40] <Player 3> 2s  As
[01:45:40] <Player 4> 6h  5c
[01:45:40] <Player 5> 8c  10c
[01:45:40] <Player 6> 7d  Ac
[01:45:40] <Player 7> 6c  5d
[01:45:40] <?Poker?> The Dealer burns 1 card, and deals the flop
[01:45:40] <Table> Qh  9d  Ks
[01:45:40] <?Poker?> The Dealer burns 1 card, and deals the turn
[01:45:40] <Table> Qh  9d  Ks  3c
[01:45:40] <?Poker?> The Dealer burns 1 card, and deals the river
[01:45:40] <Table> Qh  9d  Ks  3c  4h

[01:45:40] <?Poker?> Let's have a look at the hands
[01:45:40] <?Poker?> Player 1 has 1 Pair.   Highest hand: 99KQ1
[01:45:40] <?Poker?> Player 2 has 1 Pair.   Highest hand: 33KQ9
[01:45:40] <?Poker?> Player 3 has nothing.   Highest hand: AKQ94
[01:45:40] <?Poker?> Player 4 has nothing.   Highest hand: KQ965
[01:45:40] <?Poker?> Player 5 has nothing.   Highest hand: KQ198
[01:45:40] <?Poker?> Player 6 has nothing.   Highest hand: AKQ97
[01:45:40] <?Poker?> Player 7 has nothing.   Highest hand: KQ965
[01:45:40] <?Poker?> Player 1 has won this pot.


So now that that looks good, I can spend 2morrow building the game.
I will add a report function for when the dealer panics and don't know the winner ( or determines a wrong winner )
It should all be fine, but you never know .. there's 633 lines of code checking who's won, a typo or a not properly defined rule can still give some small bugs

For now, we wish you a goodnight
I'm CrazyGuy, live from Vegas-Debug-Center in DC
for The PtokaX Portal
8) ::) :P
I've finished and uploaded the Texas Hold 'Em script here http://forum.ptokax.org/index.php?topic=6804.0 (http://forum.ptokax.org/index.php?topic=6804.0)
Reason I put it there is that officially it's a LUA 5.1.1 script, but it should run on LUA 5.0.3 as well

cheers  8)