Write code in Python for Blind Dog Agent: Create an agent blind-dog who can only feel what's in his location (since he's blind) and can eat or drink. The blind-dog is hungry and needs to search for food. But before that, let's create an environment for the blind-dog to play in. The blind-dog can perceive and act upon the environment. The environment contains some food, water, and the blind-dog The Blind-Dog to be able to randomly move down and eat food or drink water only if it is present. The bling-dog first eat the food and then drink the water after eating the food

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write code in Python for Blind Dog Agent:

Create an agent blind-dog who can only feel what's in his location (since he's blind) and can eat or drink.

The blind-dog is hungry and needs to search for food. But before that, let's create an environment for the blind-dog to play in. The blind-dog can perceive and act upon the environment. The environment contains some food, water, and the blind-dog

The Blind-Dog to be able to randomly move down and eat food or drink water only if it is present.

The bling-dog first eat the food and then drink the water after eating the food.

 

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Change the following case in a way that it randomly moves down and eat/drink something only if it's present. Give the output screenshot

 

import random
#Dog Class
class Dog:
 #constructor
 def __init__(self, name):
  self.name = name
 def eat(self):
  print("{} is eating.".format(self.name))
 def drink(self):
  print("{} is drinking.".format(self.name))
# The Blind-Dog class inherits from the Dog class
class BlindDog(Dog):
 def __init__(self, name, hunger=0, thirst=0):
  super().__init__(name)
  self.hunger = hunger
  self.thirst = thirst
 # The Blind-Dog can only feel what's in his location
 def feel(self, environment):
  if environment == "food":
   return True
  elif environment == "water":
   return True
  else:
   return False
 # The Blind-Dog is hungry and needs to search for food
 def search_for_food(self):
  if self.feel("food"):
   print("I found food!")
   self.eat()
  else:
   print("There is no food around.")
 # The Blind-Dog is thirsty and needs to search for water
 def search_for_water(self):
  if self.feel("water"):
   print("I found water!")
   self.drink()
  else:
   print("There is no water around.")
 # The Blind-Dog first eat the food and then drink the water after eating the food
 def eat_and_drink(self):
  self.search_for_food()
  self.search_for_water()
def main():
 # Create an environment for the blind-dog to play in
 environment = ["food", "water"]
 # Create an instance of the Blind-Dog class
 dog = BlindDog("Bingo", 0, 0)
 # The blind-dog can perceive and act upon the environment
 dog.eat_and_drink()
if __name__ == "__main__":
 main()

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education