View Single Post
 
Help checking a grid
Reply
Posted 2006-02-09, 02:29 PM
I have a grid that I need to check to see if a path of like colors exists from left to right or top to bottom. The buttons will be changed from white to blue or red.

The path does not have to be straight. i.e. the following path is fine.

XXXXXX
XXXXXX
XXXXXX
XXXXXX
XXXXXX
XXXXXX

Also, please note that, since the grid is actually composed of hexagons, more paths exist than simply the linear ones like in the previous example.

For example:

If you had a path that ran almost all the way from left to right on the bottom row
grid(0,5), grid(1,5), grid(2,5), grid(3,5), grid(4,5)
then having either grid(5,5) or grid(5,4) would result in a complete path. That's because grid(4,5) touches both grid(5,5) and grid(4,4).

The "color" of each button is stored into a 2-dimensional array grid(0,0) through grid(5,5) as red=1 and blue=2.

I tried hard-coding it, but the number of paths is just way too large.

Any ideas how how to go about this check?

I'm using VB05, but I can adapt any functionality that works.
Attached Images
File Type: jpg hexagon.JPG (64.6 KB, 2 views)
D3V said:
This message is hidden because D3V is on your ignore list.
What is it they say about silence being golden?

Last edited by Medieval Bob; 2006-02-09 at 02:37 PM.
Old
Profile PM WWW Search
Medieval Bob enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHzMedieval Bob enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHz
 
 
Medieval Bob