r57shell wrote: ↑
Thu Aug 17, 2017 9:12 am
Yes. It's not supposed to have explanation.
1) Just copypaste this code.
2) Put "glpk\glpsol.exe".
3) Add into this code, reading of your sprite and which fills BMP array in code.
4) run "Algorithm" part.
5) check out res1 array as result.
Sprite class has .sx() .sy() methods that say size in tiles. And x, y position in pixels.
Your code does:
1. Shift x/y the image to find the arrangement with less empty tiles
2. Label empty tiles
3. for every tile
- Try to "enlarge" a sprite as big as possible
If I understand it correctly, is the same idea Sik has but plus the shifting. The problem is it doesn't minimize sprite count. But in real life is better to have something up and running, than the perfect idea in you head.
That's the problem with such algorithms, (0 is empty tile, 1 is non-empty):
The optimal solution is one sprite of 4x4 and one of 1x1,
instead if we "enlarge" sprites, 3 sprites will be generated, for example 4x1, 1x4, 3x3:
It’s not what you think.
Perhaps, just perhaps, is our family making sure we listen from now on.
We need to talk about Mercury too.
We need to talk about so many things… I fear I don’t remember all.