Go Back   Forums > Community Chatterbox > Blah, blah, blah...
Memberlist Forum Rules Today's Posts
Search Forums:
Click here to use Advanced Search

Reply
 
Thread Tools Display Modes
Old 02-12-2004, 01:01 AM   #1
Rogue
10 GOSUB Abandonia
20 GOTO 10
 
Rogue's Avatar

 
Join Date: Nov 2004
Location: Afrim, Albania
Posts: 2,113
Default

This code does not make much sense to me.

Here is what you have to do:
(pseudo code)

1. Make a function which will return index value in the cell for given row / column

2. Make a function which will return row / column for a given index

3. Make a function which will for column check where the top is and place a coin there

4. Check anywhere you have 4 cells horizontally that mach

5. Check anywhere you have 4 cells vertically that mach

6. Check anywhere you have 4 cells up diagonal that mach

7. Check anywhere you have 4 cells down diagonal that mach

8. Check if all fields are used

9. Make a function that checks steps 4 - 7 and then give a winner, move to next player, or if all fields are used (draw).


Details:

STEP 3
Check top value for that column ( using function in step 2, eg col 1, row 5)
-- if is filled: don’t allow to place piece there (message)
-- if is empty, check next one (-8)
Loop this way till you don’t place a coin on the bottom.

STEP 4

Create loop for Column 0 – 3
-- Create loop for Rows 0 - 5
----Check if CP (Current position), CP + 1 , CP + 2 and CP + 3 are the same
------If yes, we have a winner


STEP 5

Create loop for Columns 0 – 7
-- Create loop for Rows 0 - 2
----Check if CP (Current position), CP + 7 , CP + 14 and CP + 21 are the same
------If yes, we have a winner

STEP 6

Create loop for Column 0 – 3
-- Create loop for Rows 0 - 2
----Check if CP (Current position), CP + 8 , CP + 16 and CP + 24 are the same
------If yes, we have a winner

STEP 7

Create loop for Column 3 – 6
-- Create loop for Rows 3 - 5
----Check if CP (Current position), CP - 8 , CP - 16 and CP - 24 are the same
------If yes, we have a winner

STEP 8

Run separate functions similar to step 3 where you’ll find top for each column. If you have 7 hits and you at this step, then it’s draw

STEP 9

Just to make it easy, functions which incorporates steps 4 – 8

If you follow this pseudo code, it should be a piece of cake to make this program.
Rogue is offline                         Send a private message to Rogue
Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual problem in all dos games rkrd Troubleshooting 6 07-12-2007 09:43 PM
AdLib Visual Composer crazedloon Gaming Zone 1 20-09-2007 11:30 AM
Damn It punch999 Blah, blah, blah... 2 01-07-2007 06:39 PM
Visual Basic, Helpme! hotty_green Programming 7 19-07-2006 06:39 PM
Visual Basic tomf Programming 11 05-03-2006 10:35 PM


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump
 


The current time is 06:39 AM (GMT)

 
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.