1 / 5

CSC 7322 : Object Oriented Development J Paul Gibson, A207 paul.gibson@int-edu.eu

CSC 7322 : Object Oriented Development J Paul Gibson, A207 paul.gibson@int-edu.eu http://www-public. it-sudparis.eu /~gibson/Teaching/CSC7322/. The Water Jugs Problem …/~ gibson / Teaching /CSC7322/L14-TheWaterJugsProblem.pdf. A well - known instance of the problem. ??.

ayasha
Télécharger la présentation

CSC 7322 : Object Oriented Development J Paul Gibson, A207 paul.gibson@int-edu.eu

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 7322 : Object OrientedDevelopment J Paul Gibson, A207 paul.gibson@int-edu.eu http://www-public.it-sudparis.eu/~gibson/Teaching/CSC7322/ The Water JugsProblem …/~gibson/Teaching/CSC7322/L14-TheWaterJugsProblem.pdf TSP: Software Engineering

  2. A well-known instance of the problem ?? 8-5: 3 5 0 5-3: 3 2 3 3-8: 6 2 0 5-3: 6 0 2 8-5: 1 5 2 5-3: 1 4 3 3-1: 4 4 0 FIND A SEQUENCE OF MOVES (NOT NECESSARILY THE SHORTEST) THAT LEADS TO THE DESIRED OUTCOME (OF 4oz MEASURED) TSP: Software Engineering

  3. A ‘Formal’ Description of the Problem • Considerthreejugsthat (when full) measureintegerquantitiesx,y and z. • Startingwith 1 jug full, x say, measuresomequantity q in one of the 3 jugs by making a sequence of valid moves • A valid move pours water from one juginto the next, either: • Emptying the first jug, and perhapsfilling the second; or • Filling the second jug, and perhapsleavingsome water in the first. • Input, x,y,z,q • Output: sequence of moves leaving q in either x, y or z, • or an emptysequencewhen no solution is possible. TSP: Software Engineering

  4. Generalise the Problem Instead of 3 jugs, allow the system to containanynumber of jugs Extend the Problem Add a hose, providing an unlimitedsupply of water thatcanbeused to fillanyjugatany time (between moves) And/or Add a sinkthatcanbeused to emptyanyjugatany time (between moves) and where the water pouredawaycannotberecovered TSP: Software Engineering

  5. Implementing A Solution • Eachstudentis to choose 1 of the above variations, and write code thatmeets the requirements for the variation chosen. • Students are to share as much code as possible for: • Testing • Simulation FUTURE: Wewillre-engineeryour solutions in another OO programminglanguagesotry to makeyour code as good as possible for future ‘users’. TSP: Software Engineering

More Related