;ANGRY GARGOYLES CODE ;switch 7- mouth open ;switch 8- mouth closed ;switch 11- normal nose ;switch 12- flared nose ;switch 14- eyebrow light ;sensor 0- eyebrow sensor ;OUTPUTS ;a - mouth this-way: open ;b - eyes this-way: up ;c - nose this-way: closed ;COMMUNICATION ;sensor 1- comm light sensor ;d - comm light ;1-angry, 2-sad, 3-happy menu 1 [interact] menu 2 [setstate 1] menu 3 [make-dude-happy] menu 4 [make-dude-sad] menu 5 [make-dude-angry] menu 6 [cycle] global[state] to interact setstate 1 make-dude-angry loop[ waituntil[(sensor 1) < 200] wait 10 ifelse((sensor 1) < 200) [wait 10 ifelse((sensor 1) < 200) [wait 10 ifelse((random 10) < 4) [make-dude-happy][make-dude-angry]] [wait 10 ifelse((random 10) < 4) [make-dude-sad][make-dude-happy]] ] [wait 20 ifelse((random 10) < 4) [make-dude-happy][make-dude-angry] ] ] end to cycle setstate 1 loop[ wait 30 make-dude-happy wait 30 make-dude-sad wait 30 make-dude-angry ] end to make-dude-happy if(not(state = 3))[ ;if(state = 2) ; [a, thisway on ; waituntil[switch 7] ; a, off ; ] ifelse(state = 1) [b, thatway on] [b, thisway on] wait-one-state b, off if(state = 1)[ c, thatway on waituntil[switch 12] c, off ] setstate 3] d, onfor 25 end to make-dude-angry if(not(state = 1))[ ;if(state = 2)[ ; a, thisway on ; waituntil[switch 7] ; a, off ; ] b, thisway on ifelse(state = 2) [wait-one-state wait-one-state] [wait-one-state] b, off c, thisway on waituntil[switch 11] c, off setstate 1 ] d, onfor 2 end to make-dude-sad if(not(state = 2))[ ;a, thatway on ;waituntil[switch 8] ;a, off b, thatway on ifelse(state = 1) [wait-one-state wait-one-state] [wait-one-state] b, off if(state = 1)[ c, thatway on waituntil[switch 12] c, off ] setstate 2] d, onfor 15 end to wait-for-edge waituntil[(sensor 0) > 50] waituntil[(sensor 0) < 50] end to wait-one-turn wait-for-edge wait-for-edge end to wait-one-state wait-one-turn end