**-**

*Objective*In this activity you will design a framework capable of solving any puzzle of a specific type and, as a test of this framework, use the framework to solve a very simple puzzle. In this first activity, you are mainly concerned with the design of the framework. The term framework means a set of classes that enable implementation of solutions to certain problems. However, the framework by itself is not a complete program. You will work with abstract notions such as configuration, goal, and find-next-configuration. The problem solver should be able to solve any problem that conforms to an interface that you develop in your design. Think carefully about this interface, as you will also have to write classes that conform to it to solve the four problems (as of now only three are given, and the fourth would be given just few days before - to be integrated in the remaining time).

Your design document is a text file that contains a description of the framework that will solve puzzles. It should include a description of the classes and the public methods that the client uses to solve puzzles. This description should explain how the solver will solve puzzles.

__It is important to realize that the solver must be capable of solving any puzzle and must contain all of the puzzle-solving machinery.__

**The individual puzzles should not contain any puzzle-solving machinery but only contain methods implementing the rules for a particular puzzle.**You do not need to design a general puzzle rule mechanism as each puzzle can explicitly code the possible successor states to any (legal) puzzle configuration.These are three different puzzle problems as 1, 2 & 3.

__Problem 1__: A clock' batteries have gone bad and thats why the clock is showing wrong time (slowed down time) when compared to the current time. The clock only has hour hand and if the current time is 4 and the true time is 12, we need to turn the hour hand to make it 12. The objective is to find the shortest number of moves for the hour hand at 4 to show 12. In this case, which is, 4 moves (instead of 8 moves when going the other way from 4 to 5, then 5 to 6...and so on from 11 to 12).

__Problem 2__: This puzzle has four entities and they are Carpenter, Wolf, Goose and Corn. All of them have to cross a river and there is only one boat which can carry atmost 2 entities at any point in time. Of course, if the wolf is left alone with the goose and also, if the goose is left alone with the corn both of them with eat the latter. The objective here is to allow all four of them cross the river unharmed.

__Problem 3__: This is a one-person game played on a rectangular grid of lamps which can be turned on and off. A move consists of flipping a "switch" inside one of the squares, thereby toggling the on/off state of this and all four vertically and horizontally adjacent squares. The goal of this problem is to find a way to wind up with a specific number of lights turned on, while keeping in mind that you are "forbidden" to turn certain lights on or off. Sort of a similar problem is defined here http://mathworld.wolfram.com/LightsOutPuzzle.html.

*This is what I have thought about the solution till this point -*There will be a base class which will create a tree to store objects of a particular problem (for e.g. prob 1).. I am using tree here because the problem could have multiple solutions and we need to provide all solutions to the given problem

There will be a config file which will have all possible states for a particular problem such as all possible states for problem 1 would be 12 (or states) 1, 2, 3….to 12. All possible states for problem 2 would be different combinations for carpenter ( ca), goose (g), wolf (w) and corn (c ) such as initial state would be (ca, g, w, c). Next valid state could be (w, c) if the ca takes the g to the other side of the river and so on.

We only have to solve one problem at one execution of the program. Given an initial state for a specific problem the base class' goal would be to find the goal (or target state). Assuming for pblm 1 the current time is 4 and true time is 12 then these are initial and target states. For pblm 2, target state would be (-, -, -, -) i.e. none of the entities are present on this side of the river.

There will be a rules file, which the base class will use to check if the next state (generated by the base class) is actually valid according to the problem specifications or not. Assuming for pblm1, the current time is 4 and true time is 12 then we can either move right i.e. from 4 to 5, 5 to 6..and so on from 11 to 12 OR we can move left i.e. 4 to 3, and so on from 1 to 12.. the rules file will ensure that either we'll chose left or right we are only allowed to move one unit i.e. 4 to 5 or 4 to 3..not 4 to 6 or 4 to 2. Similarly for pblm2, it will make sure that goose and corn are not left behind on any side of the river un-attended..

I am not sure after that.. still thinking..

__I am not looking for any implementations or anything of that sort. However, any hints to the possible approaches for the framework design will be of great help__. I have not worked on any framework design ever before.

__Any url's for the framework design will also be of help. I am searching online also but till now I could not find any specific help online regarding the design approaches.__

Please help.