Local Network Texas Hold'em Poker with folders and applescripts

I set this up because I was becoming increasingly mythed about the lack of small and simple network games that can be played in an office environment without the risk of being sacked.

The idea is quite simple, though I will probably complicate things more than necessary, but here goes . . .

The idea is that all the players connect to a hard drive (or maybe a network server), on this drive is a folder called Poker that contains a number of subfolders. One subfolder is called Deck, this folder contains 52 images of each card in a standard deck. Each player has their own folder in the Players folder, and each players folder contains a Hand folder and a Chips folder. There is also a Community Cards folder which everyone can see. Layout of the folders for poker

At the start of a game, chips (image files again) are shared out into everyone's Chips folder. Then the Deal applescript is run by the dealer, this script first deals two player's cards to their Hand folder. A round of betting is made by dragging chips into the Pot folder and iChat Bonjour is used to announce what you are betting.

When everyone has bet, the Deal script is run again, this time dealing the first three cards to the Community Cards folder - this is followed by another round of betting.

After all the community cards are dealt and all the bets are made, there is the showdown via iChat, the winner drags the chips from the Pot to their own Chips folder and everyone drags their cards (not forgetting the community cards) back to the Deck ready for another game.

There is a little bit of set up involved. The Deal script needs to be opened in Script Editor and the possiblePlayers property set up with each players name. A folder for each player needs to be set up in Players (the name must match the name in the Deal script), each players folder needs to contain a folder called Hand and a folder called Chips (there is also a script in the Chips folder that can be double clicked and will add up the value of the chips in this folder).

The property theGame needs to be edited to provide the path to the Poker folder (this is an applescript path - /Volumes/ not required). There is another script which updates the name of a file called TOTAL - $0 in the Pot folder with the value of the chips in the pot. This script needs to be moved to /Library/Scripts/Folder Action Scripts/ and you will need to attach this as a folder action to the Pot folder.

I think that's about it. Leave a comment if it doesn't work or if I've missed anything and I will try and sort it out. Here's the download. Enjoy!

Poker.zip (4.1Mb)