> > > Update: I have a failing unit test case. I do not yet have a clean
> > > for it. It's not trivial but it's not super-hard either. I expect to
> > > have this fixed by Friday night.
> > All right. It's not a big deal is it 1 day or 3 days (but 1 week or
> > 3 weeks is slightly different story ;-)
> The good: I think my fix works.
Indeed, sounds good!
> The bad: The core LOS function now takes even more arguments. I was
> hoping I could avoid this last night, but now I'm convinced I can't.
no pain no gain...
> I'll probably be able to commit it tonight. Needs another unit test
> case and then some manual testing.
> P.S. I'm thinking of splitting the big LOS function into four smaller
Are you referring to this one:
protected boolean isLOSBlockedDir(BattleHex initialHex,
BattleHex currentHex, BattleHex finalHex, boolean left,
int strikeElevation, boolean strikerAtop, boolean strikerAtopCliff,
boolean midObstacle, boolean midCliff, boolean midChit,
Somehow I don't see how one could split this and have less arguments.
It's a recursion, and the inner instances need the state knowledge of the
outer - all of it, or not?
I mean, the result depends on combinations of "ok, midchit is ok if
striker is atop cliff" etc., i.e. of information collected in previous hexes.
(perhaps one could transform the whole thing into a loop ?)
So I can imagine one can factor out some parts into smaller methods, but the
overall recursive method would still need all those parameters. So thinks I.
But, I will let you surprise me :o)
> functions: one for obstacle hexes, one for obstacle characters, one for
> cliffs and dunes and slopes, and one for walls. This would be more
> overall code and would probably be slower (but probably not enough
> slower to really matter, so the fact that 3 of the 4 functions could be
> memoized is probably not important), but each of the functions would be
> simpler and would take a more reasonable number of parameters. But I
> don't want to attempt that big change yet.
I agree fully on that.
> Maybe after this release.
ok let's see.
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser