This is one of the things that I wanted to do before the fair…. but time was not enough….
The maps look much better now, take a look at the pic:
To the left, the map without cleaning, to the right, the map after cleaning…
I designed the algortihm pretty quickly, as it is not very complicated…. however I had Stack problems, as it was a recursive algorithm, and the 512*512 quickly ate all the Stack…. dunno why… whatever, I tought on conversing the recursive algo into an interative algo using a Stack, it worked out ok, but was DAMN slow!!!! I struggled looking for the cause, but the 512*512 map would take 20 MINUTES to be cleaned up!!!!
In the end it was something pretty simple…. I was creating an IntStack object for every cell that had to be scanned for region size! Java surely sucks at creating objects…. whatever in the end I had to make my own Stack implementation (IntStack), using an int vector, and then I cleaned it for each mapcell that had to be scanned for its region size (just resetting the top of the stack to -1 😉 )
Now gotta work in the rain & weather algo!!! see you then!