Community Pick: Many members of our community have endorsed this article.
Editor's Choice: This article has been selected by our editors as an exceptional contribution.

Simple Games

Martin LissSocial distance - Wear a mask - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Almost 50 years of programming experience. Click '+ More' in my "Full Biography" to see links to some articles I've written.
Published:
Updated:
Here are a few simple, working, games that you can use as-is or as the basis for your own games.

Tic-Tac-Toe
This is one of the simplest of all games.
 Tic-Tac-Toe.zip

The game allows for a choice of who goes first and keeps track of the number of wins for each person. Here is a picture of the game in action.
 Two-Player game in actionThe following is a variation of the game that allows you to play against the computer (which can't be beaten).
 Tic-Tac-Toe-VS-CPU.zip

Hangman
Hangman is also a simple game but depending on the word you need to solve, it can be challenging. The words used are in a file called SecretWords.txt and it's included in the zip file. You can of course add to or delete words in the list.
 Hangman.zip

Here's a picture of the game in progress where the player is trying to solve the word 'elephant' and has incorrectly tried 'F'.
 Hangman in progressBlackjack
The 3rd and last game is blackjack which you can download from
here.

The programming for this game is more complex than the other two and here is what the game looks like.
 BlackjackThe game allows you to place a bet of any size up to the limit of your bankroll (which it shows you) and after you start the hand it gives you the chance to 'Hit', 'Stick', 'Double Down' (not shown). While the hand is in progress the game keeps track of your hand count (which in this case is 20) following the normal blackjack rule where an ace counts for either 1 or 11. Another rule it follows is that the dealer must continue to hit until his total is 17 or more.

The Options menu allows you to select the design for the back of the cards, the 'table' background color, the delay time between the dealing of each dealer's card, your starting bankroll, and the number of decks in play.

Finally, the following is a very stripped down version of the blackjack game which demonstrates how to use the card deck.
 Card-Deck.zip

It looks like this:
ml-Image1.jpg
If you find that this article has been helpful, please click the “thumb’s up” button below. Doing so lets me know what is valuable for EE members and provides direction for future articles. It also provides me with positive feedback in the form of a few points. Thanks!
4
6,197 Views
Martin LissSocial distance - Wear a mask - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Almost 50 years of programming experience. Click '+ More' in my "Full Biography" to see links to some articles I've written.

Comments (5)

The blackjack link is dead BTW
Martin LissSocial distance - Wear a mask - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018

Author

Commented:
Thanks for letting me know. I've corrected the link.
Andrew LeniartIT Professional | Freelance Journalist
CERTIFIED EXPERT
Author of the Year 2019
Distinguished Expert 2018

Commented:
1. Looks like a great learning tool Martin. Now all I need is to find an article that shows a total newb like me how to actually use the files inside the zip files to make the games run? <blush> ;)

2. When I tried to download the Blackjack game, I got this warning from Avast.
Avast Block
Detecting Malware in the URL.  Might want to host that on EE like the others.
Martin LissSocial distance - Wear a mask - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018

Author

Commented:
The "malware" may have been the ocx that contains the cards so here is one that should work.

To use the zip:
  1. Download it
  2. Right click on the file
  3. Choose "Extract All" or whatever shows up in your Windows OS
  4. After extraction, double-click on the VBP file

If you have any further problems please send me an EE message.
BJ-no-ocx.zip
Andrew LeniartIT Professional | Freelance Journalist
CERTIFIED EXPERT
Author of the Year 2019
Distinguished Expert 2018

Commented:
Many thanks Martin. Appreciate it! :)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.

Get access with a 7-day free trial.
You Belong in the World's Smartest IT Community