Jump to content
  • Advertisement

Archived

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

Alpha_ProgDes

Decision-making code, which one?

This topic is 5244 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

when having an agent make a decision in a program, when do you choose between a Binary tree and if-else statements? when there's pointers involved or when the code has become very godly in size? do programmers worry about speed performance or just getting the job done? [edited by - Alpha_ProgDes on April 12, 2004 2:40:19 PM]

Share this post


Link to post
Share on other sites
Advertisement
well I posted it somewhere else in this forum..Python is great.Read this Python Tutorial(tells you about what it can do and gives you a short class..it all must be typed on notepad.but can be testing in python shell..or you can change the notepad file so that it has .py or something at the end of its name).it seems to be easy to use its optimal for games since it make things abit smaller and speeds the game up quite abit..here is the link:

http://www.python.org/doc/current/tut/node3.html

here is the download page:

http://www.python.org/

[edited by - BES on April 12, 2004 11:53:15 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Alpha_ProgDes
do programmers worry about speed performance or just
getting the job done?


A good general rule is to just get the job done. Then, if performance isn''t what you require, profile your code and go after the problem areas.

Of course, there are exceptions to every rule. For instance, if your solution is so slow that it would make the entire project unfeasable, it''s obviously nice to find that out sooner than later.

Share this post


Link to post
Share on other sites
quote:
Original post by Oluseyi
quote:
Original post by BES
Python... all must be typed on notepad...
Nope. You can get ActivePython for Solaris, Linux and Windows.

Oh thats good to know i been doing it in notepad...lol

Share this post


Link to post
Share on other sites
As this is a general programming question, it does not need to rely upon any language for a relevant response.

My general rule is:- Can I understand this code NOW?

If the answer is not a definite Yes, then I''ve used the wrong approach to the task.

If I have my doubts about it today, just when I''ve written it, I''m not going to be able to maintain my code next week, month, year or whenever I may need to use it again or modify it.

IF THEN ELSEIF ENDIF ELSE are constructs that will mislead after a certain depth (in my case 8), so an alternative approach is called for at that point (in my case).

For involved testing structures, I would use binary flags set in response to simple conditions (an IF this = true THEN flag6=flag6 OR 4 type of thing)

Then an involved decision will only need a single test sequence on the flags:- an IF (flag6 AND $17)=$17 then result=true will serve the purpose.

As for speed -v- geting the job done, this depends upon the end result. For real time 3D animation, speed is obviously the main criterion but for Database maintenance, getting the job done accurately is far more important.




Stevie

Don''t follow me, I''m lost.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!