The purpose of this assignment is to simulate the behavior of an aquarium that contains fish and food. An aquarium consists of n fish and m portions of food. A fish is mainly characterized by its: size: an integer between 1 and 10 inclusive. speed: an integer between 1 and 10 inclusive. hunger: an integer between 0 and 10 inclusive. tiredness: an integer between 0 and 10 inclusive. Food is characterized by its type (Plant or Meat) and its size (1, 2 or 3). Moreover, we distinguish between three types of fish: Herbivore, Omnivore and Carnivore. Based on some preconditions, the fish (regardless of its type) can do one of the following actions: grow, eat and sleep. If the preconditions are not met, the fish will not do anything. However, if the fish did one of the actions, some of the fish characteristics will change. Actions preconditions and actions consequences are listed in the table below. eat() sleep() grow() Condition Action Condition Action Condition Action Hunger > 7 & Hunger < 5 Size, hunger and Hunger decreases by food Tiredness Herbivores Tiredness > 6 tiredness increase size decreases by 3 Food type is "Plant" Tiredness < 5 by 1 Hunger > 6 Hunger decreases by food size or fish size according to & Hunger < 6 (Food type is "Meat" what was eaten Tiredness Size increases by 2 Carnivores Tiredness > 7 Or & decreases by 2 and hunger by 3 Tiredness < 5 Tiredness increases by 1/3 Fish slower and smaller by 2 points)* Hunger > 7 & of meal size Hunger decreases by food size or fish size according to Size and speed increase by 1 Tiredness decreases by 4 Hunger < 7 (Food of any type Omnivores what was eaten Tiredness > 7 & & Hunger and tiredness increase Or & Tiredness < 8 Fish of slower speed and size up till 2 points bigger)* Hunger increases by 2 Tiredness increases by 1 by 2 *Decision whether food or fish is eaten is chosen randomly. In addition to the above methods, a fish can perform a step action. In a step, every fish does only one of 3 possible things: eat, sleep or grow. Each fish has different precedence order: Herbivores: sleep, grow, eat Carnivores: eat, sleep, grow Omnivores: grow, eat, sleep Also, you must consider the following when performing a step action: 1. If the method's conditions are not met, the fish moves the next method in its order. 2. If none is met the fish does nothing. 3. If a fish is dead it does nothing in the step method. Hence, the fish dies if it was eaten, its hunger
The purpose of this assignment is to simulate the behavior of an aquarium that contains fish and food. An aquarium consists of n fish and m portions of food. A fish is mainly characterized by its: size: an integer between 1 and 10 inclusive. speed: an integer between 1 and 10 inclusive. hunger: an integer between 0 and 10 inclusive. tiredness: an integer between 0 and 10 inclusive. Food is characterized by its type (Plant or Meat) and its size (1, 2 or 3). Moreover, we distinguish between three types of fish: Herbivore, Omnivore and Carnivore. Based on some preconditions, the fish (regardless of its type) can do one of the following actions: grow, eat and sleep. If the preconditions are not met, the fish will not do anything. However, if the fish did one of the actions, some of the fish characteristics will change. Actions preconditions and actions consequences are listed in the table below. eat() sleep() grow() Condition Action Condition Action Condition Action Hunger > 7 & Hunger < 5 Size, hunger and Hunger decreases by food Tiredness Herbivores Tiredness > 6 tiredness increase size decreases by 3 Food type is "Plant" Tiredness < 5 by 1 Hunger > 6 Hunger decreases by food size or fish size according to & Hunger < 6 (Food type is "Meat" what was eaten Tiredness Size increases by 2 Carnivores Tiredness > 7 Or & decreases by 2 and hunger by 3 Tiredness < 5 Tiredness increases by 1/3 Fish slower and smaller by 2 points)* Hunger > 7 & of meal size Hunger decreases by food size or fish size according to Size and speed increase by 1 Tiredness decreases by 4 Hunger < 7 (Food of any type Omnivores what was eaten Tiredness > 7 & & Hunger and tiredness increase Or & Tiredness < 8 Fish of slower speed and size up till 2 points bigger)* Hunger increases by 2 Tiredness increases by 1 by 2 *Decision whether food or fish is eaten is chosen randomly. In addition to the above methods, a fish can perform a step action. In a step, every fish does only one of 3 possible things: eat, sleep or grow. Each fish has different precedence order: Herbivores: sleep, grow, eat Carnivores: eat, sleep, grow Omnivores: grow, eat, sleep Also, you must consider the following when performing a step action: 1. If the method's conditions are not met, the fish moves the next method in its order. 2. If none is met the fish does nothing. 3. If a fish is dead it does nothing in the step method. Hence, the fish dies if it was eaten, its hunger
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Java Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 1 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY