Sequencing things between current users... (1 Viewer)

Sergeant

Someone's gotta do it
Local time
Today, 13:18
Joined
Jan 4, 2003
Messages
638
I know that this is not what μSoft had in mind when they thought up Access, but...
I'm building a "Texas Hold'Em" game in Access.
Got most things to work OK, but am stuck on the betting rotation.

You have to pass the bet around, so my main "Play" form has fields "Bet" and "Pot" which are null until someone passes the bet to you. (The OnTimer event picks this up)
Here's my current approach:
Have subform on main form, set to next player's HandID, and when I see or raise the bet, it updates the record in the subform, and hence the next player's current record in their main form.
Where I start to lose it is if someone raises, the bet rotation needs to continue until everyone's paid up.
Can anyone see any better way of doing this?

Thanks,
Sarge.

p.s. Also thinking of logic in Play form so that if player has folded, the bet will be passed automatically to next player.
 

WayneRyan

AWF VIP
Local time
Today, 18:18
Joined
Nov 19, 2002
Messages
7,122
Hi Sarge,

Now you're getting somewhere!

Are you talking about multi-users over a network? That would be a
pretty interesting real-time project. I'd propose a back-end database:

Gotta have players (with money).

Code:
tblPlayers
==========
PlayerID - AutoNumber
PlayerName
PlayerPassword
PlayerBalance

Maintain a history of games.  A game is just a series of events, you
could track and replay any game.

tblGames
========
GameID - AutoNumber
GameTime - Date/Time of game

tblGameEvents
=============
EventID     - AutoNumber
GameID      - FK to tblGames
RoundID     - Integer Number of Betting round (1st - Antes/Blinds)
                                              (2nd - Flop)
                                              (3nd - Turn)
                                              (4nd - River)
EventTypeID - Fk to tblEventTypes
PlayerID    - FK to tblPlayers
EventTime   - Date/Time of event
EventAmount - Amount of transaction

The events that make up the above table are the antes/bets (including
folding) that players make during a game.

tblEventType
============
EventTypeID - AutoNumber
EventName   - (Ante, Check, Call, Raise, Fold)

In a multi-user environment, you'd have to provide a table to coordinate
the activity of all the players during a game.  Have to keep track of
which game, who's in it, who is sitting where, who has the deal, and most
importantly, who is the host!  One of the players has to actively record
the progress of the game by logging all of the game's events.

Since this has multiple participants, a table is the only means that the
front-ends stay in "synch".  

tblGameStatus
=============
GameStatusID   - AutoNumber
CurrentGame    - FK to tblGames(GameID), which game is in progress.
HostID         - Fk to tblPlayers(PlayerID), which user is "driving" the game.
CurrentDealer  - FK to tblPlayers(PlayerID), which user is dealing
NextToAct      - FK to tblPlayers(PlayerID), which user is next to act
CurrentPhase   - Text Variable for s/w to know order of things;
                      Ante/InitiateBetting, Flop, InitiateBetting, Turn, 
                      InitiateBetting, River, InitiateBetting
CurrentSeats(10) - Which Player is sitting at each of the 10 seats.
                   Repeating Group, but this is not a typical table.

Here's the answer to your question --> How they bet !!!!!!!!!!!!!

Use the GameEventTable:

The first player to bet for each betting round is assigned the Ante for
round 1; and 0 for the other rounds.

When a player is "up to bat", they owe the Amount Passed to them when
called minus their prior contributions for that round. If they own
nothing, and had the last $ transaction, the round is over. If it's
the last round the game is over.

If they call, they record the event, and pass on the amount they were
called with on to the next bettor.

If they raise, they record the event, and pass on the amount they were
called with, plus their raise, to the next bettor.

If they fold, they record the event, they forfeit all money in the pot
for that game, and pass the amount they were called with on to the next
better.

Interesting project.

Wayne
 

Sergeant

Someone's gotta do it
Local time
Today, 13:18
Joined
Jan 4, 2003
Messages
638
Thanks!

Wayne, to the rescue again. You are correct, the idea is to play on a network.
This is not the structure that I have at the moment, but I'll throw this together and go from there, as it takes care of some problems that I was 'about' to run into.

