Monday, April 14, 2008

Move: Attack or Travel?

Currently I have piece Abilities and piece Movement as two separate classes. But If you think about regular chess, All pieces move and attack in one step. Should there be a special class called capture? Should the Ability and Movement be merged? Or should the Move class have a damage property that can be used in case of the original Chess rules?

Capture Class: First, lets think about the special class. There is very low flex ability in that case. You can't make a special class every time somebody wants something strange. Although, movement and attack may be the one other case besides exclusive movement/attack that deserves a case. And If those three classes cover all the possible creative ways people can think up to move or attack with a piece (reasonably), then it may be worth it.

One Super Class: This would take a lot of work and pending changes brakes the OOP philosophy. But if done right there wouldn't need to be any changes in the future. Although, I don't currently have plans for stat adjustments, or lasting attack effects (i.e. poison) but there may be a need for it in the future thus making the SuperMove Class very large and hard to manage.


Move.Damage: This is a very lightweight solution. But it also breaks the OOP philosophy. It isn't very dynamic. Same as the SuperClass. It isn't the smartest choice. But it is the easiest.

I think the best currently would probably be to create a Move interface that both movement and Attacks must conform to, so that adding new classes will be easier. So that the move/attack lists can be simplified and the global move log will have a standard to be built from.

No comments: