Site icon TestingDocs.com

Draw a Square using Turtle Graphics

Overview

In this tutorial, we will draw a square using turtle graphics. This is a step-by-step guide to building a turtle graphics flowchart using Flowgorithm 3.0 software.

Prerequisites

Basic computer literacy is required

Targeted Audience: Students and Beginners.

Flowgorithm 3.0 software is installed on the machine. We can either install a fresh copy of the software or upgrade the older version to the latest version.

Steps to Download & Install Flowgorithm

Steps to update Flowgorithm

This tutorial will cover many topics and appropriate links will be provided. We will build the flowchart using different approaches using the Flowgorithm tool.

Sequential Approach

Initially, we will build a flowchart that draws a single square through a sequence of steps.

Launch Flowgorithm application. ( Steps to Launch Flowgorithm on Windows )

Choose the menu option ( File -> New ) to create a Flowchart.

This step will open an initial empty ‘unititled’ flowchart with two Main and End symbols connected with a control flow line. We would be building the flowchart as per the programming logic by adding symbols to the Main flowchart.

 

Save the flowchart

Save the flowchart to a suitable location and give a meaningful name.( File -> Save menu option)

The file extension is *.fprg

We can draw a square by drawing lines and each line is titled 90 degrees. Initially, the turtle is located at the starting center point of the Graphics window.

To add a symbol, click on the control line and click on the respective flowchart symbol. By default, the  Turtle graphics flowchart symbols are hidden. Click on the down arrow on the symbols window to get the new symbols.

 

Add a Forward symbol

The Forward symbol moves the turtle by a specified distance. The Turtle will draw the line if the Pen Down option is checked. The symbol will change to the Draw symbol when this option is checked.

 

Add a Turn symbol

The Turn symbol changes the direction of the turtle. The turtle can turn left or right by a specified number of degrees.

 

This will draw a line and the turtle would be turned 90 degrees to the right. Save the flowchart and run to view the partial figure.

 

Repeat the steps three more times to complete the square shape. The Draw and Turn should be placed alternatively. The complete flowchart should look like the one below.

 

Run the flowchart

Save and Run the flowchart.

Click on the green Play button to run the flowchart. ( or the menu option Program -> Run )

 

Iterative Approach

Now we will enhance the flowchart to use the Loop Iteration statement. In this approach, we will use an iterative approach.

Notice that we have repeated the same Draw and Turn steps multiple times to draw the square.  We can use a loop statement to use iteration. For example, we can use the For loop statement.

 

 

That’s it. We have successfully built a flowchart that can draw a square shape using different approaches.

Flowgorithm Tutorials

Flowgorithm flowchart tutorials on this website:

https://www.testingdocs.com/flowgorithm-flowchart-tutorial/

For more updates please like our Facebook page:

Exit mobile version