Monday, September 5, 2011

Code Surgery


So while cutting code today for the AIBrain class I realised that what I was writing was actually code that is common to both COM and AI-- decision making, crunching goals and making inferences. So I've decided that I want to restructure this a bit and put that common code into its own class, possibly named DecisionSystem. The thought had come up a long time ago (eureka!) but was sort of left in the documentation to rot and I forgot about it. So anyway I've rediscovered it and will be working on it. From there, the AIBrain will use the DecisionSystem in addition to its own learning and understanding system (dynamic) to, ultimately, generate the fighter's instructions. The COM will use the DecisionSystem and convert goals directly (more or less) into actions (static) to achieve the same end. So my task ahead involves some code surgery, but it should leave the classes neat and well structured and of course mean that there's less work for me to do (code reuse is a great time-saver.)
I think this way of doing things is the most ideal considering that now the AIBrain can now just store the AI-specific stuff, and the decision system can store the short-term memory, inferences, and all that stuff which is generated on the fly.
More updates tonight when I've done that :)
Oh, and I'll need to be updating the technical documentation somewhat (perhaps change up the diagrams a bit) to reflect these changes as well as others. No worries though, it's all in the plan -- Week 7 -- updating Tech manual to reflect changes.

No comments:

Post a Comment