# Mood Chance

So we will use the Mood Chance to Control if your pet is Happy, Hungry or Dead

```
Forever
    if Happy = true
        mood chance = random number between 0 and 501
        If mood chance <=1
            Happy = false
            Hungry =true
            Else If mood change >1 AND <=50
                Happy = False
                Hungry = False
                Unhappy = Unhappy - 20
                Else
                    Happy = True
                    Hungry = False

//notice that for Happy a positive value is true but for hungry
    a positive  value  is False
```

![](/files/-LtkVzUMFkSkOVONBguI)

```
Forever
    Hungry = True AND Unhappy Timer = 0
        then dead = TRUE
    if Dead = True
        show dead face
        pause 6000 ms
        set game over
    
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://computational-thinking-in-room11.gitbook.io/room-112-dhs/software-development/micro-pets/mood-chance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
