Coding task · JavaScript and TypeScript course · Module 9: Design Patterns and Architecture
Exercise: Dinosaur AI
Create a dinosaur AI with a needs system and a decision tree that chooses the action of the most urgent need.
Task
The index.js file has a DinosaurAI class with needs (hunger, fatigue, danger on a 0-100 scale) and a decision tree. Fill in the blanks: ___BLANK1___ is the lower limit of a need, below which updateNeed does not lower it, ___BLANK2___ is the array method that goes through the need names and keeps the one with the highest value, and ___BLANK3___ is the comparison operator in decide(): we choose the action of a need only when its value is greater than 30. Danger above 70 always gives 'flee', and when no need exceeds 30, decide() returns 'idle'.