Challenge: 
Winner?: 
Yes
Code Snippet: 
`The Usual Setup
sync on
sync rate 30
autocam off
hide mouse
randomize timer()
set text font "Gungsuh"
`Variables
sw=screen width()
sh=screen height()
type car_info
     acc as float
     wpt as integer
     lap as integer
     finish as boolean
endtype
dim car(8) as car_info
type way_point
     x as integer
     z as integer
endtype
dim way(20) as way_point
null=make vector2(1)
null=make vector2(2)
dim pt(8) as string
pt(1)="st"
pt(2)="nd"
pt(3)="rd"
for i=4 to 8
    pt(i)="th"
next i
place=8
dim comment(8) as string
comment(1)="Congradulations, you are God"
comment(2)="Ok, now you'll have to play again"
comment(3)="You still get a medal"
comment(4)="Do better"
comment(5)="Now your not even in the top 50%"
comment(6)="Shame"
comment(7)="You could have done worse"
comment(8)="Seek help"
`Stolen from Hobgoblin Lord
type note_thing
   note as integer
   speed as integer
   volume as integer
endtype
dim master_note(-1) as note_thing
make_midi("R",25,2,"a4 a4 a4 g5")
load music "r.mid",1
`Grass
make_image_memblock(1,32,32,32)
for x=1 to 32
    for y=1 to 32
        memblock_dot(1,x,y,rgb(rnd(128),rnd(128)+127,0))
    next y
next x
make image from memblock 10,1
`Road
for x=1 to 32
    for y=1 to 32
        c=rnd(20)+127
        memblock_dot(1,x,y,rgb(c,c,c))
    next y
next x
make image from memblock 11,1
`Wall
for x=1 to 32
    for y=1 to 32
        c=rnd(60)
        memblock_dot(1,x,y,rgb(c,c,c))
    next y
next x
make image from memblock 12,1
`Boost
for x=1 to 32
    for y=1 to 32
        memblock_dot(1,x,y,rgb(255,x*50 mod 256,0))
    next y
next x
make image from memblock 15,1
delete memblock 1
set text size 14
color backdrop rgb(29, 94, 99)
`Choose Track
track=1
repeat
if escapekey()=1
   end
endif
sync
set cursor 0,0
print "Select a track"
print ""
dim trackname(3) as string
trackname(1)="Winding Willow"
trackname(2)="Spring Track"
trackname(3)="Checker Field"
sprite 1,-10,-10,10
size sprite 1,10,10
for i=1 to 3
    if i=track
       ink rgb(123, 123, 238),0
       arrow$=" <--------"
    else
       ink -1,0
       arrow$=""
    endif
    print trackname(i)+arrow$
next i
select track
    case 1
        restore track1
    endcase
    case 2
        restore track2
    endcase
    case 3
        restore track3
    endcase
endselect
for x=1 to 30
    for z=1 to 30
        read road
        select road
            case 0
                set sprite image 1,10
            endcase
            case 1
                set sprite image 1,11
            endcase
            case 2
                set sprite image 1,12
            endcase
            case 3
                set sprite image 1,15
            endcase
        endselect
        paste sprite 1,x*10+200,400-z*10
    next z
next x
track=track-upkey()+downkey()
if track<1
   track=1
endif
if track>3
   track=3
endif
ink -1,0
until returnkey()=1
delete sprite 1
`Make Car
set camera range 10,10000
color backdrop rgb(0, 210, 255)
make object box 1,50,30,100
make object box 2,10,10,15
make mesh from object 1,2
delete object 2
add limb 1,1,1
offset limb 1,1,0,20,-40
delete mesh 1
make object box 2,60,6,20
make mesh from object 1,2
delete object 2
add limb 1,2,1
offset limb 1,2,0,23,-40
delete mesh 1
make object sphere 2,100,6,6
scale object 2,6,25,25
make mesh from object 1,2
delete object 2
add limb 1,3,1
offset limb 1,3,28,-10,30
add limb 1,4,1
offset limb 1,4,-28,-10,30
add limb 1,5,1
offset limb 1,5,28,-10,-30
add limb 1,6,1
offset limb 1,6,-28,-10,-30
delete mesh 1
scale object 1,50,50,50
`Car colors
make_image_memblock(1,1,1,32)
for image=1 to 8
    memblock_dot(1,1,1,rgb(rnd(255),rnd(255),rnd(255)))
    make image from memblock image,1
next image
`Black Tire
memblock_dot(1,1,1,rgb(0,0,0))
make image from memblock 9,1
delete memblock 1
`Speedometer
make_image_memblock(1,256,128,32)
for thickness=0 to 2
    memblock_circle(1,128,128+thickness,128,rgb(255,255,255))
next thickness
for ang=-90 to 90 step 10
    memblock_line(1,int((cos(ang)-sin(ang)*30+129)),int((sin(ang)-cos(ang)*30+129)),int((cos(ang)-sin(ang)*120+129)),int((sin(ang)-cos(ang)*120+129)),rgb(255,255,255))
