SlideShare a Scribd company logo
Ahmed Nasser Saleh
Welcome 
PROBLEM STATEMENT
• A FARMER WITH HIS WOLF, GOAT, AND CABBAGE COME TO THE EDGE OF A
RIVER THEY WISH TO CROSS. THERE IS A BOAT AT THE RIVER’S EDGE, BUT, OF
COURSE, ONLY THE FARMER CAN ROW. THE BOAT ALSO CAN CARRY ONLY
TWO THINGS (INCLUDING THE ROWER) AT A TIME. IF THE WOLF IS EVER LEFT
ALONE WITH THE GOAT, THE WOLF WILL EAT THE GOAT; SIMILARLY, IF THE
GOAT IS LEFT ALONE WITH THE CABBAGE, THE GOAT WILL EAT THE CABBAGE.
WRITE A PROLOG TWO PROGRAMS TO FIND THE SEQUENCE OF CROSSINGS
OF THE RIVER SO THAT ALL FOUR CHARACTERS ARRIVE SAFELY ON THE
OTHER SIDE OF THE RIVER
The initial state and goal
state
Initial statue we start with state go(Farmer , left wolf , left goat , left cabbage , left wolf , left goat ,
left cabbage
And farmer will take value with 1 or 0 , zero mean the farmer is in the left side
and one mean that the farmer is in the right side
And the number of wolf , goat , cabbage in the left and in the right
The start state with all the farmer, wolf , cabbage and goat in the left side and the
goal state that all the number of farmer, wolf , cabbage and goat move to left.
All possible move
s.I can move to goat , cabbage , wolf to right or to the left but I can’t leave wolf with
goat without farmer and can’t leave goat with cabbage without also farmer .
So I will make all possible move .
so the Start state and the path :
:
Get Children of the node and add node to be visited and remov
e it function ::
Move State ::
The Moves and How To Print Solution
Thanks
I am sorry if there was any
Mistake .
CPR :: SNGV
ahmednasser1993@gmail.com

More Related Content

What's hot

Preparing your data for Machine Learning with Feature Scaling
Preparing your data for  Machine Learning with Feature ScalingPreparing your data for  Machine Learning with Feature Scaling
Preparing your data for Machine Learning with Feature Scaling
Rahul K Chauhan
 
AI search techniques
AI search techniquesAI search techniques
AI search techniques
Omar Isaid
 
Structure of agents
Structure of agentsStructure of agents
Structure of agents
MANJULA_AP
 
6 games
6 games6 games
6 games
Mhd Sb
 
1.1. the central concepts of automata theory
1.1. the central concepts of automata theory1.1. the central concepts of automata theory
1.1. the central concepts of automata theory
Sampath Kumar S
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representation
Amit Kumar Rathi
 
Naive Bayes Classifier | Naive Bayes Algorithm | Naive Bayes Classifier With ...
Naive Bayes Classifier | Naive Bayes Algorithm | Naive Bayes Classifier With ...Naive Bayes Classifier | Naive Bayes Algorithm | Naive Bayes Classifier With ...
Naive Bayes Classifier | Naive Bayes Algorithm | Naive Bayes Classifier With ...
Simplilearn
 
Expert systems Artificial Intelligence
Expert systems Artificial IntelligenceExpert systems Artificial Intelligence
Expert systems Artificial Intelligence
itti rehan
 
LALR Parser Presentation ppt
LALR Parser Presentation pptLALR Parser Presentation ppt
LALR Parser Presentation ppt
WPVKP.COM
 
Heuristics Search Techniques in AI
Heuristics Search Techniques in AI Heuristics Search Techniques in AI
Heuristics Search Techniques in AI
Bharat Bhushan
 
Partial redundancy elimination
Partial redundancy eliminationPartial redundancy elimination
Partial redundancy elimination
Ishucs
 
Min-Max algorithm
Min-Max algorithmMin-Max algorithm
Min-Max algorithm
Dr. C.V. Suresh Babu
 
Regularization
RegularizationRegularization
Regularization
Darren Yow-Bang Wang
 
AI 6 | Adversarial Search
AI 6 | Adversarial SearchAI 6 | Adversarial Search
AI 6 | Adversarial Search
Mohammad Imam Hossain
 
AI_Session 6 Iterative deepening Depth-first and bidirectional search.pptx
AI_Session 6 Iterative deepening Depth-first and bidirectional search.pptxAI_Session 6 Iterative deepening Depth-first and bidirectional search.pptx
AI_Session 6 Iterative deepening Depth-first and bidirectional search.pptx
Asst.prof M.Gokilavani
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
swapnac12
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent method
Prof. Neeta Awasthy
 
Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}
FellowBuddy.com
 
