Society of Robots - Robot Forum
Software => Software => Topic started by: Parth on June 04, 2008, 01:37:30 PM
-
I'm sorry if this seems like a dumb question, but I've been reading the word "pseudocode" in a lot of the tutorials and have no idea what it means. I tried wikipedia-ing and google-ing it, but I still didn't understand. Is it something that you write up while programming it or what? Thanks in advance!
-
It's a way of expressing what you want a program to do without actually writing that program in a valid, language-specific syntax. For example, pseudocode for a line-following algorithm would be:
read left and right sensor inputs
if left sensor > right sensor
{
right motor speed = 100
left motor speed = 0
}
else
{
right motor speed = 0
left motor speed = 100
}
This code will not compile as it is not written in a valid language. The whole point is to express the concept of how my program will flow. I then need to figure out how to implement the details. For example, what is the code I will need to actually read the sensors? What code do I need to drive the motors? Pseudocode is like the outline for a paper; it is a very high-level construct that people can understand even if they don't know how to program in the language you will eventually end up using.
- Ben
-
Oh! I get it now! Thanks for all the help, your knowledge is invaluable to me!