My main concern was 'How much data was being pulled across the network for each action, game, etc...'.
I have to use the OnTimer event to requery/refresh tblGameStatus for each player, right? That is the premise I am using. In my current version, I have a subfom that contains the game phase, and I refresh that OnTImer.

The thing I handled awkwardly was I didn't have a 'Master' (host)...I was trying to pass the deal and make the dealer the master each hand. Your way makes more sense. The first person to launch a new game would be the master, but what if he has to quit? Should I bother with a way to shift the Master status to the left?

Enough questions for one post, I'll start building it.

Sarge.
 

Sergeant

Someone's gotta do it
Local time
Today, 13:18
Joined
Jan 4, 2003
Messages
638
Wayne, would you care to elaborate on the 'CurrentSeats(10)' field?
It's not clickin' with me.

Also, do the relationships look right? (attachment)
Sarge.
 

Attachments

  • relationships.JPG
    relationships.JPG
    40.1 KB · Views: 97
Last edited:

WayneRyan

AWF VIP
Local time
Today, 18:18
Joined
Nov 19, 2002
Messages
7,122
Sarge,

The relationships look OK.

Since the host may quit, even during a hand, there must be a way
to define the state of the game.

tblGameStatus is just a central repository for the informaton that
defines the game. It is READ by all players to update their screens,
but only the host WRITES to it.

Code:
tblGameStatus
=============
GameStatusID   - AutoNumber
CurrentGame    - FK to tblGames(GameID), which game is in progress.
HostID         - Fk to tblPlayers(PlayerID), which user is "driving" the game.
CurrentDealer  - FK to tblPlayers(PlayerID), which user is dealing
NextToAct      - FK to tblPlayers(PlayerID), which user is next to act
CurrentPhase   - Text Variable for s/w to know order of things;
                      Ante/InitiateBetting, Flop, InitiateBetting, Turn, 
                      InitiateBetting, River, InitiateBetting, EndGame

CurrentSeats(10) - Which Player is sitting at each of the 10 seats.
                   Repeating Group, but this is not a typical table.
                   Basically, each seat represents a player.  This could
                   be a (10, 4) array ... or seperate arrays containing:

                   PlayerID --> Player occupying the seat
                   PlayerCard1 --> One hole card
                   PlayerCard2 --> Other hole card
                   PlayersStatus --> Active/Folded

If this app could store the above info in local variables, and reach out and
update the other players, the above table wouldn't be needed. As it stands,
it is a "persistent" definition of the game's status (Hosts come and go).

I wouldn't use a timer here though. The game is event driven with respect
to the players. The Host may initiate a betting round, but the host's
pc will poll each active player for their response (call/fold, etc.).
You might use a timer to automatically fold a player's hand if they don't
respond within a certain amount of time.

As far as network activity, poker is a slow game.

1) The host is logging one small event record every thirty seconds or so.
2) The host is updating the ONE record in tblGameStatus every thirty seconds or so.
3) A non-host front-end will update its status from tblGameStatus every thirty seconds or so.

Not very network intensive.

The code for the Host/OtherPlayers should be pretty interesting. The biggest
hurdle to me is the algorithm for the best "5 out of 7" cards.

It would be interesting to collect the game history and either:

1) Run stats on wins/losses, etc.
2) Write a "watch mode" utility that would recreate hand(s) from history.

Keep in touch,
Wayne
 

Sergeant

Someone's gotta do it
Local time
Today, 13:18
Joined
Jan 4, 2003
Messages
638
I wouldn't use a timer here though. The game is event driven with respect to the players. The Host may initiate a betting round, but the host's
pc will poll each active player for their response (call/fold, etc.).
Remember how I said I learn something new every day on this forum?
Because I've always built 'one user' db's, I never knew that data changed in a table would immediately show in a form that is open to that record. I thought you had to requery the table.
That changes everything.

Sarge.
 

carlnewboult

Registered User.
Local time
Today, 18:18
Joined
Sep 27, 2005
Messages
90
could someone post the completed program please as I would like to see this as I love poker.
 

Users who are viewing this thread

Top Bottom