Jug Problem by C-language

Slides:



Advertisements
Similar presentations
More Miscellaneous Topics CS-2301 B-term More Miscellaneous Topics CS-2301, System Programming for Non-majors (Slides include materials from The.
Advertisements

Consecutive Numbers An Investigation.
Algebra1 Graphing Functions
Rational Expressions l Multiplying/Dividing l Adding/Subtracting l Complex Fractions.
11.1 Ratios and Proportions Solve proportions. Proportion – equates two ratios extreme mean This proportion is read as “a is to b as c is to d.” You must.
What are Ethics? An Introduction. Definition… “a branch of philosophy which seeks to address questions about morality; that is, about concepts like good.
Learning Goals: I will: understand the properties of different types of galaxies. understand how the universe came to be what we observe today. understand.
DATA STRUCTURES 1st exam solution. Question 1(1/3) Suppose we have the ADT Bag which has the following operations: bool isEmpty(): tests whether Bag is.
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Lecture 2 Debugging,
Advanced Higher Computing Science
Advancement Reporting From TroopMaster to ScoutNet
Using Sum and Product Method
The Scientific Method.
Year 5 - Numeracy Title page..
Knowledge Representation
Subtraction with Regrouping
Solving systems of equations
Objective The student will be able to:
Output “Funds not available”
Systems of Linear Equations
Final exam: Wednesday, March 20, 2:30pm
Programming Fundamentals
Fractions Adding Like Denominators
Programming Mehdi Bukhari.
Municipal Securities Rulemaking Board
Objective The student will be able to:
Warm-up (11/9) WS Day 3 out on desk, please
Prepared By: G.UshaRani B.Pranalini A.S.Lalitha
CLOSE Please YOUR LAPTOPS, and get out your note-taking materials.
Lesson 5: Epic Past Appointment Scheduling
Complete the missing numbers using the inverse.
CS 1302 Programming Principles II
SAP transaction RSA3 Enter the Data source Name
Systems of Equations in Two and Three Variables
Introduction to Programming
How to write an inquiry question
Page 14.
You may choose to use any one of these provide slide templates and make changes as desired.
You may choose to use any one of these provide slide templates and make changes as desired. 1.
Objective The student will be able to:
Objective The student will be able to:
PIMS Delete Utility September 21, 2016.
Resources and Inventory Managment
Linked Lists in C and C++
You may choose to use any one of these provide slide templates and make changes as desired.
You may choose to use any one of these provide slide templates and make changes as desired. 1.
Pre-calc w-up 10/21 simplify.
Jeopardy The Sexton Edition.
Factoring Polynomials.
CS 8532: Advanced Software Engineering
Activation records Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Backtracking with addition and subtraction
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Knowledge Representation
You may choose to use any one of these provide slide templates and make changes as desired. 1.
Graph Review Skills Needed Identify the relationship in the graph
You may choose to use any one of these provide slide templates and make changes as desired.
Basic Lessons 5 & 6 Mr. Kalmes.
АВЛИГАТАЙ ТЭМЦЭХ ҮНДЭСНИЙ ХӨТӨЛБӨР /танилцуулга/
Objective The student will be able to:
Jug problem.
75 previous answer What is of 37.5? ? go to.
You will have 15 seconds to view each stereogram
Factor Trinomials by Grouping
Title Cover Page You can add slides to print your title in larger text if needed but remove after. This page is for teacher and should not be on the board!
Warm-Up Study the patterns below to determine the next five numbers in each sequence. You may use the calculator to check your answers. 2, 4, 6, 8, 10...
Activation records Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
75 previous answer What is of 60? ? go to.
Ignite presentation - Title slide
missionaries-and-cannibals problem
Presentation transcript:

Jug Problem by C-language

Introduction There are many answers. Please think freely. This slide will provide only a flow of processes. And, this is just an example. It is one of the answers.

Overall Initialization Check Goal Status Y 繰り返し N Rule Execution Finish

Initialize In the initialize process, should be prepared. Variable (x,y), that means the water in the jugs. Array to record ”History of water in the jugs”. should be prepared.

Check Goal Status X=2 is the condition

Process of a rule Satisfy conditions of the rule? Calculate next jug status Move to next rule History check Yes Record current status to the history array, and back to the goal check. No Make all rules. Please don’t forget to display messages for recognize the process of the program.

Backtrack If any rule cannot be applied, it means that there are no next state from a current state. In this case, it should back the previous state by refering the history. A It can’t move next state from B. Back to state A and choose other branches. B

Miscellaneous “Missionaries and Cannibals” is almost same as the jug problem. (Conditions becomes a little complex and it need to add the rule for judgement whether missionaries are eaten by cannibals. ) Pointers and structs must not need. It is enough using for and while. Break and continue is very useful. (These may be must.)

advanced If you can, please consider to use “recursive” concept. The program will be elegant.