Archived

This topic is now archived and is closed to further replies.

Fifteen Puzzle Object Design

This topic is 5172 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. If I have an object Puzzle which has 8/15 Tile objects and I want to go moving the tiles around, do I give Puzzle a method which moves the Tiles or do I give Tile the method.

Share this post


Link to post
Share on other sites
I''d give it to Puzzle. Depends a very lot on your other code, though. Assuming that not all moves are legal (tile collisions and such), handling it in Puzzle would probably be easier. If needed, give Tiles also a method for doing the actual move, after Puzzle has checked that everything is ok. That way Tiles can have their own moving animations and whatnot. But if you don''t need that, don''t do it. Keep it as simple as possible.

And anyway, I don''t think this matters much. Just do what works for you.

Share this post


Link to post
Share on other sites