I’ve authored a series for IBM developerWorks called 3d10 Game Scripts You Can Write With PHP. These scripts are simple utilities that can be used in various different types of games. I’ve provided working examples of the scripts linked below. To get the code for these scripts, you will have to view the Articles. Here is the link to Part One.
Part 1
- A Basic Die Roller – The working example of the simple die roller described in the article;
- Random Name Generator – Randomly generates alternating male and female names from a set list;
- Scenario Generator – Generates a basic RPG scenario from stock lists of situations;
- Deck Shuffler – Generates a basic 52 card deck and draws a random card;
- Odds Calculator : Card Draw – Given a pair of hands, calculates the odds of drawing a few specific cards;
- Simple Poker Dealer – Generates a deck, deals out five cards, and lets you pick which ones to get rid of;
- Hangman Generator – Creates a simple hangman game;
- Crossword Helper – Given a word of X length with Y known letters, provides some possibilities;
- Mad Libber – Creates a stock Mad Lib from a set list of words and a specific phrase;
- Lotto Picker – Looks at historical lotto picks (user entered) and specifies the 6 least picked numbers;
Part 2
- Damage Calculator – Create a table of weapons, and automatically calculate damage by each weapon
- Stat Tracker – Track basic character stats
- NPC Generator – Generate NPC characters automatically
- Odds Calculator : Die Roll – Work out the odds when rolling multiple dice
- Simple Blackjack Dealer – Practice playing Blackjack
- Card Counter – Use this as a basic Blackjack card counter
- Bingo Engine – Generate Bingo cards and draw numbers
- Jumble Helper – Unscramble a single word
- Substitution Cyphers – Create basic substitution cyphers
- Word Search Generator – Generate a Word Search automatically
Part 3
- Inventory Management – track inventory with your character
- Note Taker – take notes and track common terms
- ID Card Generator – use a template to create an ID card for your character
- Map Generator – dynamically generate a map for use in an RPG
- Poker Hand Evaluator – have a script evaluate your poker hand
- Slot Machine – Put together s simple slot machine
- Keno – try your hand at Keno
- Cryptogram Helper – get a little help solving the daily Cryptogram
- Mastermind – Play the old classic code breaking game
- Word Chains – create chains of words by changing one letter at a time
Hi there,
I have recently downloaded the Simple Blackjack Dealer from the IBM development website but I appear to be having a few problems fixing the bugs. Do you think you could upload an updated working copy or possibly email it to me? I will be most grateful,
Thanks
Can you indicate what bugs you are running into, or what problem you are having?
Whenever the player goes to hit I get this error
Warning: array_shift() [function.array-shift]: The argument should be an array in blackjack.php on line 80
And also when the player hits stay nothing happens, in the example on your site it shows what the dealer ended up getting.
Any help would be great!!
Thanks
sorry….forgot to say im working with the blackjack dealer!
I have the same problem with Dylan Martin. Can anyone help?
I’ve put up working text at http://aterribleidea.com/3d10/3d10-simple-blackjack-dealer.txt
Can you tell me more about what your problems are?
I am trying to create a simple php blackjack game. I can show the cards image, but I am stuck at the hit and stand part, I cant hit the card appearing with the dealercard and playercard together. This problem has troubled me a long time. Should I create $_Session varaible to store the dealercard and playercard?
Can I ask what is inside the the file of include.php?
thanks
The include.php file just has the links that appear at the top of the scripts. No functional code.
I seem to be having a problem with your blackjack script. For some reason I get:
Invalid argument supplied for foreach() on line 24. and then repeats:
array_shift() expects parameter 1 to be array, boolean given line 66
It seems to work locally when using Xampp, but not live on the net. (not sure if that helps).
When I echo $hand and $dealer, they both seem to be empty.
Somone suggested it might be the size post can pass, but I bumpted it up to 99 meg and still no go. (php5.3 I believe)
Any suggestions?