Challenge:
Version:
2
Winner?:
No
Code Snippet:
set display mode 1024,768,32 hide mouse backdrop on color backdrop 0 sync on datatoimage(2) make_sound(1) dim cylndr#(3) dim win(3) cherry=3 bar=4 bar2=5 bar3=6 wild=7 instruct=8 score=9 title=10 screenx=959 screeny=159 screenc=int(screeny/2) rad=30 offset=40 angle_offset=15 spacing=80 speed=5 create bitmap 1,screenx+1,screeny+1 ink rgb(255,255,255),0 box 0,0,screenx,screeny for num=1 to 12 select num case 1,6 ink rgb(255,0,0),0 for r=1 to rad/2 circle num*spacing-offset,screenc-rad/2,r circle num*spacing-offset,screenc+rad/2,r next r ink rgb(0,128,0),0 for x=1 to 3 line num*spacing-offset-rad/2,screenc-rad/2+x,num*spacing-offset-rad,screenc+x line num*spacing-offset-rad/2,screenc+rad/2+x,num*spacing-offset-rad,screenc+x next x get image cherry,num*spacing-offset-rad,screenc-rad,num*spacing-offset+rad,screenc+rad endcase case 2,12 ink 0,0 box num*spacing-offset-rad/2,screenc-rad,num*spacing-offset+rad/2,screenc+rad get image bar,num*spacing-offset-rad,screenc-rad,num*spacing-offset+rad,screenc+rad endcase case 5,11 ink 0,0 box num*spacing-offset-rad/2-2,screenc-rad,num*spacing-offset-2,screenc+rad box num*spacing-offset+2,screenc-rad,num*spacing-offset+rad/2+2,screenc+rad get image bar2,num*spacing-offset-rad,screenc-rad,num*spacing-offset+rad,screenc+rad endcase case 9 ink 0,0 box num*spacing-offset-rad/2-4,screenc-rad,num*spacing-offset-rad/3,screenc+rad box num*spacing-offset-rad/3+3,screenc-rad,num*spacing-offset+rad/3-3,screenc+rad box num*spacing-offset+rad/3,screenc-rad,num*spacing-offset+rad/2+4,screenc+rad get image bar3,num*spacing-offset-rad,screenc-rad,num*spacing-offset+rad,screenc+rad endcase case 4,8 ink rgb(255,255,0),0 for r=1 to rad ellipse num*spacing-offset,screenc,r/2,r next r endcase case 3,10 ink rgb(255,0,255),0 for r=1 to rad ellipse num*spacing-offset,screenc,r/2,r next r endcase case 7 paste image 2,num*spacing-offset-32,screenc-32,1 get image wild,num*spacing-offset-rad,screenc-rad,num*spacing-offset+rad,screenc+rad endcase endselect next num get image 1,0,0,screenx,screeny delete bitmap 1 create bitmap 1,1024,768 ink rgb(255,64,64),0 box 0,120,1023,650 ink 0,0 box 95,180,350,580 box 385,180,665,580 box 700,180,930,580 set text size 40 set cursor 400,120 print "[SPACEBAR] to spin" get image 2,0,0,1023,767 delete bitmap 1 create bitmap 1,spacing*6+4,spacing*3+4 ink rgb(255,255,255),0 box 0,0,spacing*6+4,spacing*3+4 for x=1 to 3 paste image cherry,0,(x-1)*spacing+5 paste image bar,spacing,(x-1)*spacing+5 paste image bar2,spacing*2,(x-1)*spacing+5 paste image bar3,spacing*3,(x-1)*spacing+5 if x>1 then paste image wild,spacing*4,(x-1)*spacing+5 paste image wild,spacing*5,(x-1)*spacing+5 next x get image instruct,0,0,spacing*6+3,spacing*3+3 delete bitmap 1 create bitmap 1,400,100 ink rgb(255,255,255),0 set text font "arial" set text size 60 set cursor 10,10 print "Faces Wild" get image title,0,0,399,99 delete bitmap 1 set text font "courier" set current bitmap 0 for cyl=1 to 3 make object cylinder cyl,20 scale object cyl,100,50,100 zrotate object cyl,90.0 yrotate object cyl,angle+offset texture object cyl,1 position object cyl,(cyl-2)*10,0,0 next cyl make light 1 position light 1,0,0,30 position camera 0,0,30 point camera 0,0,0 sprite 1,0,0,2 sprite 2,60,650,instruct scale sprite 2,25 rotate sprite 2,90 sprite 3,350,0,title quit=0 move=0 while quit=0 if spacekey() and move=0 then move=1 if not spacekey() if move=1 cylndr#(3)=5.0+rnd(20)/10.0 cylndr#(2)=6.0+rnd(20)/10.0 cylndr#(1)=7.0+rnd(20)/10.0 move=2 winline=0 winning=0 endif endif for cyl=1 to 3 if cylndr#(cyl) > 0.0 then yrotate object cyl,object angle y(cyl)-speed if object angle y(cyl)<0 then yrotate object cyl,object angle y(cyl)+360 if cylndr#(cyl)>1.0 cylndr#(cyl)=cylndr#(cyl)-0.05 else if cylndr#(cyl)>0.0 if (object angle y(cyl)-offset) mod 30 =0 cylndr#(cyl)=0.0 inc move endif endif endif next cyl if move=5 wild=0 winning=0 move=0 for x = 3 to 1 step -1 win(x)=int((object angle y(x)-offset)/30)+2 if win(x)=7 then inc wild next x if wild=3 winline=100 else if wild=2 winline=50 else select win(3) case 1,6,7 if win(2)=1 or win(2)=6 or win(2)=7 if win(1)=1 or win(1)=6 or win(1)=7 winline=2 endif endif endcase case 2,12,7 if win(2)=5 or win(2)=9 or win(2)=11 or win(2)=2 or win(2)=12 or win(2)=7 if win(1)=5 or win(1)=9 or win(1)=11 or win(1)=2 or win(1)=12 or win(1)=7 winline=2 endif endif if win(2)=2 or win(2)=12 or win(2)=7 if win(1)=2 or win(1)=12 or win(1)=7 winline=5 endif endif endcase case 5,11,7 if win(2)=5 or win(2)=9 or win(2)=11 or win(2)=2 or win(2)=12 or win(2)=7 if win(1)=5 or win(1)=9 or win(1)=11 or win(1)=2 or win(1)=12 or win(1)=7 winline=2 endif endif if win(2)=5 or win(2)=11 or win(2)=7 if win(1)=5 or win(1)=11 or win(1)=7 winline=10 endif endif endcase case 9,7 if win(2)=5 or win(2)=9 or win(2)=11 or win(2)=2 or win(2)=12 or win(2)=7 if win(1)=5 or win(1)=9 or win(1)=11 or win(1)=2 or win(1)=12 or win(1)=7 winline=2 endif endif if win(2)=9 or win(2)=7 if win(1)=9 or win(1)=7 winline=25 endif endif endcase endselect endif endif endif if winning<winline inc winning volume=100 set sound volume 1,volume play sound 1 while (sound playing(1)) and (volume>0) dec volume set sound volume 1,volume sleep 5 endwhile else if move=5 then move=0 endif set text size 50 set cursor 400,675 ink rgb(255,255,255),0 print winning sync endwhile exit function make_sound(number) format as dword channels as dword sampleRate as dword adr as dword chunkSize as dword sampleSize as dword dword7 as dword format = 1 channels = 1 sampleRate = 22050 sampleSize = 16 chunkSize = (int(sampleSize / 8.0+0.5))*channels adr = sampleRate*chunkSize dword7 = 0 length = 100 wave#=0.0 increment#=2.0 gain#=-0.09 amplitude=65535 decay=0 speed=sampleRate samples = length*sampleRate/1000 size = samples*int(sampleSize/8.0+0.5) + 28 make memblock 2, size write memblock dword 2, 0, format write memblock dword 2, 4, channels write memblock dword 2, 8, sampleRate write memblock dword 2, 12, adr write memblock dword 2, 16, chunkSize write memblock dword 2, 20, sampleSize write memblock dword 2, 24, dword7 pos = 28 out as word for i = 1 to samples out = sin(wave#)*amplitude write memblock word 2, pos, out inc pos, 2 wave#=wave#+increment# if wave#>360.0 wave#=wave#-360.0 increment#=increment#-gain# endif amplitude=amplitude-decay next i make sound from memblock number,2 delete memblock 2 set sound speed number,speed endfunction function datatoimage(image) memblock=1 read size make memblock 1,size read sx `as dword read sy `as dword read depth `as dword write memblock dword 1,0,sx write memblock dword 1,4,sy write memblock dword 1,8,depth for y=0 to sy-1 for x=0 to sx-1 pos=(y*sx+x)*4+12 read b `as byte read g `as byte read r `as byte read a `as byte write memblock byte 1,pos,b write memblock byte 1,pos+1,g write memblock byte 1,pos+2,r write memblock byte 1,pos+3,a next x next y make image from memblock image,1 endfunction data 16396 data 64 data 64 data 32 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,217,217,219,1,231,231,231,13,246,246,246,13,237,242,247,19,234,241,246,44,160,206,225,46,82,157,201,46,74,177,225,46,66,212,255,33,59,207,255,13,54,200,250,13,52,185,231,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,181,183,222,1,222,222,244,19,246,243,248,54,248,248,248,105,247,247,247,164,245,250,255,206,252,252,252,209,236,242,247,215,230,236,239,241,142,185,208,242,85,133,178,242,77,166,213,242,69,210,255,229,61,211,255,209,55,209,255,206,49,206,255,168,43,203,255,135,38,198,255,77,33,191,248,25,32,176,227,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,212,212,241,6,202,202,243,63,220,220,247,156,247,250,255,212,250,251,251,242,249,249,249,255,248,252,255,255,254,254,254,255,239,244,249,255,228,234,231,255,175,202,217,255,97,150,188,255,88,140,184,255,79,176,223,255,71,214,255,255,63,212,255,255,56,210,255,255,50,208,255,255,44,205,255,255,39,200,255,251,34,196,253,219,30,192,250,164,27,188,247,98,23,182,242,36,27,156,205,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,234,234,251,6,226,226,251,63,217,217,248,168,217,217,249,241,245,245,253,255,253,253,253,255,252,255,255,255,250,250,250,255,255,255,255,255,242,243,243,255,233,238,242,255,194,213,217,255,110,167,197,255,100,146,186,255,90,168,212,255,81,210,255,255,73,214,255,255,65,212,255,255,58,210,255,255,51,208,255,255,46,207,255,255,40,203,255,255,35,198,255,255,31,195,252,255,27,190,250,254,24,186,246,226,21,181,242,142,18,176,238,43,20,154,206,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,251,251,254,1,247,247,255,57,240,240,255,168,232,232,253,241,223,223,251,255,241,241,254,255,254,254,255,255,254,254,254,255,253,255,253,255,251,254,251,255,246,249,246,255,238,241,238,255,214,224,223,255,145,185,207,255,112,154,191,255,102,161,202,255,92,202,245,255,83,217,255,255,75,215,255,255,67,213,255,255,59,210,255,255,53,209,255,255,47,207,255,255,41,205,255,255,36,201,255,255,32,196,255,255,28,193,251,255,24,188,248,255,21,183,244,255,19,179,240,228,17,175,237,142,15,171,233,43,20,138,184,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,10,255,255,255,108,251,251,255,231,244,244,255,255,236,236,254,255,236,236,254,255,254,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,244,247,244,255,230,235,232,255,186,204,218,255,125,169,200,255,114,160,198,255,104,190,230,255,94,219,255,255,85,218,255,255,76,215,255,255,68,213,255,255,60,211,255,255,54,209,255,255,47,207,255,255,42,206,255,255,37,203,255,255,32,198,255,255,28,194,253,255,25,189,249,255,22,186,245,255,19,181,242,255,17,178,239,255,15,173,236,228,13,168,232,108,12,159,219,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,31,255,255,255,158,255,255,255,249,255,255,255,255,247,247,255,255,239,239,255,255,250,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,255,253,255,255,255,255,255,240,244,248,255,220,224,232,255,146,187,209,255,128,166,199,255,116,180,217,255,105,214,255,255,95,220,255,255,86,218,255,255,77,215,255,255,69,213,255,255,61,211,255,255,54,209,255,255,48,208,255,255,42,206,255,255,37,205,255,255,33,201,255,255,29,196,255,255,25,192,251,255,22,187,248,255,19,182,244,255,17,179,240,255,15,174,237,255,13,170,233,249,12,166,230,151,11,162,226,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,1,255,255,255,64,255,255,255,200,255,255,255,255,255,255,255,255,255,255,255,255,249,249,255,255,247,247,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,253,253,255,253,254,254,255,234,239,237,255,188,210,221,255,140,176,205,255,129,174,208,255,117,205,243,255,106,223,255,255,96,221,255,255,86,218,255,255,78,216,255,255,69,213,255,255,62,211,255,255,55,209,255,255,48,208,255,255,42,206,255,255,37,205,255,255,33,203,255,255,29,199,255,255,25,194,254,255,22,189,250,255,19,185,246,255,17,181,243,255,15,177,239,255,13,172,236,255,12,168,232,254,11,165,228,187,11,161,225,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,10,255,255,255,108,255,255,255,231,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,254,255,255,248,252,248,255,223,230,234,255,152,192,213,255,141,175,206,255,129,192,226,255,117,221,255,255,106,223,255,255,96,221,255,255,87,218,255,255,78,216,255,255,69,213,255,255,62,211,255,255,55,209,255,255,48,208,255,255,43,206,255,255,37,205,255,255,33,203,255,255,29,200,255,255,25,188,247,255,22,145,193,255,19,102,141,255,17,152,207,255,15,178,240,255,13,173,237,255,12,170,233,255,11,166,230,255,11,162,226,217,11,150,214,74,15,102,156,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,10,255,255,255,149,255,255,255,249,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,254,255,252,250,252,255,237,239,239,255,190,210,221,255,152,184,210,255,140,181,213,255,129,214,248,255,117,226,255,255,106,223,255,255,96,221,255,255,86,218,255,255,78,216,255,255,69,213,255,255,62,211,255,255,55,209,255,255,48,208,255,255,42,206,255,255,37,205,255,255,33,203,255,255,29,188,243,255,25,123,162,255,22,38,56,255,19,19,19,255,17,104,144,255,15,180,243,255,13,176,239,255,12,172,234,255,11,168,231,255,11,165,227,255,11,160,224,238,11,134,197,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,3,255,255,255,110,255,255,255,249,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,254,255,255,247,247,247,255,220,225,228,255,163,195,214,255,151,182,211,255,139,198,229,255,128,225,255,255,116,226,255,255,105,223,255,255,95,220,255,255,86,218,255,255,77,215,255,255,69,213,255,255,61,211,255,255,54,209,255,255,48,208,255,255,42,206,255,255,37,205,255,255,33,182,235,255,29,102,135,255,25,25,41,255,22,22,22,255,19,66,93,255,17,156,209,255,15,181,244,255,13,177,240,255,12,173,237,255,11,170,233,255,11,166,230,255,11,162,225,255,11,155,218,224,11,108,171,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,74,255,255,255,238,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,248,251,253,255,239,237,239,255,197,212,220,255,160,187,213,255,149,186,215,255,137,215,247,255,125,228,255,255,114,225,255,255,104,223,255