' Ticking Bomb" program for the picaxe 08M. ' Requires the Schools Experimenter Board. '------------------------- "Ticking bomb" picaxe 08M game --------------------- ' Pick up the small box and you will hear a ticking sound - could it be a bomb. ' Perhaps it would be wise to pass the box to someone else as soon as possible, ' act quickly or you may hear the mornfull sounds of the death march playing. ' On the other hand you may hear the familiar sound of the Looney Tunes Theme. ' What should I do? is it wise to push the button for another dice with death. '------------------------------------------------------------------------------ ' ----------------------------- Start-up procdure.----------------------------- ' Holding the push button while turning the game on will play "Looney tunes". ' Just switching the game on without the push button will play "Death March". ' ----------------------------------------------------------------------------- 'start_game:'---------- check push button and set-up game ------ low 0: low 1: low 2: b2 = 0: b3 = 3: b4 = 1 if input3 = 1 then: b4 = 2: endif 'if input3 = 0 then run_game run_game:'--------- alternate ways of running during the game ------ random w0: pause 10 if b2 > 12 then play_tune if b3 = 3 and b1 > 12 then auto_run if input3 = 1 then push_button goto run_game auto_run:'------- add the ticking sound with a one second pause between ticks ------ sound 2,(200,3) pause 1000 goto random_play push_button:'------- beep after waiting for the push button to be released ------ pause 10 if b3 = 4 then: b3 = 3: endif if input3 <> 0 then push_button sound 2,(120,25) 'goto random_play random_play:'------- one in six chance to play tune - otherwise show a led ------ b2 = b2 + 1 if b1 > 168 then high_led if b1 > 126 then play_tune 'if b1 <= 126 then low_led 'low_led:'--------- indicates a random number between 0 and 126 ------ let pins = 1 goto run_game high_led:'--------- indicates a random number between 126 and 255 ------ let pins = 2 goto run_game play_tune:'--------- can the tune be played - otherwise show high_led ------ let pins = 4 if b2 <= 4 then high_led if b4 = 1 then tune_dmarch if b4 = 2 then tune_looney tune_dmarch:'--------- play Death March Music ---------' tune 0,6,($20,$60,$20,$23,$62,$22,$60,$20,$60,$E0) let pins = 0: b2 = 0: b3 = 4 goto run_game tune_looney:'--------- play Looney Tunes Theme ---------' tune 0,5,($44,$42,$40,$42,$44,$43,$44,$40,$42,$42,$42,$C2) let pins = 0: b2 = 0: b3 = 4 goto run_game ' "ticking bomb" '------------------------------------------------------------------------------- ' b1 = random number b1 = nnn between 0 and 255 ' b2 = tune counter b2 <= 4 dont play the tune ' b2 > 12 play the tune ' b3 = mode flag b3 = 3 auto-run selected ' b3 = 4 push button selected ' b4 = music flag b4 = 1 play Death March ' b4 = 2 play Loony Tunes '------------------------------------------------------------------------------- ' Detailed "Ticking Bomb" notes '------------------------------------------------------------------------------- ' Holding the push button while switching the unit on will select "Loony Tunes". ' Switching unit on without holding the push button on will select "Death march" ' When switched on the program cycles automatically by-passing the push button. ' This mode also adds a ticking sound - repeated each second just like a clock. ' The program selects a dice number between one and six - a six "plays music". ' Each cycle,the random number program has a one in six chance of playing music. ' Low dice numbers are shown on LED 0 and high dice numbers are shown on LED 1. ' To prevent a short game - the tune will not play during the first four cycles. ' To prevent a long game - the tune will always play after the twelfth cycle. ' Playing of any sound - either music or the beep sound - will make Led 2 flash. ' Once the tune has played the program will pause - push the button to continue. ' I have kept the music short,longer tunes can be used check,the picaxe web site. ' You may exit the "ticking bomb" game at any time by turning the main switch off. '-------------------------------------------------------------------------------