Topic: LUA AI development preview :)
einstein13![]() |
Posted at:
2014-02-13, 11:48 UTC+1.0
Hi! I know that the AI code will be very complex and has lots of lines (more than 1000), so my idea is to stick to the conventions with programming. My roommate (who is a programmer) told me about some of them:
The same is for functions: one function is doing only one thing. The best is to build only very simple functions, probably lots of them, because when you will need to change something it's much more easier to change simple function than change complicated one. I've built one project with ~40 functions and now It is very easy to add new one. Only one problem are the names:
The computer can handle long names as good as short ones. If you use short names, it would be very hard to understand what is inside the code after some time (few months).
Comments of code are necessary. But not everything has to have them. From my small experience, the best is to add a comments in the beginning of each function: what is the function doing? what is it returning? Is the algorithm somewhere described (www site/ PDF/ whatever)? Then using existing function will be easier (you don't have to think about the math inside).
You already have them You can disagree with me- that's normal I know that my ideas of math model with woodcutters and foresters will need lots of math stuff, the best is to create completely new functions used by them and (probably) by other tasks (farms? vineyards?). Have fun! einstein13
Edited:
2014-02-13, 11:50 UTC+1.0
einstein13 ![]() ![]() |
Tibor Topic Opener |
Posted at:
2014-02-13, 22:21 UTC+1.0
Well these are more-less my thoughts Just take into account it is too soon for comments and so on, because I very frequently reworks what I have now... So everything must settle a bit first... ![]() ![]() |