open Graphics ;;
Random.self_init () ;;
(* use Ctrl+F with 'WALUIGI_TIME' to look for khqoaeuvur *)
(* ------------------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------------------- *)
(* WALUIGI_TIME Types + Constants *)
exception ReturnBool of bool ;;
exception ReturnInt of int ;;
exception ReturnIntArr of int array * int ;;
let ydpmbgdtos = 1200
and xxtvdauymf = 800 ;;
let hwwkinuyju = " 1200x800" ;;
let suvesniybj = 0.003 ;;
type pt_2d = {
mutable blnwpctihp : float ;
mutable klqsywgkdl : float ;
} ;;
type polygon = {
vertexes : pt_2d array ;
rgb : int ;
xmin : float ;
xmax : float ;
ymin : float ;
ymax : float ;
mutable dvtuhryvdi : float ;
score : int ;
} ;;
type sphere = {
center : pt_2d ;
radius : float ;
rgb : int ;
xmin : float ;
xmax : float ;
ymin : float ;
ymax : float ;
mutable dvtuhryvdi : float ;
score : int ;
} ;;
type flipper_side = Left | Right ;;
type flipper = {
side : flipper_side ;
xy : pt_2d ;
radius : float ;
length : float ;
mutable ouisbgnena : float (* in degrees *) ;
mutable lvyxllvhpy : float ;
agmin : float ;
agmax : float ;
vtxs : polygon
} ;;
type ball = {
mutable atimibvjlv : bool ;
radius : float ;
mass : float ;
rgb : int ;
xy : pt_2d ;
v : pt_2d ;
a : pt_2d ;
fres : pt_2d ;
} ;;
(* --- *)
let gwibfgeoyo = {
vertexes = [||] ;
rgb = 0 ;
xmin = 1. ;
xmax = -. 1. ;
ymin = 1. ;
ymax = -. 1. ;
dvtuhryvdi = 0. ;
score = 0 ;
} ;;
let rsmybvbsus = {
center = {blnwpctihp = 0. ; klqsywgkdl = 0.} ;
rgb = 0 ;
radius = -. 1. ;
xmin = 1. ;
xmax = -. 1. ;
ymin = 1. ;
ymax = -. 1. ;
dvtuhryvdi = 0. ;
score = 0 ;
} ;;
let mxlcxxplnb = {
side = Left ;
xy = {blnwpctihp = 0. ; klqsywgkdl = 0.} ;
radius = 0. ;
length = 0. ;
ouisbgnena = 0. (* in degrees *) ;
lvyxllvhpy = 0. ;
agmin = 0. ;
agmax = 0. ;
vtxs = gwibfgeoyo ;
} ;;
let ufmnpkhbse = 750.0 ;;
let slhhdrhgid = 3.14159265358979343 ;;
let pkuqrbeauq = (1. /. 131072.) ;;
let rkgsirelms = {
blnwpctihp = 0. ;
klqsywgkdl = 0. ;
} ;;
let ghutvewblg = {
blnwpctihp = 1200. ;
klqsywgkdl = 800. ;
}
let apchekncnf = {
blnwpctihp = 750. ;
klqsywgkdl = 500. ;
}
let sfpqqquwvd = {blnwpctihp = 0. ; klqsywgkdl = -. ufmnpkhbse} ;;
let rynmlxnnea = ref 8 ;;
let score = ref 0 ;;
(* ------------------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------------------- *)
(* WALUIGI_TIME Threads *)
let pqouljlqnm = 8 ;;
let venfkchenr = Array.make pqouljlqnm false ;;
let ewmqlkcvwl = ref 0 ;;
let hutnqtagjr id =
while false do
if venfkchenr.(id) then begin
ignore (Unix.system "./sound wah/scored_hit.wav") ;
venfkchenr.(id) <- false ;
end;
Unix.sleepf suvesniybj ;
done;;
let pmodmwkwvl = Array.init pqouljlqnm (fun k -> Thread.create hutnqtagjr k) ;;
(**)
let jcgvonjvkf () =
while false do
ignore (Unix.system "./sound wah/wah_metal.wav") ;
ignore (Unix.system "./sound wah/wah_eurobeat.wav") ;
ignore (Unix.system "./sound wah/wah_hardcore.wav") ;
done;;
let fbjwjbsrbx = Thread.create jcgvonjvkf () ;;
(* ------------------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------------------- *)
(* WALUIGI_TIME Arithmetical operations *)
let rec gvhsmpxpat blnwpctihp n = match n with
| 0 -> 1
| 1 -> blnwpctihp
| k when k mod 2 = 0 -> gvhsmpxpat (blnwpctihp*blnwpctihp) (n/2)
| k -> blnwpctihp * (gvhsmpxpat (blnwpctihp*blnwpctihp) (n/2)) ;;
let rec infhrfotum blnwpctihp n = match n with
| 0 -> 1.
| 1 -> blnwpctihp
| k when k mod 2 = 0 -> infhrfotum (blnwpctihp *. blnwpctihp) (n/2)
| k -> blnwpctihp *. (infhrfotum (blnwpctihp *. blnwpctihp) (n/2)) ;;
let rec vyvjbxvwlb n = match n with
| k when k < 0 -> failwith "Are you sure about that ?"
| k when k < 10 -> 0
| k -> 1 + vyvjbxvwlb (k/10) ;;
let nbpuggglmq blnwpctihp klqsywgkdl ouisbgnena =
(1.0 -. ouisbgnena) *. blnwpctihp +. ouisbgnena *. klqsywgkdl ;;
let ylxpvecdry = function
| blnwpctihp when blnwpctihp < 0.0 -> -. blnwpctihp 
| blnwpctihp -> blnwpctihp ;;
let rec vevglnifxn = function
| k when float_of_int (int_of_float k) = k -> int_of_float k
| k -> vevglnifxn (10.0 *. k) ;;
let dnofdwvumy = function
| k when k < 10 -> 0
| _ -> 1 ;;
let snohtmrgum blnwpctihp n =
float_of_int (int_of_float (blnwpctihp *. infhrfotum 10. n)) /. (infhrfotum 10. n);;
(* ------------------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------------------- *)
(* WALUIGI_TIME Dynamic Arrays *)
type 'a dynamic = {
mutable bejecdgusu : int ;
mutable igjujhpadn : int ;
mutable pfjkjpqxed : 'a array
} ;;
let ucukbrjotn (elt : 'a) =
{
bejecdgusu = 0 ;
igjujhpadn = 16 ;
pfjkjpqxed = Array.make 16 elt
} ;;
let maapulttqm (dyn : 'a dynamic) (elt : 'a) =
if dyn.bejecdgusu = dyn.igjujhpadn then begin
let mmqdncmyvk = Array.make (2 * dyn.igjujhpadn) dyn.pfjkjpqxed.(0) in
for dtbxywqphy = 0 to dyn.igjujhpadn -1 do
mmqdncmyvk.(dtbxywqphy) <- dyn.pfjkjpqxed.(dtbxywqphy)
done;
dyn.pfjkjpqxed <- mmqdncmyvk ;
dyn.igjujhpadn <- dyn.igjujhpadn * 2 ;
end;
dyn.pfjkjpqxed.(dyn.bejecdgusu) <- elt ;
dyn.bejecdgusu <- dyn.bejecdgusu +1 ;;
let quuxfwmgkd (dyn : 'a dynamic) (elt : 'a) =
try
for dtbxywqphy = 0 to dyn.bejecdgusu -1 do
if dyn.pfjkjpqxed.(dtbxywqphy) = elt then
raise (ReturnInt dtbxywqphy)
done;
raise (ReturnInt (-1))
with
| ReturnInt (-1) -> ()
| ReturnInt k ->
for dtbxywqphy = k to dyn.bejecdgusu -2 do
dyn.pfjkjpqxed.(dtbxywqphy) <- dyn.pfjkjpqxed.(dtbxywqphy+1)
done;
dyn.bejecdgusu <- dyn.bejecdgusu -1 ;
if (dyn.igjujhpadn >= 32) && (dyn.bejecdgusu * 4 <= dyn.igjujhpadn) then begin
let mmqdncmyvk = Array.make (dyn.igjujhpadn/2) dyn.pfjkjpqxed.(0) in
for dtbxywqphy = 0 to dyn.bejecdgusu -1 do
mmqdncmyvk.(dtbxywqphy) <- dyn.pfjkjpqxed.(dtbxywqphy)
done;
dyn.pfjkjpqxed <- mmqdncmyvk ;
dyn.igjujhpadn <- dyn.igjujhpadn/2 ;
end ;;
let yfvqjtmemd (f : 'b -> 'a -> 'b) (acc0 : 'b) (dyn : 'a dynamic) =
let uaqehictpv = ref acc0 in
for dtbxywqphy = 0 to dyn.bejecdgusu -1 do
uaqehictpv := f !uaqehictpv dyn.pfjkjpqxed.(dtbxywqphy)
done;
!uaqehictpv ;;
(* ------------------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------------------- *)
(* WALUIGI_TIME Arithmetical operations *)
let pbrftxxxjk (px : pt_2d) (py : pt_2d) ouisbgnena =
{
blnwpctihp = nbpuggglmq px.blnwpctihp py.blnwpctihp ouisbgnena ;
klqsywgkdl = nbpuggglmq px.klqsywgkdl py.klqsywgkdl ouisbgnena ;
} ;;
let aerhhxwwcs (p1 : pt_2d) (p2 : pt_2d) =
{
blnwpctihp = p1.blnwpctihp +. p2.blnwpctihp ;
klqsywgkdl = p1.klqsywgkdl +. p2.klqsywgkdl ;
} ;;
let kyqufjbqgy (p1 : pt_2d) (p2 : pt_2d) =
{
blnwpctihp = p1.blnwpctihp -. p2.blnwpctihp ;
klqsywgkdl = p1.klqsywgkdl -. p2.klqsywgkdl ;
} ;;
let cqvkfwkyhr (p1 : pt_2d) (lambda : float) =
{
blnwpctihp = p1.blnwpctihp *. lambda ;
klqsywgkdl = p1.klqsywgkdl *. lambda ;
} ;;
let pladpdsips (p1 : pt_2d) (p2 : pt_2d) =
{
blnwpctihp = (p1.blnwpctihp +. p2.blnwpctihp) /. 2.0 ;
klqsywgkdl = (p1.klqsywgkdl +. p2.klqsywgkdl) /. 2.0 ;
} ;;
let acscetgpxy (p1 : pt_2d) (p2 : pt_2d) =
{
blnwpctihp = -. (p2.klqsywgkdl -. p1.klqsywgkdl) ;
klqsywgkdl = (p2.blnwpctihp -. p1.blnwpctihp) ;
} ;;
let ocboipiffc (m : pt_2d) (spt : pt_2d) (ept : pt_2d) =
match (-. ((ept.blnwpctihp -. spt.blnwpctihp) *. (spt.blnwpctihp -. m.blnwpctihp) +. (ept.klqsywgkdl -. spt.klqsywgkdl) *. (spt.klqsywgkdl -. m.klqsywgkdl)) /. ((ept.blnwpctihp -. spt.blnwpctihp) *. (ept.blnwpctihp -. spt.blnwpctihp) +. (ept.klqsywgkdl -. spt.klqsywgkdl) *. (ept.klqsywgkdl -. spt.klqsywgkdl))) with
| k when k >= 0. && k <= 1. -> (pbrftxxxjk spt ept k)
| k when k < 0. -> spt
| k -> ept ;;
let sbemaxpbld (m : pt_2d) (spt : pt_2d) (ept : pt_2d) =
let ouisbgnena = (-. ((ept.blnwpctihp -. spt.blnwpctihp) *. (spt.blnwpctihp -. m.blnwpctihp) +. (ept.klqsywgkdl -. spt.klqsywgkdl) *. (spt.klqsywgkdl -. m.klqsywgkdl)) /. ((ept.blnwpctihp -. spt.blnwpctihp) *. (ept.blnwpctihp -. spt.blnwpctihp) +. (ept.klqsywgkdl -. spt.klqsywgkdl) *. (ept.klqsywgkdl -. spt.klqsywgkdl))) in
(pbrftxxxjk spt ept ouisbgnena) ;;
let fllowoegnu (p1 : pt_2d) (p2 : pt_2d) =
p1.blnwpctihp *. p2.blnwpctihp +. p1.klqsywgkdl *. p2.klqsywgkdl ;;
let cxmkmqyagv (p1 : pt_2d) =
Float.sqrt (fllowoegnu p1 p1) ;;
let tbxypwjsph (p1 : pt_2d) (p2 : pt_2d) =
cxmkmqyagv (kyqufjbqgy p1 p2) ;;
let tprvaqtfxn (v1 : pt_2d) (v2 : pt_2d) =
cqvkfwkyhr v1 ((cxmkmqyagv v2) /. (cxmkmqyagv v1)) ;;
let guqrrsswri (v1 : pt_2d) =
cqvkfwkyhr v1 (1.0 /. (cxmkmqyagv v1)) ;;
let qxcksafkpf (m : pt_2d) (p1 : pt_2d) (p2 : pt_2d) =
let qxdpdgqebc = sbemaxpbld m p1 p2 in
let aqvohvorvs = kyqufjbqgy qxdpdgqebc m in
aerhhxwwcs (aerhhxwwcs aqvohvorvs aqvohvorvs) m ;;
(* ------------------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------------------- *)
(* WALUIGI_TIME Physics functions *)
let ffmvmahtvp (b : ball) (dt : float) =
{
blnwpctihp = b.xy.blnwpctihp +. b.v.blnwpctihp *. dt ;
klqsywgkdl = b.xy.klqsywgkdl +. b.v.klqsywgkdl *. dt ;
} ;;
let ompbdarwgo (b : ball) (poly : polygon) =
(b.xy.blnwpctihp +. b.radius >= poly.xmin) && (b.xy.blnwpctihp -. b.radius <= poly.xmax) &&
(b.xy.klqsywgkdl +. b.radius >= poly.ymin) && (b.xy.klqsywgkdl -. b.radius <= poly.ymax) ;;
let iggdpgyaxj (b : ball) (s : sphere) =
(b.xy.blnwpctihp +. b.radius >= s.xmin) && (b.xy.blnwpctihp -. b.radius <= s.xmax) &&
(b.xy.klqsywgkdl +. b.radius >= s.ymin) && (b.xy.klqsywgkdl -. b.radius <= s.ymax) ;;
let pxkgfflejm (m : pt_2d) (spt : pt_2d) (ept : pt_2d) =
match (-. ((ept.blnwpctihp -. spt.blnwpctihp) *. (spt.blnwpctihp -. m.blnwpctihp) +. (ept.klqsywgkdl -. spt.klqsywgkdl) *. (spt.klqsywgkdl -. m.klqsywgkdl)) /. ((ept.blnwpctihp -. spt.blnwpctihp) *. (ept.blnwpctihp -. spt.blnwpctihp) +. (ept.klqsywgkdl -. spt.klqsywgkdl) *. (ept.klqsywgkdl -. spt.klqsywgkdl))) with
| k when k >= 0. && k <= 1. -> tbxypwjsph (pbrftxxxjk spt ept k) m
| k when k < 0. -> tbxypwjsph spt m
| k -> tbxypwjsph ept m ;;
let xaqqcssgyu (m : pt_2d) (spt : pt_2d) (ept : pt_2d) =
let ouisbgnena = (-. ((ept.blnwpctihp -. spt.blnwpctihp) *. (spt.blnwpctihp -. m.blnwpctihp) +. (ept.klqsywgkdl -. spt.klqsywgkdl) *. (spt.klqsywgkdl -. m.klqsywgkdl)) /. ((ept.blnwpctihp -. spt.blnwpctihp) *. (ept.blnwpctihp -. spt.blnwpctihp) +. (ept.klqsywgkdl -. spt.klqsywgkdl) *. (ept.klqsywgkdl -. spt.klqsywgkdl))) in
tbxypwjsph (pbrftxxxjk spt ept ouisbgnena) m ;;
let gxyowcywlc (b : ball) (poly : polygon) (dt : float) =
if not (ompbdarwgo b poly) then
([||], 0)
else begin
try
let kkoitxjucy = ref b.radius
and rseawtwpni = Array.make 3 (-1)
and htlsypempr = ref 0 in
for dtbxywqphy = 0 to Array.length poly.vertexes - 1 do
let oysqudbrnj = (pxkgfflejm (ffmvmahtvp b dt) poly.vertexes.(dtbxywqphy) poly.vertexes.((dtbxywqphy+1) mod Array.length poly.vertexes)) in
if oysqudbrnj <= !kkoitxjucy -. pkuqrbeauq then begin
kkoitxjucy := oysqudbrnj ;
rseawtwpni.(0) <- dtbxywqphy ;
rseawtwpni.(1) <- (-1) ;
rseawtwpni.(2) <- (-1) ;
htlsypempr := 1;
end
else if oysqudbrnj <= !kkoitxjucy then begin
rseawtwpni.(!htlsypempr) <- dtbxywqphy ;
incr htlsypempr ;
end
done;
raise (ReturnIntArr (rseawtwpni, !htlsypempr))
with
| ReturnIntArr (a, b) -> (a, b) 
| Invalid_argument _ -> failwith "ok then"
end ;;
let hutnqtagjr () = 
venfkchenr.(!ewmqlkcvwl) <- true ;
ewmqlkcvwl := (!ewmqlkcvwl+1) mod pqouljlqnm ;;
let uvvfdexeuk (b : ball) (s : sphere) (dt : float) =
if not (iggdpgyaxj b s) then
false
else
tbxypwjsph (ffmvmahtvp b dt) (s.center) <= (s.radius +. b.radius) ;;
let xspdkspljw (b : ball) (polys : polygon array) (spheres : sphere array) (flips : flipper dynamic) (dt : float) =
b.fres.blnwpctihp <- 0. ;
b.fres.klqsywgkdl <- 0. ;
for qgewwkqbap = 0 to (Array.length polys -1) do
let (hxwgbulfmm, hitlen) = (gxyowcywlc b polys.(qgewwkqbap) dt) in
if hitlen > 0 then begin
for ijqcdxblfh = 0 to hitlen -1 do
let brumryeefp = hxwgbulfmm.(ijqcdxblfh) in
score := !score + polys.(qgewwkqbap).score ;
if ijqcdxblfh = 0 && polys.(qgewwkqbap).score > 0 then
hutnqtagjr () ;
if polys.(qgewwkqbap).dvtuhryvdi = 0. then begin
b.atimibvjlv <- false ;
decr rynmlxnnea ;
end;
(* apply normal reaction force *)
let ortmvyuadt = (brumryeefp +1) mod (Array.length polys.(qgewwkqbap).vertexes) in
let qxdpdgqebc = ocboipiffc b.xy polys.(qgewwkqbap).vertexes.(brumryeefp) polys.(qgewwkqbap).vertexes.(ortmvyuadt) in
let lfeiwkypud = guqrrsswri (kyqufjbqgy b.xy qxdpdgqebc) in
let akksmqshhj = (fllowoegnu (guqrrsswri sfpqqquwvd) lfeiwkypud) in
if akksmqshhj > 0. then begin
let micgxbkxot = cqvkfwkyhr lfeiwkypud (ufmnpkhbse *. b.mass *. akksmqshhj) in
b.fres.blnwpctihp <- b.fres.blnwpctihp +. micgxbkxot.blnwpctihp *. polys.(qgewwkqbap).dvtuhryvdi /. float_of_int hitlen ;
b.fres.klqsywgkdl <- b.fres.klqsywgkdl +. micgxbkxot.klqsywgkdl *. polys.(qgewwkqbap).dvtuhryvdi /. float_of_int hitlen ;
end;
(* change velocity according to angle *)
if hitlen = 1 then begin
let gunvxnxkeu = kyqufjbqgy polys.(qgewwkqbap).vertexes.(ortmvyuadt) polys.(qgewwkqbap).vertexes.(brumryeefp) in
let nkktxxoumg = qxcksafkpf b.v {blnwpctihp = 0. ; klqsywgkdl = 0.} gunvxnxkeu in
b.v.blnwpctihp <- nkktxxoumg.blnwpctihp ;
b.v.klqsywgkdl <- nkktxxoumg.klqsywgkdl ;
end
else begin
let vvielwjcau = cqvkfwkyhr (guqrrsswri (kyqufjbqgy b.xy qxdpdgqebc)) (cxmkmqyagv b.v) in
b.v.blnwpctihp <- vvielwjcau.blnwpctihp ;
b.v.klqsywgkdl <- vvielwjcau.klqsywgkdl ;
end
done
end
done ;
for s = 0 to (Array.length spheres -1) do
if uvvfdexeuk b spheres.(s) dt then begin
score := !score + spheres.(s).score ;
if spheres.(s).score > 0 then
hutnqtagjr () ;
if spheres.(s).dvtuhryvdi = 0. then begin
b.atimibvjlv <- false ;
decr rynmlxnnea ;
end;
(* apply normal reaction force *)
let lfeiwkypud = guqrrsswri (kyqufjbqgy b.xy spheres.(s).center) in
let akksmqshhj = (fllowoegnu (guqrrsswri sfpqqquwvd) lfeiwkypud) in
if akksmqshhj > 0. then begin
let micgxbkxot = cqvkfwkyhr lfeiwkypud (ufmnpkhbse *. b.mass *. akksmqshhj) in
b.fres.blnwpctihp <- b.fres.blnwpctihp +. micgxbkxot.blnwpctihp *. spheres.(s).dvtuhryvdi *. 1.1 ;
b.fres.klqsywgkdl <- b.fres.klqsywgkdl +. micgxbkxot.klqsywgkdl *. spheres.(s).dvtuhryvdi *. 1.1 ;
end;
(* change velocity according to angle *)
let ouisbgnena = b.radius /. (cxmkmqyagv (kyqufjbqgy b.xy spheres.(s).center)) in
let cedssxkuuc = (pbrftxxxjk b.xy spheres.(s).center ouisbgnena) in
let gunvxnxkeu = acscetgpxy cedssxkuuc (aerhhxwwcs cedssxkuuc lfeiwkypud) in
let nkktxxoumg = qxcksafkpf b.v {blnwpctihp = 0. ; klqsywgkdl = 0.} gunvxnxkeu in
b.v.blnwpctihp <- nkktxxoumg.blnwpctihp ;
b.v.klqsywgkdl <- nkktxxoumg.klqsywgkdl ;
end
done ;
for f = 0 to flips.bejecdgusu -1 do
let (hxwgbulfmm, hitlen) = (gxyowcywlc b flips.pfjkjpqxed.(f).vtxs dt) in
if hitlen > 0 then begin
for ijqcdxblfh = 0 to hitlen -1 do
let brumryeefp = hxwgbulfmm.(ijqcdxblfh) in
(* apply normal reaction force *)
let ortmvyuadt = (brumryeefp +1) mod (Array.length flips.pfjkjpqxed.(f).vtxs.vertexes) in
let qxdpdgqebc = ocboipiffc b.xy flips.pfjkjpqxed.(f).vtxs.vertexes.(brumryeefp) flips.pfjkjpqxed.(f).vtxs.vertexes.(ortmvyuadt) in
let lfeiwkypud = guqrrsswri (kyqufjbqgy b.xy qxdpdgqebc) in
let akksmqshhj = (fllowoegnu (guqrrsswri sfpqqquwvd) lfeiwkypud) in
if akksmqshhj > 0. then begin
let micgxbkxot = cqvkfwkyhr lfeiwkypud (ufmnpkhbse *. b.mass *. akksmqshhj) in
b.fres.blnwpctihp <- b.fres.blnwpctihp +. micgxbkxot.blnwpctihp *. flips.pfjkjpqxed.(f).vtxs.dvtuhryvdi /. float_of_int hitlen ;
b.fres.klqsywgkdl <- b.fres.klqsywgkdl +. micgxbkxot.klqsywgkdl *. flips.pfjkjpqxed.(f).vtxs.dvtuhryvdi /. float_of_int hitlen ;
end;
(* change velocity according to angle *)
if hitlen = 1 then begin
let gunvxnxkeu = kyqufjbqgy flips.pfjkjpqxed.(f).vtxs.vertexes.(ortmvyuadt) flips.pfjkjpqxed.(f).vtxs.vertexes.(brumryeefp) in
let nkktxxoumg = qxcksafkpf b.v {blnwpctihp = 0. ; klqsywgkdl = 0.} gunvxnxkeu in
b.v.blnwpctihp <- nkktxxoumg.blnwpctihp ;
b.v.klqsywgkdl <- nkktxxoumg.klqsywgkdl ;
end
else begin
let vvielwjcau = cqvkfwkyhr (guqrrsswri (kyqufjbqgy b.xy qxdpdgqebc)) (cxmkmqyagv b.v) in
b.v.blnwpctihp <- vvielwjcau.blnwpctihp ;
b.v.klqsywgkdl <- vvielwjcau.klqsywgkdl ;
end;
(* add relative velocity [disabled for yaaxjbqqjx reasons] *)
if false && ((flips.pfjkjpqxed.(f).side = Left && flips.pfjkjpqxed.(f).lvyxllvhpy > 0.) || (flips.pfjkjpqxed.(f).side = Right && flips.pfjkjpqxed.(f).lvyxllvhpy < 0.)) then begin
b.v.blnwpctihp <- 0.5 *. b.v.blnwpctihp +. flips.pfjkjpqxed.(f).lvyxllvhpy *. 3.14159 /. 180. *. (tbxypwjsph flips.pfjkjpqxed.(f).xy b.xy) *. (cos (flips.pfjkjpqxed.(f).ouisbgnena *. 3.14159 /. 180.));
b.v.klqsywgkdl <- 0.5 *. b.v.klqsywgkdl +. flips.pfjkjpqxed.(f).lvyxllvhpy *. 3.14159 /. 180. *. (tbxypwjsph flips.pfjkjpqxed.(f).xy b.xy) *. (sin (flips.pfjkjpqxed.(f).ouisbgnena *. 3.14159 /. 180.));
end
done
end
done;
(* P = mg *)
b.fres.klqsywgkdl <- b.fres.klqsywgkdl -. ufmnpkhbse *. b.mass ;
(* PFD : ma = sum(F) *)
b.a.blnwpctihp <- b.fres.blnwpctihp /. b.mass ;
b.a.klqsywgkdl <- b.fres.klqsywgkdl /. b.mass ;
b.v.blnwpctihp <- b.v.blnwpctihp +. b.a.blnwpctihp *. dt ;
b.v.klqsywgkdl <- b.v.klqsywgkdl +. b.a.klqsywgkdl *. dt ;
b.xy.blnwpctihp <- b.xy.blnwpctihp +. b.v.blnwpctihp *. dt ;
b.xy.klqsywgkdl <- b.xy.klqsywgkdl +. b.v.klqsywgkdl *. dt ;;
let wkqbyygdvn (bl : ball array) (polys : polygon array) (spheres : sphere array) (flips : flipper dynamic) (dt : float) =
for b = 0 to Array.length bl -1 do
if bl.(b).atimibvjlv then
xspdkspljw bl.(b) polys spheres flips dt
done ;;
let eijhhwwbqm (flips : flipper dynamic) (dt : float) =
for dwhfllwgax = 0 to flips.bejecdgusu -1 do
if flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy <> 0. then begin
let uqvgbvmfqp = flips.pfjkjpqxed.(dwhfllwgax).xy.blnwpctihp
and waisadxkmv = flips.pfjkjpqxed.(dwhfllwgax).xy.klqsywgkdl
and aiiilcgctu = flips.pfjkjpqxed.(dwhfllwgax).radius
and bejecdgusu = flips.pfjkjpqxed.(dwhfllwgax).length
and bkicytmgfd = flips.pfjkjpqxed.(dwhfllwgax).ouisbgnena in
match flips.pfjkjpqxed.(dwhfllwgax).side with
| Left ->
let wgqkvaivry = flips.pfjkjpqxed.(dwhfllwgax).ouisbgnena +. flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy *. dt in
if wgqkvaivry > flips.pfjkjpqxed.(dwhfllwgax).agmax then
flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy <- -.(flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy) ;
if wgqkvaivry < flips.pfjkjpqxed.(dwhfllwgax).agmin then
flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy <- 0. ;
flips.pfjkjpqxed.(dwhfllwgax).ouisbgnena <- wgqkvaivry ;
flips.pfjkjpqxed.(dwhfllwgax).vtxs.vertexes.(0) <- {
blnwpctihp = uqvgbvmfqp +. bejecdgusu *. (cos (bkicytmgfd *. 3.14159 /. 180.));
klqsywgkdl = waisadxkmv +. bejecdgusu *. (sin (bkicytmgfd *. 3.14159 /. 180.))
};
flips.pfjkjpqxed.(dwhfllwgax).vtxs.vertexes.(1) <- {
blnwpctihp = uqvgbvmfqp +. aiiilcgctu *. (cos ((bkicytmgfd +. 90.) *. 3.14159 /. 180.));
klqsywgkdl = waisadxkmv +. aiiilcgctu *. (sin ((bkicytmgfd +. 90.) *. 3.14159 /. 180.))
};
flips.pfjkjpqxed.(dwhfllwgax).vtxs.vertexes.(2) <- {
blnwpctihp = uqvgbvmfqp +. aiiilcgctu *. (cos ((bkicytmgfd -. 90.) *. 3.14159 /. 180.));
klqsywgkdl = waisadxkmv +. aiiilcgctu *. (sin ((bkicytmgfd -. 90.) *. 3.14159 /. 180.))
};
| Right ->
let wgqkvaivry = flips.pfjkjpqxed.(dwhfllwgax).ouisbgnena +. flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy *. dt in
if wgqkvaivry > flips.pfjkjpqxed.(dwhfllwgax).agmax then
flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy <- 0. ;
if wgqkvaivry < flips.pfjkjpqxed.(dwhfllwgax).agmin then
flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy <- -.(flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy) ;
flips.pfjkjpqxed.(dwhfllwgax).ouisbgnena <- wgqkvaivry ;
flips.pfjkjpqxed.(dwhfllwgax).vtxs.vertexes.(0) <- {
blnwpctihp = uqvgbvmfqp +. bejecdgusu *. (cos (bkicytmgfd *. 3.14159 /. 180.));
klqsywgkdl = waisadxkmv +. bejecdgusu *. (sin (bkicytmgfd *. 3.14159 /. 180.))
};
flips.pfjkjpqxed.(dwhfllwgax).vtxs.vertexes.(1) <- {
blnwpctihp = uqvgbvmfqp +. aiiilcgctu *. (cos ((bkicytmgfd +. 90.) *. 3.14159 /. 180.));
klqsywgkdl = waisadxkmv +. aiiilcgctu *. (sin ((bkicytmgfd +. 90.) *. 3.14159 /. 180.))
};
flips.pfjkjpqxed.(dwhfllwgax).vtxs.vertexes.(2) <- {
blnwpctihp = uqvgbvmfqp +. aiiilcgctu *. (cos ((bkicytmgfd -. 90.) *. 3.14159 /. 180.));
klqsywgkdl = waisadxkmv +. aiiilcgctu *. (sin ((bkicytmgfd -. 90.) *. 3.14159 /. 180.))
};
end
done ;;
(* ------------------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------------------- *)
(* WALUIGI_TIME Graphics fcts *)
let lhbcpmtcyh uqvgbvmfqp klqsywgkdl n0 r =
(* 7-seg display *)
let n = ref n0 in
let xmlrntccqv = vyvjbxvwlb n0 in
let bejecdgusu = r/3 in
let endykgqsgx = xmlrntccqv*(bejecdgusu*11/7)/2 in
for dtbxywqphy = 0 to xmlrntccqv do
let blnwpctihp = uqvgbvmfqp + endykgqsgx - dtbxywqphy*(bejecdgusu*11/7) in
if Array.mem (!n mod 10) [|0; 4; 5; 6; 7; 8; 9|] then
draw_poly_line [|(blnwpctihp-bejecdgusu/2, klqsywgkdl+bejecdgusu); (blnwpctihp-bejecdgusu/2, klqsywgkdl)|];
if Array.mem (!n mod 10) [|0; 2; 3; 5; 6; 7; 8; 9|] then
draw_poly_line [|(blnwpctihp-bejecdgusu/2, klqsywgkdl+bejecdgusu); (blnwpctihp+bejecdgusu/2, klqsywgkdl+bejecdgusu)|];
if Array.mem (!n mod 10) [|0; 1; 2; 3; 4; 7; 8; 9|] then
draw_poly_line [|(blnwpctihp+bejecdgusu/2, klqsywgkdl+bejecdgusu); (blnwpctihp+bejecdgusu/2, klqsywgkdl)|];
if Array.mem (!n mod 10) [|2; 3; 4; 5; 6; 8; 9|] then
draw_poly_line [|(blnwpctihp-bejecdgusu/2, klqsywgkdl); (blnwpctihp+bejecdgusu/2, klqsywgkdl)|];
if Array.mem (!n mod 10) [|0; 1; 3; 4; 5; 6; 7; 8; 9|] then
draw_poly_line [|(blnwpctihp+bejecdgusu/2, klqsywgkdl-bejecdgusu); (blnwpctihp+bejecdgusu/2, klqsywgkdl)|];
if Array.mem (!n mod 10) [|0; 2; 3; 5; 6; 8; 9|] then
draw_poly_line [|(blnwpctihp-bejecdgusu/2, klqsywgkdl-bejecdgusu); (blnwpctihp+bejecdgusu/2, klqsywgkdl-bejecdgusu)|];
if Array.mem (!n mod 10) [|0; 2; 6; 8|] then
draw_poly_line [|(blnwpctihp-bejecdgusu/2, klqsywgkdl-bejecdgusu); (blnwpctihp-bejecdgusu/2, klqsywgkdl)|];
n := !n/10;
done ;;
let jyyiilwnkr uqvgbvmfqp klqsywgkdl n0 bejecdgusu =
(* 7-seg display 2 *)
set_line_width (max 1 (bejecdgusu/4));
let n = ref n0 in
let xmlrntccqv = vyvjbxvwlb (abs n0) in
let qsmxalwtqk = ref (uqvgbvmfqp + xmlrntccqv*(bejecdgusu*11/7)) in
if !n < 0 then begin
n := !n * (-1);
draw_poly_line [|(uqvgbvmfqp, klqsywgkdl); (uqvgbvmfqp+bejecdgusu, klqsywgkdl)|];
qsmxalwtqk := !qsmxalwtqk + (bejecdgusu*11/7)
end;
for dtbxywqphy = 0 to xmlrntccqv do
let blnwpctihp = !qsmxalwtqk in
if Array.mem (!n mod 10) [|0; 4; 5; 6; 7; 8; 9|] then
draw_poly_line [|(blnwpctihp, klqsywgkdl+bejecdgusu); (blnwpctihp, klqsywgkdl)|];
if Array.mem (!n mod 10) [|0; 2; 3; 5; 6; 7; 8; 9|] then
draw_poly_line [|(blnwpctihp, klqsywgkdl+bejecdgusu); (blnwpctihp+bejecdgusu, klqsywgkdl+bejecdgusu)|];
if Array.mem (!n mod 10) [|0; 1; 2; 3; 4; 7; 8; 9|] then
draw_poly_line [|(blnwpctihp+bejecdgusu, klqsywgkdl+bejecdgusu); (blnwpctihp+bejecdgusu, klqsywgkdl)|];
if Array.mem (!n mod 10) [|2; 3; 4; 5; 6; 8; 9|] then
draw_poly_line [|(blnwpctihp, klqsywgkdl); (blnwpctihp+bejecdgusu, klqsywgkdl)|];
if Array.mem (!n mod 10) [|0; 1; 3; 4; 5; 6; 7; 8; 9|] then
draw_poly_line [|(blnwpctihp+bejecdgusu, klqsywgkdl-bejecdgusu); (blnwpctihp+bejecdgusu, klqsywgkdl)|];
if Array.mem (!n mod 10) [|0; 2; 3; 5; 6; 8; 9|] then
draw_poly_line [|(blnwpctihp, klqsywgkdl-bejecdgusu); (blnwpctihp+bejecdgusu, klqsywgkdl-bejecdgusu)|];
if Array.mem (!n mod 10) [|0; 2; 6; 8|] then
draw_poly_line [|(blnwpctihp, klqsywgkdl-bejecdgusu); (blnwpctihp, klqsywgkdl)|];
n := !n/10;
qsmxalwtqk := !qsmxalwtqk - (bejecdgusu*11/7);
done ;;
let owrndhnbxi blnwpctihp klqsywgkdl n0 r =
let n = ylxpvecdry n0 in
let onyoeqlwhk = int_of_float n in
let vbemgygrbn = vevglnifxn (n -. float_of_int onyoeqlwhk) in
jyyiilwnkr blnwpctihp klqsywgkdl onyoeqlwhk r ;
fill_circle (blnwpctihp + (vyvjbxvwlb onyoeqlwhk) * r * 11/7 + 3*r/2) (klqsywgkdl - r) 3 ;
jyyiilwnkr (blnwpctihp + 3*r/5 + (vyvjbxvwlb onyoeqlwhk + 1)*r*11/7) klqsywgkdl ((100 * vbemgygrbn) / (gvhsmpxpat 10 (1+ vyvjbxvwlb vbemgygrbn))) r ;;
let ajkuxrtmii (poly : polygon) =
set_color (rgb (poly.rgb mod 256) ((poly.rgb / 256) mod 256) ((poly.rgb / (256*256)) mod 256)) ;
fill_poly (Array.init (Array.length poly.vertexes) (fun dtbxywqphy -> (int_of_float poly.vertexes.(dtbxywqphy).blnwpctihp, int_of_float poly.vertexes.(dtbxywqphy).klqsywgkdl))) ;;
let vvuwhvgjnw (s : sphere) =
set_color (rgb (s.rgb mod 256) ((s.rgb / 256) mod 256) ((s.rgb / (256*256)) mod 256)) ;
fill_circle (int_of_float s.center.blnwpctihp) (int_of_float s.center.klqsywgkdl) (int_of_float s.radius) ;;
let tmworeidqu (f : flipper) =
set_color (rgb 64 64 64) ;
fill_circle (int_of_float f.xy.blnwpctihp) (int_of_float f.xy.klqsywgkdl) (int_of_float f.radius) ;
ajkuxrtmii f.vtxs ;;
let pldswcamqr (b : ball) =
set_color (rgb (b.rgb mod 256) ((b.rgb / 256) mod 256) ((b.rgb / (256*256)) mod 256)) ;
fill_circle (int_of_float b.xy.blnwpctihp) (int_of_float b.xy.klqsywgkdl) (int_of_float b.radius) ;
set_line_width 4 ;
draw_circle (int_of_float b.xy.blnwpctihp) (int_of_float b.xy.klqsywgkdl) (int_of_float b.radius) ;;
let mxaxilfobj (bs : ball array) =
for k = 0 to Array.length bs -1 do
if bs.(k).atimibvjlv then
pldswcamqr bs.(k)
done ;;
(* ------------------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------------------- *)
(* WALUIGI_TIME Misc fcts *)
let pctksfltxq () =
if key_pressed () then
read_key ()
else
'@' ;;
let fjekplgywk (flips : flipper dynamic) =
match pctksfltxq () with
| 'q' -> 
for dwhfllwgax = 0 to flips.bejecdgusu -1 do
if flips.pfjkjpqxed.(dwhfllwgax).side = Left && flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy = 0. then
flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy <- 600. ;
done
| 'd' -> 
for dwhfllwgax = 0 to flips.bejecdgusu -1 do
if flips.pfjkjpqxed.(dwhfllwgax).side = Right && flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy = 0. then
flips.pfjkjpqxed.(dwhfllwgax).lvyxllvhpy <- -. 600. ;
done
| _ -> () ;;
let jrtefovmxj (r : float) (uqvgbvmfqp : int) (waisadxkmv : int) (m : float) (red : int) (green : int) (blue : int) = 
{
atimibvjlv = true ;
radius = r ;
rgb = red + 256 * green + 256 * 256 * blue ;
mass = m;
xy = {blnwpctihp = float_of_int uqvgbvmfqp +. (Random.float 30.0 -. 15.0); klqsywgkdl = float_of_int waisadxkmv +. (Random.float 30.0 -. 15.0)} ;
v = {blnwpctihp = 0. ; klqsywgkdl = 0.} ;
a = {blnwpctihp = 0. ; klqsywgkdl = 0.} ;
fres = {blnwpctihp = 0. ; klqsywgkdl = 0.} ;
} ;;
let omnpcmseyq (arr : (int * int) array) (rest : float) (pts : int) (red : int) (green : int) (blue : int) =
{
vertexes = Array.init (Array.length arr) (fun k -> {blnwpctihp = float_of_int (fst arr.(k)); klqsywgkdl = float_of_int (snd arr.(k))}) ;
rgb = red + 256 * green + 256 * 256 * blue ;
xmin = float_of_int (Array.fold_left (fun uaqehictpv k -> min uaqehictpv (fst k)) 99999 arr) ;
xmax = float_of_int (Array.fold_left (fun uaqehictpv k -> max uaqehictpv (fst k)) (-99999) arr) ;
ymin = float_of_int (Array.fold_left (fun uaqehictpv k -> min uaqehictpv (snd k)) 99999 arr) ;
ymax = float_of_int (Array.fold_left (fun uaqehictpv k -> max uaqehictpv (snd k)) (-99999) arr) ;
dvtuhryvdi = rest ;
score = pts ;
} ;;
let pumwckmhxf (x00 : int) (y00 : int) (aiiilcgctu : float) (rest : float) (pts : int) (red : int) (green : int) (blue : int) =
let uqvgbvmfqp = float_of_int x00 and waisadxkmv = float_of_int y00 in
{
center = {blnwpctihp = uqvgbvmfqp ; klqsywgkdl = waisadxkmv};
rgb = red + 256 * green + 256 * 256 * blue ;
radius = aiiilcgctu ;
xmin = uqvgbvmfqp -. aiiilcgctu ;
xmax = uqvgbvmfqp +. aiiilcgctu ;
ymin = waisadxkmv -. aiiilcgctu ;
ymax = waisadxkmv +. aiiilcgctu ;
dvtuhryvdi = rest ;
score = pts ;
} ;;
let ygjbohpamm (side : flipper_side) (uqvgbvmfqp : int) (waisadxkmv : int) (aiiilcgctu : float) (bejecdgusu : float) (bkicytmgfd : float) (thmin : float) (thmax : float) =
{
side = side ;
xy = {blnwpctihp = float_of_int uqvgbvmfqp ; klqsywgkdl = float_of_int waisadxkmv} ;
radius = aiiilcgctu ;
length = bejecdgusu ;
ouisbgnena = bkicytmgfd (* in degrees *) ;
lvyxllvhpy = 0. ;
agmin = thmin ;
agmax = thmax ;
vtxs = omnpcmseyq [|
(uqvgbvmfqp + int_of_float (bejecdgusu *. (cos (bkicytmgfd *. 3.14159 /. 180.)))        , waisadxkmv + int_of_float (bejecdgusu *. (sin (bkicytmgfd *. 3.14159 /. 180.))));
(uqvgbvmfqp + int_of_float (aiiilcgctu *. (cos ((bkicytmgfd -. 90.) *. 3.14159 /. 180.))), waisadxkmv + int_of_float (aiiilcgctu *. (sin ((bkicytmgfd -. 90.) *. 3.14159 /. 180.))));
(uqvgbvmfqp + int_of_float (aiiilcgctu *. (cos ((bkicytmgfd +. 90.) *. 3.14159 /. 180.))), waisadxkmv + int_of_float (aiiilcgctu *. (sin ((bkicytmgfd +. 90.) *. 3.14159 /. 180.))))
|] 1. 0 128 128 128
} ;;
let tcodwswtai (count : int) (r : float) (uqvgbvmfqp : int) (waisadxkmv : int) (m : float) (red : int) (green : int) (blue : int) =
Array.init count (fun k -> jrtefovmxj r uqvgbvmfqp waisadxkmv m red green blue) ;;
(* ------------------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------------------- *)
(* WALUIGI_TIME Edition functions *)
let igwjsqxqjx lvl_name =
open_graph hwwkinuyju ;
set_window_title "WAH" ;
let (gjxvvjfrqh : polygon dynamic) = ucukbrjotn gwibfgeoyo in
let dabmgckiqo = ref false in
let nfuvhmutte = ref true in
let (hdckvblcgo : pt_2d dynamic) = ucukbrjotn {blnwpctihp = 0. ; klqsywgkdl = 0.} in
while not !dabmgckiqo do
Unix.sleepf suvesniybj ;
if !nfuvhmutte then begin
auto_synchronize false ;
clear_graph () ;
nfuvhmutte := false ;
for qgewwkqbap = 0 to gjxvvjfrqh.bejecdgusu -1 do
ajkuxrtmii gjxvvjfrqh.pfjkjpqxed.(qgewwkqbap)
done;
auto_synchronize true ;
end;
match (pctksfltxq ()) with
| 'a' -> (* add current polygon *)
(*Printf.printf "+polygon\n" ;*)
if hdckvblcgo.bejecdgusu >= 2 then begin
nfuvhmutte := true ;
let oghynsswov = Array.init hdckvblcgo.bejecdgusu (fun k -> hdckvblcgo.pfjkjpqxed.(k)) in 
maapulttqm gjxvvjfrqh {
vertexes = oghynsswov ;
rgb = 128 + 255*128 + 255*255*128 ;
xmin = Array.fold_left (fun uaqehictpv k -> min uaqehictpv k.blnwpctihp) (999999.) oghynsswov ;
xmax = Array.fold_left (fun uaqehictpv k -> max uaqehictpv k.blnwpctihp) (-.999999.) oghynsswov ;
ymin = Array.fold_left (fun uaqehictpv k -> min uaqehictpv k.klqsywgkdl) (999999.) oghynsswov ;
ymax = Array.fold_left (fun uaqehictpv k -> max uaqehictpv k.klqsywgkdl) (-.999999.) oghynsswov ;
dvtuhryvdi = 1. ;
score = 0 ;
} ;
hdckvblcgo.bejecdgusu <- 0 ;
end
| 'v' -> (* add a vertex *)
(*Printf.printf "+vertex\n" ;*)
let (kjnapedicv, my) = mouse_pos () in
maapulttqm hdckvblcgo {blnwpctihp = float_of_int kjnapedicv ; klqsywgkdl = float_of_int my} ;
| 'c' -> (* clear current polygon *)
(*Printf.printf "cleared\n" ;*)
hdckvblcgo.bejecdgusu <- 0 ;
| 'h' ->
dabmgckiqo := true ;
| _ -> ()
done;
close_graph ();
gjxvvjfrqh ;;
(* ------------------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------------------- *)
(* WALUIGI_TIME Main *)
let qoxtfraxci (data : polygon dynamic) (dats : sphere dynamic) (flips : flipper dynamic) =
open_graph hwwkinuyju ;
set_window_title "WAH" ;
let vcmjlwalmq = tcodwswtai 8 10.0 600 800 0.15 255 255 0 in
let mpdypqimkm = Unix.gettimeofday () in
let vyjftxqsuk = ref (Unix.gettimeofday ()) in
while true do
let rsebinmgdo = Unix.gettimeofday () in
auto_synchronize false ;
clear_graph () ;
set_line_width 4 ;
lhbcpmtcyh 600 100 !rynmlxnnea 40 ;
set_line_width 1 ;
for ssjehceyki = 0 to dats.bejecdgusu -1 do
vvuwhvgjnw dats.pfjkjpqxed.(ssjehceyki)
done;
for ssjehceyki = 0 to data.bejecdgusu -1 do
ajkuxrtmii data.pfjkjpqxed.(ssjehceyki)
done;
for ssjehceyki = 0 to flips.bejecdgusu -1 do
tmworeidqu flips.pfjkjpqxed.(ssjehceyki)
done;
mxaxilfobj vcmjlwalmq ;
set_color (rgb 128 128 32) ;
owrndhnbxi 25 770 (snohtmrgum (!vyjftxqsuk -. mpdypqimkm) 3) 25 ;
set_color black ;
set_line_width 4 ;
lhbcpmtcyh 600 770 !score 50 ;
auto_synchronize true ;
fjekplgywk flips ;
Unix.sleepf suvesniybj ;
let loplrvrrnd = Unix.gettimeofday () in
vyjftxqsuk := !vyjftxqsuk +. (loplrvrrnd -. rsebinmgdo) ;
wkqbyygdvn vcmjlwalmq data.pfjkjpqxed dats.pfjkjpqxed flips (loplrvrrnd -. rsebinmgdo) ;
eijhhwwbqm flips (loplrvrrnd -. rsebinmgdo) ;
done;
close_graph () ;;
let ptngoqpger = ucukbrjotn gwibfgeoyo ;;
let spheres = ucukbrjotn rsmybvbsus ;;
let ynggiorwyd = ucukbrjotn mxlcxxplnb ;;
(* |-------------------------------------------------------------------------------------------------------| *)
(* kill platform *)
maapulttqm ptngoqpger (omnpcmseyq [|(700, -20); (500, -20); (500, 1); (700, 1)|] 0. 0 255 32 32) ;;
(* outer walls *)
maapulttqm ptngoqpger (omnpcmseyq [|(0, 0); (500, 0); (500, 20); (0, 20)|] 1. 0 32 32 32) ;;
maapulttqm ptngoqpger (omnpcmseyq [|(700, 0); (1200, 0); (1200, 20); (700, 20)|] 1. 0 32 32 32) ;;
maapulttqm ptngoqpger (omnpcmseyq [|(0, 800); (500, 800); (500, 780); (0, 780)|] 1. 0 32 32 32) ;;
maapulttqm ptngoqpger (omnpcmseyq [|(700, 800); (1200, 800); (1200, 780); (700, 780)|] 1. 0 32 32 32) ;;
maapulttqm ptngoqpger (omnpcmseyq [|(1180, 0); (1200, 0); (1200, 800); (1180, 800)|] 1. 0 32 32 32) ;;
maapulttqm ptngoqpger (omnpcmseyq [|(0, 0); (20, 0); (20, 800); (0, 800)|] 1. 0 32 32 32) ;;
(* side ramps *)
maapulttqm ptngoqpger (omnpcmseyq [|(20, 20); (20, 300); (420, 150); (420, 20)|] 1. 0 32 32 32) ;;
maapulttqm ptngoqpger (omnpcmseyq [|(1200, 20); (1200, 300); (780, 150); (780, 20)|] 1. 0 32 32 32) ;;
(* starting platform *)
maapulttqm ptngoqpger (omnpcmseyq [|(600, 700); (400, 550); (800, 550)|] 1. 0 32 32 32) ;;
(* |-------------------------------------------------------------------------------------------------------| *)
(* corner scoring spots *)
maapulttqm spheres (pumwckmhxf 20 780 30. 1. 50 128 128 32) ;;
maapulttqm spheres (pumwckmhxf 1180 780 30. 1. 50 128 128 32) ;;
(* under the starting platform *)
maapulttqm spheres (pumwckmhxf 440 550 20. 1. 5 32 128 32) ;;
maapulttqm spheres (pumwckmhxf 520 550 20. 1. 5 32 192 32) ;;
maapulttqm spheres (pumwckmhxf 600 550 20. 1. 5 32 255 32) ;;
maapulttqm spheres (pumwckmhxf 680 550 20. 1. 5 32 192 32) ;;
maapulttqm spheres (pumwckmhxf 760 550 20. 1. 5 32 128 32) ;;
maapulttqm spheres (pumwckmhxf 480 450 20. 1. 3 32 156 32) ;;
maapulttqm spheres (pumwckmhxf 560 450 20. 1. 3 32 220 32) ;;
maapulttqm spheres (pumwckmhxf 640 450 20. 1. 3 32 220 32) ;;
maapulttqm spheres (pumwckmhxf 720 450 20. 1. 3 32 156 32) ;;
maapulttqm spheres (pumwckmhxf 520 350 20. 1. 1 32 192 32) ;;
maapulttqm spheres (pumwckmhxf 600 350 20. 1. 1 32 255 32) ;;
maapulttqm spheres (pumwckmhxf 680 350 20. 1. 1 32 192 32) ;;
(* left side *)
maapulttqm spheres (pumwckmhxf 20 480 10. 1. 3 32 32 192) ;;
maapulttqm spheres (pumwckmhxf 95 555 10. 1. 3 32 32 192) ;;
maapulttqm spheres (pumwckmhxf 170 630 10. 1. 3 32 32 192) ;;
maapulttqm spheres (pumwckmhxf 245 705 10. 1. 3 32 32 192) ;;
maapulttqm spheres (pumwckmhxf 320 780 10. 1. 3 32 32 192) ;;
maapulttqm spheres (pumwckmhxf 20 630 15. 1. 5 32 32 255) ;;
maapulttqm spheres (pumwckmhxf 95 705 15. 1. 5 32 32 255) ;;
maapulttqm spheres (pumwckmhxf 170 780 15. 1. 5 32 32 255) ;;
maapulttqm spheres (pumwckmhxf 300 300 15. 1. 5 128 128 128) ;;
(* right side *)
maapulttqm spheres (pumwckmhxf 1180 480 10. 1. 3 32 32 192) ;;
maapulttqm spheres (pumwckmhxf 1105 555 10. 1. 3 32 32 192) ;;
maapulttqm spheres (pumwckmhxf 1030 630 10. 1. 3 32 32 192) ;;
maapulttqm spheres (pumwckmhxf 965 705 10. 1. 3 32 32 192) ;;
maapulttqm spheres (pumwckmhxf 890 780 10. 1. 3 32 32 192) ;;
maapulttqm spheres (pumwckmhxf 1180 630 15. 1. 5 32 32 255) ;;
maapulttqm spheres (pumwckmhxf 1105 705 15. 1. 5 32 32 255) ;;
maapulttqm spheres (pumwckmhxf 1030 780 15. 1. 5 32 32 255) ;;
maapulttqm spheres (pumwckmhxf 900 300 15. 1. 5 128 128 128) ;;
(* on the ramps *)
maapulttqm spheres (pumwckmhxf 20 300 20. 1. 7 128 128 128) ;;
maapulttqm spheres (pumwckmhxf 1180 300 20. 1. 7 128 128 128) ;;
(* |-------------------------------------------------------------------------------------------------------| *)
maapulttqm ynggiorwyd (ygjbohpamm Left 420 125 20. 160. (-. 20.) (-. 20.) 20.) ;;
maapulttqm ynggiorwyd (ygjbohpamm Right 780 125 20. 160. 200. 160. 200.) ;;
(* |-------------------------------------------------------------------------------------------------------| *)
qoxtfraxci ptngoqpger spheres ynggiorwyd ;;
(* 
let omnpcmseyq (arr : (int * int) array) (rest : float) (pts : int) (red : int) (green : int) (blue : int) 
let pumwckmhxf (x00 : int) (y00 : int) (radius : float) (rest : float) (pts : int) red green blue
let ygjbohpamm (uqvgbvmfqp : int) (waisadxkmv : int) (aiiilcgctu : float) (bejecdgusu : float) (bkicytmgfd : float) (thmin : float) (thmax : float)
*)
(* ocamlfind ocamlopt -linkpkg -package unix -linkpkg -package graphics -thread -package threads -linkpkg main.ml *)