Type checking
Type checkingType checking
Type checking
rawan_z
 
Weak and Strong AI.pptx
Weak and Strong AI.pptxWeak and Strong AI.pptx
Weak and Strong AI.pptx
MirzaJahanzeb5
 

What's hot (20)

Preparing your data for Machine Learning with Feature Scaling
Preparing your data for  Machine Learning with Feature ScalingPreparing your data for  Machine Learning with Feature Scaling
Preparing your data for Machine Learning with Feature Scaling
 
AI search techniques
AI search techniquesAI search techniques
AI search techniques
 
Structure of agents
Structure of agentsStructure of agents
Structure of agents
 
6 games
6 games6 games
6 games
 
1.1. the central concepts of automata theory
1.1. the central concepts of automata theory1.1. the central concepts of automata theory
1.1. the central concepts of automata theory
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representation
 
Naive Bayes Classifier | Naive Bayes Algorithm | Naive Bayes Classifier With ...
Naive Bayes Classifier | Naive Bayes Algorithm | Naive Bayes Classifier With ...Naive Bayes Classifier | Naive Bayes Algorithm | Naive Bayes Classifier With ...
Naive Bayes Classifier | Naive Bayes Algorithm | Naive Bayes Classifier With ...
 
Expert systems Artificial Intelligence
Expert systems Artificial IntelligenceExpert systems Artificial Intelligence
Expert systems Artificial Intelligence
 
LALR Parser Presentation ppt
LALR Parser Presentation pptLALR Parser Presentation ppt
LALR Parser Presentation ppt
 
Heuristics Search Techniques in AI
Heuristics Search Techniques in AI Heuristics Search Techniques in AI
Heuristics Search Techniques in AI
 
Partial redundancy elimination
Partial redundancy eliminationPartial redundancy elimination
Partial redundancy elimination
 
Min-Max algorithm
Min-Max algorithmMin-Max algorithm
Min-Max algorithm
 
Regularization
RegularizationRegularization
Regularization
 
AI 6 | Adversarial Search
AI 6 | Adversarial SearchAI 6 | Adversarial Search
AI 6 | Adversarial Search
 
AI_Session 6 Iterative deepening Depth-first and bidirectional search.pptx
AI_Session 6 Iterative deepening Depth-first and bidirectional search.pptxAI_Session 6 Iterative deepening Depth-first and bidirectional search.pptx
AI_Session 6 Iterative deepening Depth-first and bidirectional search.pptx
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent method
 
Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}
 
Type checking
Type checkingType checking
Type checking
 
Weak and Strong AI.pptx
Weak and Strong AI.pptxWeak and Strong AI.pptx
Weak and Strong AI.pptx
 

Viewers also liked

farmer , goats , wolf , cabbage,
farmer , goats , wolf , cabbage,farmer , goats , wolf , cabbage,
farmer , goats , wolf , cabbage,
Ahmed Nasser
 
Problem solving
Problem solvingProblem solving
Problem solving
Lovelyn Rose
 
To lec 04
To lec 04To lec 04
To lec 04
Hasam Panezai
 
State space search
State space search State space search
State space search
Timothy Makgato
 
Design and analysis of algorithms - Abstract View
Design and analysis of algorithms - Abstract ViewDesign and analysis of algorithms - Abstract View
Design and analysis of algorithms - Abstract View
Waqas Nawaz
 
Operating Guidelines for Finite-State Services
Operating Guidelines for Finite-State ServicesOperating Guidelines for Finite-State Services
Operating Guidelines for Finite-State Services
Universität Rostock
 
Example of finite state machine diagram
Example of finite state machine diagramExample of finite state machine diagram
Example of finite state machine diagram
Denmark Anthony Tan
 
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHYFINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
nishimanglani
 
State Space Search(2)
State Space Search(2)State Space Search(2)
State Space Search(2)
luzenith_g
 
