'Pimp My Boxes' Contest
Blitz3D Forums/Blitz3D Programming/'Pimp My Boxes' Contest
| ||
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: |
| ||
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 :) |
| ||
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? |
| ||
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. |
| ||
Speed? Christ man, were in 3ghz machines now! speed doesnt matter!???? :P hehehe |
| ||
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 :) |
| ||
Fredborg, Come on be a sport and let the cat out of the bag:) |
| ||
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) |
| ||
So you're both working on a Lightmapper or what? :P |
| ||
So far, Fredborg "Pimpin Box' code is the fastest. Any other challengers??? |
| ||
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. |
| ||
WOW |
| ||
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! |
| ||
The fastest possible method: The QuickSort is modified from Noel Cower's Code Archives entry. 24ms (or less) for 10000 boxes! Beat that monkeys! |
| ||
10000 Boxes PIMP'd! |