next ang
make image from memblock 13,1
delete memblock 1
sprite 1,sw-256,sh-152,13
hide sprite 1
`Speedometer needle
make_image_memblock(1,10,120,32)
memblock_circle(1,5,115,5,rgb(255,0,0))
for thickness=-2 to 2
    memblock_line(1,5+thickness,110,5+thickness,1,rgb(255,0,0))
next thickness
make image from memblock 14,1
delete memblock 1
sprite 2,sw-130,sh-24,14
offset sprite 2,0,115
hide sprite 2
`Make enemies
for car=2 to 8
    clone object car,1
next car
for car=1 to 8
    texture object car,car   
    for i=3 to 6
        texture limb car,i,9
    next i
    position object car,cos(car*180)*40+3700,0,car*40+2100
next car
`Make track
obj=9
dim track(30,30)
select track
   case 1
      restore track1
   endcase
   case 2
      restore track2
   endcase
   case 3
      restore track3
   endcase
endselect   
for x=1 to 30
    for z=1 to 30
        read road
        track(x,z)=road
        if road<2
            make object plain obj,200,200,1
            xrotate object obj,90
            position object obj,x*200,-20,z*200
            texture object obj,10+road
        else
            if road=2
                make object box obj,200,50,200
                position object obj,x*200,5,z*200
                texture object obj,12
            else
                make object plain obj,200,200,1
                xrotate object obj,90
                position object obj,x*200,-20,z*200
                texture object obj,15
            endif
        endif
        inc obj
    next z
next x
`Set waypoints for ai and keeping track of place
select track
    case 1
        way(0).x=19
        way(0).z=13
        way(1).x=20
        way(1).z=16
        way(2).x=26
        way(2).z=18
        way(3).x=29
        way(3).z=22
        way(4).x=23
        way(4).z=27
        way(5).x=15
        way(5).z=26
        way(6).x=13
        way(6).z=17
        way(7).x=11
        way(7).z=16
        way(8).x=8
        way(8).z=19
        way(9).x=8
        way(9).z=25
        way(10).x=4
        way(10).z=24
        way(11).x=4
        way(11).z=15
        way(12).x=7
        way(12).z=11
        way(13).x=8
        way(13).z=4
        way(14).x=17
        way(14).z=4
        way(15).x=20
        way(15).z=3
        way(16).x=21
        way(16).z=7
        way(17).x=18
        way(17).z=10
        numways=17
    endcase
    case 2
        way(0).x=19
        way(0).z=15
        way(1).x=23
        way(1).z=16
        way(2).x=25
        way(2).z=6
        way(3).x=23
        way(3).z=3
        way(4).x=10
        way(4).z=3
        way(5).x=6
        way(5).z=10
        way(6).x=3
        way(6).z=13
        way(7).x=5
        way(7).z=18
        way(8).x=4
        way(8).z=23
        way(9).x=6
        way(9).z=26
        way(10).x=11
        way(10).z=25
        way(11).x=15
        way(11).z=28
        way(12).x=26
        way(12).z=27
        way(13).x=27
        way(13).z=22
        way(14).x=17
        way(14).z=21
        way(15).x=14
        way(15).z=10
        way(16).x=18
        way(16).z=9
        numways=16
    endcase
    case 3
        way(0).x=17
        way(0).z=15
        way(1).x=12
        way(1).z=15
        way(2).x=12
        way(2).z=6
        way(3).x=4
        way(3).z=5
        way(4).x=4
        way(4).z=10
        way(5).x=6
        way(5).z=12
        way(6).x=3
        way(6).z=16
        way(7).x=6
        way(7).z=26
        way(8).x=12
        way(8).z=23
        way(9).x=15
        way(9).z=24
        way(10).x=20
        way(10).z=23
        way(11).x=26
        way(11).z=22
        way(12).x=26
        way(12).z=13
        way(13).x=24
        way(13).z=5
        way(14).x=21
        way(14).z=5
        numways=14
    endcase
