n this program we are going to create a simple Finite State Machine. This is basically something that has a certain number of states (sort of like how a traffic light can be Green, Yellow, Blue) and changes from one state to another. Our (simplified) Tamagotchi will have 4 states: Happy, Hungry, Bored, Sad. Here are the rules. Our pet starts in a state of Happy, with the values for hungry = 0 and bored = 0. • Each round the player can "feed", "play" or "ignore" their pet. If they feed their pet, then the hungry meter goes down and bored meter goes up. • If they play with their pet, then the bored meter goes down and the hungry meter goes up. If they ignore their pet, then both hungry and bored go up. Don't go below 0 Here are the state changes Happy • If hungry >= 2 transition to Hungry • If bored >= 2 transition to Bored Hungry if hungry >= 4 transition to Sad • if bored > hungry transition to Bored if hungry = 4 transition to Sad if hungry > bored transition to Bored • if bored hungry transition to Bored • if hungry = 4 transition to Sad if hungry > bored transition to Bored • if bored
Answers
Answered by
0
Answer:
very big
Explanation:
Similar questions