Make a simplified Tamagotchi/Giga Pet! Tamagotchi and Giga Pets were small electronic devices which simulated a little virtual pet. This pet had several stats, like health, hunger,  etc.
I recently wrote this example:

import msvcrt,os,sys;d=m=100;h=s=t=p=0;f=10
while 1:
 os.system('cls'if os.name=='nt'else'clear');print("health:",d,"\nhunger:",h,"\nsleep:",s,"\nfood:",f,"\npotions:",p,"\nmoney:",m);t+=1
 if msvcrt.kbhit():
  k=ord(msvcrt.getch())
  if k==102 and h&gt;8 and f:f-=1;h-=9
  if k==115:s=0
  if k==112 and p:p-=1;d+=9
  if k==98 and m&gt;8:m-=9;p+=1
  if k==116 and m&gt;8:m-=9;f+=1
 if t&gt;99:
  t=0;h+=1;s+=1
  if s&gt;80:s=0;h+=9
  if h&gt;80:d-=1
  if d&lt;1:sys.exit(0)
  if d&gt;79:m+=1


This is a bare-bones virtual pet in 467 bytes! I then wondered how well the code golf pros could do, so now, the challenge.

The Challenge

Make a program that tracks 6 stats of a virtual pet, and updates them over time and in response to user input. The stats are: health and money (starting at 100), food (starting at 10), and hunger, sleep, and potions (starting at 0).

The program should update the values in response to the following events:


While the program is receiving no input, it should perform updates at regular intervals (the interval between updates should not be shorter than half a second nor longer than one second). Each update does the following:


Hunger and Sleep each increase by 1.
If Hunger is 80 or above, Health decreases by 1.
If Sleep is 80 or above, it is reset to 0, and Hunger increases by an additional 9.
If Health is 80 or above, Money increases by 1.
If Health is 0, the program exits.

The program must also respond immediately upon the following keypresses by the user (this means that you will need to use a language feature or library that can detect a key being pressed and respond to it immediately, rather than just reading from standard input), performing the following actions:


f: If Hunger is greater than 8 and Food is nonzero, then Food is decreased by 1 and Hunger is decreased by 9. 
s: Sleep is reset to 0.
p: If Potions is greater than zero, Potions is decreased by 1 and Health is increased by 9.
b: If Money is greater than 8, then Money is decreased by 9 and Potions are increased by 1.
t: If Money is greater than 8, then Money is decreased by 9, and Food is increased by by 1.



Whenever the values of the stats change, they must be displayed on screen in the form Stat: value. All six stats must be displayed whenever any of them changes; and the stats within a display must be separated either by commas or by newlines.

This challenge follows normal code-golf rules: the shortest program complying with the specification above wins. (Note that as usual, if the language is newer than the competition, the submission must be marked as non-competing.)
C, 424 406 386 357 bytes

#define x(a,b,c)if(*#a==C){if(b&gt;8){c-=9;}Z=0;}
L,M=100,H,S=-1,F=10,P,Z,C;t(){H++;S++;L-=H&gt;79;if(S&gt;79)S=0,H+=9;Z=1/L/2;alarm(1);}main(){nodelay(initscr(),L=M);signal(14,t);for(t(H=S);C=getch();Z=Z||printf("\rhealth: %d,hunger: %d,sleep: %d,food: %d,potions: %d,money: %d\n",L,H,S,F,P,M)){x(s,9,S=9;S)x(p,P+8,P--;L+=18;L)x(f,H,F--;H)x(b,M,P++;M)x(t,M,F++;M)}}


I appreciate the need for raw input and asynchronous updates in the problem spec.  Even though that required some overhead from the ncurses setup and signal handlers, it's nice to have the occasional challenge that (hopefully) won't be automatically won by one of the dedicated golfing languages.

You didn't specify exactly how game over is indicated, so this one perishes with the traditional Tamagotchi death cry of "Floating point exception (core dumped)".

Ungolfed

/* Playing a bit fast and loose with the prototyping rules by omitting these;
 * none of the functions I'm using from them *exactly* match the default
 * prototype of `int f();`
 */
//#include &lt;curses.h&gt;
//#include &lt;stdio.h&gt;
//#include &lt;signal.h&gt;
//#include &lt;unistd.h&gt;

#define x(a,b,c)if(*#a==C){if(b&gt;8){c-=9;}Z=0;}
L,M=100,H,S=-1,F=10,P,Z,C;

t() {
    H++;
    S++;
    L-=H&gt;79;
    if(S&gt;79)S=0,H+=9;
    Z=1/L/2;//0 if L&gt;0. otherwise the pet dies of a floating point error
    alarm(1);
}

main(){
    nodelay(initscr(),L=M);
    signal(14,t);
    for(t(H=S); C=getch(); Z=Z||printf("\rhealth: %d,hunger: %d,sleep: %d,food: %d,potions: %d,money: %d\n",L,H,S,F,P,M)){
        x(s,9,S=9;S)
        x(p,P+8,P--;L+=18;L)
        x(f,H,F--;H)
        x(b,M,P++;M)
        x(t,M,F++;M)
    }
}