-
Aug 28th, 2014, 09:33 AM
#1
Thread Starter
Frenzied Member
Connect Four/Four in a Row game
Here's a simple Connect Four game written in Microsoft Visual Basic 6.0. The game has the following options:
-Set who plays first. (red or yellow)
-Whether one of the players is the computer, and if so, which color it plays with.
When the computer player is enabled, it used the following strategy:
1. Check if a winning move can be made.
2. If no winning move can be made, check whether the human player can make a winning move and block it.
3. If no moves have been made during steps 1 or 2, check whether an existing row can be made longer or make a random move without allowing the human player to make a winning move.
4. If no move was made during step 3, make a random move in an available slot regardless of other factors.
EDIT:
Mostly for the challenge, I decided to convert this game to Quick Basic, probably not very useful practically speaking, but interesting: http://www.vbforums.com/showthread.p...27#post5024127
Last edited by Peter Swinkels; Mar 27th, 2016 at 12:59 PM.
Reason: Cleaned the code.
-
Sep 1st, 2014, 03:56 PM
#2
Re: Connect Four/Four in a Row game
Nice one Peter, thanks for sharing.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|