go_away

Author Topic: Pseudocode? (newbie)  (Read 1332 times)

0 Members and 1 Guest are viewing this topic.

Offline ParthTopic starter

  • Full Member
  • ***
  • Posts: 71
  • Helpful? 0
Pseudocode? (newbie)
« 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!

Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 331
  • Helpful? 3
Re: Pseudocode? (newbie)
« Reply #1 on: June 04, 2008, 02:07:59 PM »
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:

Code: [Select]
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

Offline ParthTopic starter

  • Full Member
  • ***
  • Posts: 71
  • Helpful? 0
Re: Pseudocode? (newbie)
« Reply #2 on: June 04, 2008, 06:49:36 PM »
Oh! I get it now! Thanks for all the help, your knowledge is invaluable to me!

 


Get Your Ad Here