'Pimp My Boxes' Contest

Blitz3D Forums/Blitz3D Programming/'Pimp My Boxes' Contest

Techlord(Posted 2004) [#1]
Just a lil contest for fun to see who can align random sized boxes the fastest.

Rules:

1. Align boxes next to one another without overlaping on screen.

2. Waste minimum screen space.

Heres my super fast boxAlign Entry:



BlackD(Posted 2004) [#2]
Hehe.. this sounds like a Halo-esque "I need a routine to do (x) efficiently.. I know, I'll get Blitzer's to do it and call it a competition".

+BlackD :)


Techlord(Posted 2004) [#3]
Hehe.. this sounds like a Halo-esque "I need a routine to do (x) efficiently.. I know, I'll get Blitzer's to do it and call it a competition".

BlackD,

True. So the question remains can you write a faster routine?


Who was John Galt?(Posted 2004) [#4]
i'm not going to try it, but I think the trick is to order the boxes by size. place the largest one in a corner (probably got a choice of 2 dirs) and try permuations from there.


Damien Sturdy(Posted 2004) [#5]
Speed? Christ man, were in 3ghz machines now! speed doesnt matter!???? :P hehehe


fredborg(Posted 2004) [#6]
Add this line after the boxesoverlap = boxesoverlap + blabla

If boxesoverlap Then Exit

And it's about 6 times faster. It's not hard to make it a lot faster but I'm not telling :)


Techlord(Posted 2004) [#7]
Fredborg,

Come on be a sport and let the cat out of the bag:)


fredborg(Posted 2004) [#8]
Ok, ok, I will tell:

Still fairly slow and wasting a lot of space :D

With a few small modifications I got it down to 30ms for 120 boxes with an area usage of 90% on average (this version takes 730ms and has an area usage of 84% for the same boxes)


jfk EO-11110(Posted 2004) [#9]
So you're both working on a Lightmapper or what? :P


Techlord(Posted 2004) [#10]
So far, Fredborg "Pimpin Box' code is the fastest. Any other challengers???


fredborg(Posted 2004) [#11]
I believe this is close to the fastest possible:

But not always very effecient :) It's best with a large number of boxes, with little size variation.


Techlord(Posted 2004) [#12]
WOW


fredborg(Posted 2004) [#13]
The slow part is obviously the sorting...Anybody got a quicksort that works with types?

3 ms for 120 boxes, while the original took 133702 ms...LOL!


fredborg(Posted 2004) [#14]
The fastest possible method:

The QuickSort is modified from Noel Cower's Code Archives entry.

24ms (or less) for 10000 boxes! Beat that monkeys!


Techlord(Posted 2004) [#15]
10000 Boxes PIMP'd!