Leap Frog game help

Hi everyone, I'm trying to do the leap frog game http://www.akidsmath.com/mathgames/leapfrog.htm
but my program will not provide user interaction, the computer has to find it's own path to the goal state by using DFS,

I'm using an array for my initial state 1 1 1 2 0 0 0 where 1s represent brown frogs and 0s represent green frogs and 2 is the blank space.

in order to do backtracking I need to store my array into a stuck
is this possible? how am I going to do this?
I mean at each POP I need to obtain one STATE, how can I do this? or any other suggestions to do this?

Thanks,

Asim
I need to store my array into a stuck
I can't figure out whether you meant "stack" or "struct". That's not really a problem, since you will probably want both.
If you write
1
2
3
struct Pond{
   int rock[7];
};
You can have your functions take Pond arguments and their contents will be copied.

I mean at each POP I need to obtain one STATE, how can I do this? or any other suggestions to do this?
Each function will have to return either the moves it made to win, or 0 if it failed. I suggest returning a linked list.
Topic archived. No new replies allowed.