I didn't ask you to do my cw mr Mich Robinson ,what i wanted to know is an idea .....how to do this ,
if i want you to do my cw i'm not asking help . ill copy a code in the net and submit it.
i wanted to take and idea ...........
BUT THANXXXXXX A LOT FOR YOUR HELP
Joined: Jun 28, 2009
Alina Gilbard wrote:what i wanted to know is an idea
I assume you've done recursion and tree traversing - then the aim is to just try all the moves within a certain depth and see if you get a solution. If you do then the solution with the shortest depth is the best. If you don't then increase the depth. You'll need routines to try each move, a routine to check to see if the solution has been found, and something to remove the previous move.
Reading through the question I can't see why you're asked to store each move in a file - seems a bit pointless to me. I also couldn't see why you store the value "2/4" in the middle of the board state. I also couldn't see why you need to store everything in memory at the same time as surely you just store the current path through the tree rather than the whole tree. If you're doing it in Java then it would be nice to print the board position at each point so you can see the game being solved.
Does that give you any ideas?
Joined: Jun 28, 2009
When students post their homework up on the forum and ask for help without showing any effort on their own part then people will always get a annoyed. If you then change the text of your original post then it just makes all the following posts look out of place. Isn't your new question answered by my previous post?
I suggest you try setting up a puzzle where the solution is 2 moves away then step through the following pseudo code:
Mich Robinson has already given plenty of info to start with this problem.
Well only thing I would like to mention here is that to keep things tidy in your program, make sure you have a separate method to keep the legal moves on the side.
Alina....if I was you, I´ll put each image in ArrayList and make the methods to move each image......and after a valid movement I´ll use the method remove() 'the image of current position' of ArrayList and add the image and other position.........more or less in this.....