Flowcharting

I’m still trying to get the programming side to make a bit more sense so I went back to the beginning of the course to review the material. I then started using Flowgorithm, thinking I would make a flowchart of the GoHome game. It seemed like an easy enough task. I have to laugh, because it is not as easy as I thought.

Has anyone here worked with flowcharting? The reason I’m doing this is to visualize the flow of control and get a better grasp on the mechanics of programming. Also, because the software makes all of this interactive, I can see if there are errors in the logic before I get to the coding.

If anyone here has been down that path and is willing to lend a hand that would be great.

Funny that it should be so hard. Optimizing compilers already do this as one of the many stages to creating more efficient programs. I wonder if there is a way to get the C# compiler to output its control flow graph.

You can read more about what a basic block graph is and do this manually for yourself.

LOL, it really is funny that I am having this much trouble.

I read the page that you linked to and it makes sense. The GoHome script is so small yet I’m completely stumped.

This is what I’ve done so far in the flowchart:

  1. Created the Functions
    a. Main
    b. Start
    c. PrintWelcomeMessage
    d. Update
    e. PrintUpdateAndContinue

  2. Declared and assigned numberOfSteps = 1 (int)

  3. Declared and assigned homeLocation = 1.0 (real)

  4. Declared and assigned gameOver (bool)

--------Called the Function Start which has the Function PrintWelcomeMessage ----------

  1. Output “Are you feeling lost?”

  2. “The objective of the game is to find your way home. Go on, you can do it!”

------- End of Function PrintWelcomeMessage --------------

------- Called the Function PrintUpdateAndContinue --------

This is where items break down.

  1. I’m trying to use the distance.magnitude == 0 (that doesn’t work)

  2. Therefore, the output when false does not solve because it tries to print distance.magnitude

----------- End of Function PrintUpdateAndContinue --------

  1. Output “Distance”

  2. Output + distance

  3. location > homeLocation
    False outputs "Go forward to get home!"
    True outputs “Go back to get home!”

  4. location == homeLocation
    True outputs “I am at home!”

**Note: No 7 and 8 is also wrong because I used an If statment to solve, and it will not proceed to “I am at home!” unless it prints one of the other two mentioned above.

---------- Called the Function Update -------------

I’m doing this entire update wrong because it just returns to the beginning and does not listen for all the keys.

  1. Declared w a s d (string)

  2. Input w a s d

  3. w == "w"
    True "I am the UP key"
    False Update Function Called

  4. a == "a"
    True "I am the LEFT key"
    False Update Function Called

  5. s == "s"
    True "I am the DOWN key"
    False Update Function Called

  6. d == "d"
    True "I am the RIGHT key"
    False Update Function Called

----------- End of Function Update -------------

I don’t have everything in there and still trying to figure out how to do the Vector2.

I’m glad that I’m doing this because it has helped me to see that I don’t understand things too well.

It looks like there is a fair amount to learn with Flowcharting and Pseudocode. I think what I will do is take a separate course to increase my knowledge in this area. That way I don’t ask too many questions here that are out of the scope of what you’re trying to teach. Sorry about the off topic questions.

Looks like you made a great start. It depends on what the goal of learning more is. If it’s purely academic that makes sense. Otherwise, I think it should be enough to have an intuitive understanding which you can build by writing more code.

1 Like

Privacy & Terms