[code] 'all constants symbol Speaker = 6 symbol trig = 4 symbol echo = 5 symbol dangerLevel = 150 symbol range = w4 symbol tempRange = w6 symbol Dice = w5 'all variables 'symbol Mood = b1 symbol Distance = b2 symbol Cycle = b3 'Mood settings '1 = Normal '2 = Angry '3 = curious Init: 'let Mood = 1 let Distance = 1 let Cycle = 1 GoSub FullStop Gosub BeepYes01 wait 2 Main: Random w5 Gosub scan if range < DangerLevel then gosub FullStop Let Distance = 1 Let tempRange = range Gosub LookAround else if Distance < 250 then Let Distance = Distance+1 else let Distance = 1 if Cycle < 250 then let Cycle = Cycle+1 else let Cycle = 1 endif endif Gosub GoForward Gosub Readjust EndIf 'Gosub ExpressYourself Goto Main 'All sub routines 'Walks Readjust: Select case Distance case 51 gosub SpinLeft pause 75 Case 102 gosub TurnLeft pause 100 case 105 gosub BeepBeep case 153 gosub SpinLeft pause 55 Case 201 gosub TurnLeft pause 125 Case 255 gosub SpinLeft pause 90 else endselect return 'rewrite this FreakOut: Gosub BeepNo01 Gosub GoBack Pause 550 Gosub BeepNo01 Gosub SpinLeft pause 350 Gosub TurnRight Pause 400 Gosub BeepNo01 Gosub SpinLeft pause 1500 Return 'Navigation GoForward: high 1 low 0 'Left Wheel forward high 3 low 2 'Right Wheel forward return GoBack: high 0 low 1 'Left Wheel Reverse high 2 low 3 'Right Wheel Reverse return FullStop: low 0 low 1 'Stop left Wheel low 2 low 3 ' stop Right Wheel return TurnRight: high 1 low 0 'Left Wheel forward low 2 low 3 ' stop Right Wheel return TurnLeft:'Yes high 3 low 2 'Right Wheel forward low 0 low 1 'Stop left Wheel return SpinRight: high 1 low 0 'Left Wheel forward high 2 low 3 'Right Wheel Reverse return SpinLeft: high 3 low 2 'Right Wheel forward high 0 low 1 'Left Wheel Reverse return 'Speaking Beep: return BeepBeep: if Dice > 58500 then gosub BeepTune01 elseif Dice > 52000 then gosub BeepTune02 elseif Dice > 45500 then gosub BeepTune03 elseif Dice > 39000 then gosub BeepTune04 elseif Dice > 32500 then gosub BeepTune05 elseif Dice > 26000 then gosub BeepTune06 elseif Dice > 19500 then gosub BeepTune07 elseif Dice > 13000 then gosub BeepTune08 elseif Dice > 6500 then gosub BeepTune09 elseif Dice > 500 then gosub BeepTune10 else Gosub SpinRight gosub BeepIndy pause 1000 endif pause 200 return BeepYes01: tune Speaker, 5,($59,$5A) return Beep01: tune Speaker, 3,($04) return Beep02: tune Speaker, 2,($04,$4C,$04) return Beep03: tune Speaker, 2,($04,$4C,$04,$4C,$04) return Beep04: tune Speaker, 2,($04,$4C,$04,$4C,$04,$4C,$04) return BeepNo01: tune Speaker, 2,($07,$46,$E8) return BeepNo02: tune Speaker, 2,($28,$4C,$28,$4C,$E1) return BeepTune01: tune Speaker, 3,($4B,$4A,$4B,$4C,$6B,$4C,$6B,$4C) return BeepTune02: tune Speaker, 3,($60,$65,$69,$40,$69) return BeepTune03: tune Speaker, 3,($42,$43,$42,$47) return BeepTune04: tune Speaker, 3,($46,$44,$42,$41,$42) return BeepTune05: tune Speaker, 2,($03,$40,$08,$4C,$08) return BeepTune06: tune Speaker,2,($60,$64,$65,$67) wait 1 BeepTune07: tune Speaker,3,($67,$6C,$07,$67,$44,$27) return BeepTune08: tune Speaker,3,($40,$4C,$44,$42,$4C,$40,$4C,$25) return BeepTune09: tune Speaker,2,($25,$4C,$25,$4C,$27,$27,$4C,$29) return BeepTune10: tune Speaker,3,($65,$65,$65,$EA,$C5) return BeepIndy: tune Speaker, 3,($6C,$24,$6C,$65,$67,$6C,$80,$6C,$22,$6C,$64,$A5,$2C,$27,$6C,$69,$6B,$6C,$85,$2C,$29,$6C,$6B,$C0,$C2,$C4) return 'Looking Scan: high trig pause 10 low trig pulsin echo,1,range 'debug return LookAround: gosub BeepNo02 gosub SpinLeft pause 750 gosub FullStop gosub Scan pause 500 if range < tempRange then gosub GoBack pause 100 gosub SpinRight pause 1400 gosub FullStop gosub Scan pause 500 if range < tempRange then gosub Beep01 gosub FreakOut 'option 1 else gosub TurnRight pause 350 Gosub Fullstop gosub Beep02 pause 350 'option 2 Endif else let tempRange = range gosub SpinRight pause 1400 gosub FullStop gosub Scan pause 500 if range < tempRange then gosub BeepNo01 gosub SpinLeft pause 1500 gosub TurnRight pause 100 gosub fullStop gosub Beep03 'option 3 else gosub TurnRight pause 150 gosub FullStop gosub Beep04 'option 4 endif endif return[/code]