# 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
```

![](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-LtkVghGoypMYkkekNVw%2F-LtkVzUMFkSkOVONBguI%2Fimage.png?alt=media\&token=1b767cde-ff4d-42b3-a8c5-f1582e13a5a7)

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