Learning the functions and syntax in text based language is NOT the hard part. Writing efficient algorithims to solve a problem is the hard part because it requires abstract thinking about both the problem and the possible solution.
Before we start programming, either creatively or to solve a problem, we should plan or visualize our program code. We can use this plan to develop specific instructions for the computer
We can use flowcharts or psuedoce in planning - in this class we will focus more on psuedocode. However, visual thinkers should feel free to use flowcharts if they produce better investigative thinking or program design. Programming styles are individual!
While psuedocode is an informal language - we need some basic structure to make it easier to read, easier to use, and easier to share with a fellow programmer
For this class - we will use spacing / indentation as a baseline for organizination
Example:
Images and details adapted from:
Why is it called a turtle?
The turtle robot, a simple robot controlled from the user's workstation that is designed to carry out the drawing functions assigned to it using a small retractable pen set into or attached to the robot's body
A drawing turtle is going to have three attributes a location, an orientation (or direction), and a pen. The pen will have its own attributes: color, width, and on/off state.
When we program with a turtle, we are using body syntonic reasoning - in other words - we can predict and reason about the turtles movements by imagining what we would do if we were the turtle.
This is sequential code! One line executes AFTER the one before it has finished.
The # are programmer comments that clarify the action
Mock is the name of the object we created (mock is an instance of the turtle) and we are calling the method/function/procedure of forward. These methods already exist in the Python library.
The 100 is the value passed into the method as an argument. - allowing us to use this method for any number of steps we want the turtle to take.
1.2 Understand the software development life-cycle.
Here are the four basic turtle movements - you should reconzige them as the AP CSP Robot Grid Movemements
What is the deal with the options? Python was built as a learning or teaching language. That means they built in some flexability when it comes to syntax.
Your assignment - turn in a scan of your notes from today with the psuedocode of how to draw the letter x using only these 4 commands and your brain