Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Flow Game Solver

Name: Anonymous 2012-12-26 21:39

Heya fellas, I was just wondering if you could give me a push in the right direction with this simple program I'm writing.

So I downloaded this game, Flow, for my phone and I am unable to solve two of the puzzles. In essence, there is a square grid with two of multiple colors (two reds, two blues, etc.) that one must connect while filling up the entire grid and without crossing lines. My program will take any set-up of initial positions and colors and make the necessary movements, which are ones that MUST be taken, of course. As in this picture:
http://imgur.com/mo6D3

I'm now wondering how I should handle the brute force action that I have concluded to be the simplest way. Right now I have a  two dimensional array filled with structs that hold info like color, whether the block is either of the ends of the 'snake' that the colors make, and which directions the blocks have been entered from or exited from.

My idea right now is to make a vector of these arrays and push and pop different iterations of them until a single color is finished (the two ends are connected), then begin on the next. I realize this will take a lot of time for bigger grids.

Anything you guys could think of that may help me out here? I feel like I'm going about it the hard way.
Btw, I am programming in C++.

Name: Anonymous 2012-12-26 22:21

G -> B
R -> G
B -> R
B -> R... B->R ?
BR? BR! BR? BR? BR? BR! BR! BR. BR! BR? BR! BR. BR! BR! BR? BR? BR? BR? BR? BR! BR? BR. BR! BR?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List