Deterministic Finite Automata
Deterministic Finite AutomataDeterministic Finite Automata
Deterministic Finite Automata
Mohammad jawad khan
 
Akka Finite State Machine
Akka Finite State MachineAkka Finite State Machine
Akka Finite State Machine
Knoldus Inc.
 
Finite state machine
Finite state machineFinite state machine
Finite state machine
András Gyácsok
 
Finite State Machine | Computer Science
Finite State Machine | Computer ScienceFinite State Machine | Computer Science
Finite State Machine | Computer Science
Transweb Global Inc
 
Cldch8
Cldch8Cldch8
Cldch8
sealife24
 

Viewers also liked (14)

farmer , goats , wolf , cabbage,
farmer , goats , wolf , cabbage,farmer , goats , wolf , cabbage,
farmer , goats , wolf , cabbage,
 
Problem solving
Problem solvingProblem solving
Problem solving
 
To lec 04
To lec 04To lec 04
To lec 04
 
State space search
State space search State space search
State space search
 
Design and analysis of algorithms - Abstract View
Design and analysis of algorithms - Abstract ViewDesign and analysis of algorithms - Abstract View
Design and analysis of algorithms - Abstract View
 
Operating Guidelines for Finite-State Services
Operating Guidelines for Finite-State ServicesOperating Guidelines for Finite-State Services
Operating Guidelines for Finite-State Services
 
Example of finite state machine diagram
Example of finite state machine diagramExample of finite state machine diagram
Example of finite state machine diagram
 
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHYFINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
 
State Space Search(2)
State Space Search(2)State Space Search(2)
State Space Search(2)
 
Deterministic Finite Automata
Deterministic Finite AutomataDeterministic Finite Automata
Deterministic Finite Automata
 
Akka Finite State Machine
Akka Finite State MachineAkka Finite State Machine
Akka Finite State Machine
 
Finite state machine
Finite state machineFinite state machine
Finite state machine
 
Finite State Machine | Computer Science
Finite State Machine | Computer ScienceFinite State Machine | Computer Science
Finite State Machine | Computer Science
 
Cldch8
Cldch8Cldch8
Cldch8
 

Recently uploaded

zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
NishanthaBulumulla1
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
kalichargn70th171
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 

Recently uploaded (20)

zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 

farmer , Cabbage , Goat , Wolf Assignment

  • 2. PROBLEM STATEMENT • A FARMER WITH HIS WOLF, GOAT, AND CABBAGE COME TO THE EDGE OF A RIVER THEY WISH TO CROSS. THERE IS A BOAT AT THE RIVER’S EDGE, BUT, OF COURSE, ONLY THE FARMER CAN ROW. THE BOAT ALSO CAN CARRY ONLY TWO THINGS (INCLUDING THE ROWER) AT A TIME. IF THE WOLF IS EVER LEFT ALONE WITH THE GOAT, THE WOLF WILL EAT THE GOAT; SIMILARLY, IF THE GOAT IS LEFT ALONE WITH THE CABBAGE, THE GOAT WILL EAT THE CABBAGE. WRITE A PROLOG TWO PROGRAMS TO FIND THE SEQUENCE OF CROSSINGS OF THE RIVER SO THAT ALL FOUR CHARACTERS ARRIVE SAFELY ON THE OTHER SIDE OF THE RIVER
  • 3. The initial state and goal state Initial statue we start with state go(Farmer , left wolf , left goat , left cabbage , left wolf , left goat , left cabbage And farmer will take value with 1 or 0 , zero mean the farmer is in the left side and one mean that the farmer is in the right side And the number of wolf , goat , cabbage in the left and in the right The start state with all the farmer, wolf , cabbage and goat in the left side and the goal state that all the number of farmer, wolf , cabbage and goat move to left.
  • 4. All possible move s.I can move to goat , cabbage , wolf to right or to the left but I can’t leave wolf with goat without farmer and can’t leave goat with cabbage without also farmer . So I will make all possible move .
  • 5. so the Start state and the path : :
  • 6. Get Children of the node and add node to be visited and remov e it function ::
  • 8. The Moves and How To Print Solution
  • 9. Thanks I am sorry if there was any Mistake . CPR :: SNGV ahmednasser1993@gmail.com