OU blog

Personal Blogs

neil

group action

Visible to anyone in the world

When I originally wrote the hashCode(), equals() and compareTo() methods for the Peg Class I didn't really think about comparing Boards.

Now that I'm there I see serious problems. I can write an algorithm, but even in pencil, on A4, it looks strained. And that's just for an English Board.

The problem is that Boards should be equal if you can rotate them onto one-another [I decided that reflection was out, which might be another mistake].

The good thing is that I can change things without a, "cascade of failure". The bad thing is that, for the moment, I can't see an easy way to do it.

I'm stuck with a hard choice: easy Peg, hard Board. Or vice-versa.

Permalink Add your comment
Share post