leeroldy 0 Newbie Poster

I've decided to try my hand at programming neural networks since I'm in an adaptive critic course. The thing that I want to attempt is a solver for the game located here http://moh97.us/flow/. You basically have to connect like-colored circles together without crossing over any paths and while filling up all the empty squares with a path segment. I've been reading up on Hopfield Networks and I think this is the right network to use since I am essentially going to turn on or off a node (square) depending on these conditions to check:

1) Is square already filled?
2) Is there a preceding square, either to the left or right or above and below, that has the same color?
3) Is this square located either to the left or right or above and below the preceding square? Paths must contain straight line segements.

Those are the checks that I can think of thus far.
I'm trying to start with pseudo-code to try and help me. The problem I am having is figuring out how to run through all nodes, n^2 - c (where n = number of squares on an edge and c = number of colors), while keeping track of the state of each node. I'm thinking that I will have a (n^2 - c) x (n^2 - c) x c matrix. In each dimension c (1,2,3,...) I will have a summation of the penalties or rewards for each check 1,2,3. Am I correct in this logic?