Welcome to the DEFCON forums, where everything gets turned into an argument
Oh god, you're right :O
xander, let's agree to differ one this one
Finally, the acronym is PEMDAS: parentheses (or brackets, as you silly Europeans call them), exponents, multiplication and division, and addition and subtraction.
I've never heard of PEMDAS, the various ones I have heard through the years are BODMAS and BIDMAS (I can't remember what the O stands for, if I remember correctly that was before we learnt about exponents and it's basically just a placeholder, the I stands for indices, and I always thought BEDMAS would make more sense).
xander wrote:Moreover, it is even bad code, as I highly doubt that you would be using x in that situation (it is likely that "x" would already be used for something else).
You obviously haven't seen martin's code
In all seriousness, I have no idea if my Lua code is good or not, I'm writing it in a pretty strong OOP style, which is probably not classical Lua style.
martin wrote:Use a flood fill algorithm:
1) Generate all points in the ocean and add them to a set
I tried doing this with the first coroutine setup and it was extremely slow.
Are you doing this? What algorithm and step values do you use? Is it fast enough?
I'm not, but I am doing something similar with surveying the land around my cities for find the best place to put silos
I was talking in pseudo code, you can probably do it somewhat better than that in reality
1) Pick a random point in the ocean and add to a set foo
2) Generate all surrounding points, for each point which is _not_ in the set foo do step add to set and do step 2
3) At the end, if foo does not contain all ocean points, then you have a discontinuous ocean.
Determining step 3 is not trivial, but I'm sure some simple solution can be found (it's 9am, I'm not gonna figure out how to do it right now)
Finally, for an implementation of a set in Lua, see the Joshua/Utilities folder