endselect
`Smooth glide to show off
set text size 100
position camera 0,5000,0
point camera 3000,0,3000
for i=1 to 400
    sync
    txt$="Get Ready!  "
    if i=310
        play music 1
    endif
    if i>=310
       txt$=txt$+str$((400-i)/30+1)
    endif
    ink rgb(0, 0, 160),0
    center text screen width()/2-5,screen height()/2-55,txt$
    ink -1,0
    center text screen width()/2,screen height()/2-50,txt$
    position camera curvevalue(object position x(1),camera position x(),80),curvevalue(1000,camera position y(),80),curvevalue(object position z(1),camera position z(),80)
    rotate camera curveangle(90,camera angle x(),80),curveangle(0,camera angle y(),80),curveangle(0,camera angle z(),80)
next i
`Final bit of setup
rotate camera 90,0,0
set text size 24
show sprite 1
show sprite 2
`Main Loop
repeat
if escapekey()=1
   end
endif
sync
`Display HUD
text 0,0,"Lap: "+str$(car(1).lap+1)
text 0,30,"Place: "+str$(place)+pt(place)
speed$=str$(int(abs(car(1).acc*3)))+" mph"
text sw-text width(speed$),sh-24,speed$
rotate sprite 2,abs(car(1).acc*3)-90
`Control player
oldx#=object position x(1)
oldz#=object position z(1)
`text 0,60,"X: "+str$(int(oldx#/200+0.5))+" Z: "+str$(int(oldz#/200+0.5))
road=track(int(oldx#/200+0.5),int(oldz#/200+0.5))
select road
    case 0
        friction#=.95
    endcase
    case 1
        friction#=.98
    endcase
    case 3
        friction#=1.2
    endcase
endselect
car(1).acc=car(1).acc*friction#+(((upkey()+keystate(17))>0)-((downkey()+keystate(31))>0)*.4)*.7
move object 1,car(1).acc
turn=((rightkey()+keystate(32))>0)-((leftkey()+keystate(30))>0)
yrotate object 1,object angle y(1)+turn*4
rotate limb 1,3,0,turn*10,0
rotate limb 1,4,0,turn*10,0
rotate limb 1,5,0,-turn*10,0
rotate limb 1,6,0,-turn*10,0
newx#=object position x(1)
newz#=object position z(1)
colwith=object collision(1,0)
if colwith>0
   position object 1,oldx#+(newx#-object position x(colwith))*.01,0,oldz#+(newz#-object position z(colwith))*.01
   car(1).acc=car(1).acc*.1
endif
wx=way(car(1).wpt).x*200
wz=way(car(1).wpt).z*200
set vector2 1,object position x(1),object position z(1)
set vector2 2,wx,wz
subtract vector2 2,1,2
dist#=length vector2(2)
if dist#<1000
   car(1).wpt=car(1).wpt+1
   if car(1).wpt>numways
      car(1).wpt=0
      car(1).lap=car(1).lap+1
   endif
endif
position camera object position x(1),1000,object position z(1)
tx=int(object position x(1)/200+0.5)
tz=int(object position z(1)/200+0.5)
if car(1).lap=5 and tx>16 and tx<22 and tz=13
    car(1).finish=1
endif
`Control ai
for ai=2 to 8
    ca#=object angle y(ai)
    wx=way(car(ai).wpt).x*200
    wz=way(car(ai).wpt).z*200
    point object ai,wx,0,wz
    na#=object angle y(ai)
    rotate object ai,0,curveangle(na#,ca#,10),0
    road=track(int(object position x(ai)/200+0.5),int(object position z(ai)/200+0.5))
    select road
        case 0
            friction#=.95
        endcase
        case 1
            friction#=.98
        endcase
        case 3
            friction#=1.2
        endcase
    endselect
    car(ai).acc=car(ai).acc*friction#+rnd(100)/100.0+.1
    oldx#=object position x(ai)
    oldz#=object position z(ai)
    move object ai,car(ai).acc
    newx#=object position x(ai)
    newz#=object position z(ai)   
    colwith=object collision(ai,0)
    if colwith>0
       position object ai,oldx#+(newx#-object position x(colwith))*.01,0,oldz#+(newz#-object position z(colwith))*.01
       car(ai).acc=car(ai).acc*.1
    endif
    set vector2 1,object position x(ai),object position z(ai)
    set vector2 2,wx,wz
    subtract vector2 2,1,2
    dist#=length vector2(2)
    if dist#<150
       car(ai).wpt=car(ai).wpt+1
       if car(ai).wpt>numways
          car(ai).wpt=0
          car(ai).lap=car(ai).lap+1
       endif
    endif
    tx=int(object position x(ai)/200+0.5)
    tz=int(object position z(ai)/200+0.5)
    if car(ai).lap=5 and tx>16 and tx<22 and tz=13
        car(ai).finish=1
    endif
next ai
place=1
for i=2 to 8
    if car(i).lap>car(1).lap or car(i).lap=car(1).lap and car(i).wpt=>car(1).wpt
       inc place
    endif
next i
until car(1).finish=1
`Display final info
delete objects 1,obj-1
delete sprite 1
delete sprite 2
color backdrop 0
set text size 50
cls
place=1
for i=2 to 8
    if car(i).finish=1
        inc place
    endif
next i
center text screen width()/2,screen height()/2-25,"You ranked "+str$(place)+pt(place)
set text size 30
center text screen width()/2,screen height()/2+15,comment(place) 
sync
wait key
end
track1:
data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,3,1,1,0,0,0,0,2
data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,2
data 2,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,2
data 2,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,2,2,2,2,2,2,2,0,1,1,0,0,0,2
data 2,0,0,1,1,1,1,1,1,1,1,1,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