Difference between revisions of "KTurtle/C3/Special-Commands-in-KTurtle/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with '{|border =1 !Visual Cue !Narration |- ||Slide Number 1 Title slide || Hello everybody. Welcome to this tutorial on '''Special Commands''' in '''KTurtle.''' |- ||'''Slide Num…')
 
Line 33: Line 33:
 
'''Pre-requisites'''  
 
'''Pre-requisites'''  
 
||We assume that you have basic working knowledge of KTurtle  
 
||We assume that you have basic working knowledge of KTurtle  
 +
 
If not,  
 
If not,  
 +
 
for relevant tutorials, please visit our website.  
 
for relevant tutorials, please visit our website.  
http://spoken-tutorial.org  
+
 
 +
'''http://spoken-tutorial.org'''
 
|-
 
|-
||Switch to KTurtle Application  
+
||Switch to '''KTurtle''' Application  
Dash home >>In the Search bar type KTurtle Click on the KTurtle icon.  
+
 
 +
'''Dash home''' >>In the Search bar type '''KTurtle.'''
 +
 
 +
Click on the '''KTurtle''' icon.  
 
||Let's open a new KTurtle Application.  
 
||Let's open a new KTurtle Application.  
  
Click on Dash home.   
+
Click on '''Dash home.'''  
In the Search bar, type KTurtle.  
+
 
Click on the KTurtle icon.  
+
In the Search bar, type '''KTurtle'''.  
 +
 
 +
Click on the''' KTurtle''' icon.  
 
|-
 
|-
 
||
 
||
 
||Let's first look at  “learn” command
 
||Let's first look at  “learn” command
 
|-
 
|-
||Slide Number 5
+
||'''Slide Number 5'''
 
'''learn''' command
 
'''learn''' command
 
||''' learn''' is special command  as it is used to create your own commands.  
 
||''' learn''' is special command  as it is used to create your own commands.  
 +
 
'learn' Command you create can take input and return output.  
 
'learn' Command you create can take input and return output.  
 
|-
 
|-
||Zoom text  
+
||'''Zoom text'''
 
||I will zoom the program text to have a clear view.
 
||I will zoom the program text to have a clear view.
 
|-
 
|-
 
||
 
||
Switch to Kturtle Window  
+
'''Switch to Kturtle Window'''
repeat 4  
+
 
 +
'''repeat 4'''
 +
 
 
{  
 
{  
forward 10  
+
 
turnleft 90  
+
'''forward 10'''
 +
 
 +
'''turnleft 90'''
 +
 
 
}  
 
}  
 
||
 
||
 
Let us take a look at how a new command is created.  
 
Let us take a look at how a new command is created.  
 +
 
Let's type a code in the editor to draw a square:  
 
Let's type a code in the editor to draw a square:  
repeat 4 within curly brackets
+
 
 +
'''repeat 4''' within curly brackets
 +
 
 
{  
 
{  
forward 10  
+
'''forward 10'''
turnleft 90  
+
 
 +
'''turnleft 90'''
 +
 
 
}
 
}
here the number 10 specfies the length of the side of the square.
+
 
 +
here the number '''10''' specfies the length of the side of the square.
 
|-
 
|-
||Highlight learn and square commands
+
||Highlight '''learn''' and '''square''' commands
||Now let's learn the commands involved to draw a square, using the learn command.  
+
||Now let's learn the commands involved to draw a square, using the '''learn''' command.  
 +
 
 
We will name of this set of commands to draw a square as square.  
 
We will name of this set of commands to draw a square as square.  
The command 'learn' is followed by the name of the command to be learnt,  
+
 
in this case it is a square.  
+
The command ''''learn'''' is followed by the name of the command to be learnt, in this case it is a '''square.'''
 
|-
 
|-
 
||Type the code
 
||Type the code
 
Let's type the following code
 
Let's type the following code
  
learn space square $x  
+
'''learn''' space '''square $x'''
let's include the learn command within curly brackets
+
 
 +
let's include the '''learn''' command within curly brackets
 
{  
 
{  
repeat 4  
+
 
 +
'''repeat 4'''
 
{  
 
{  
 +
 
let's repace number 10 by $x
 
let's repace number 10 by $x
forward $x  
+
 
turnleft 90  
+
'''forward $x'''
 +
 
 +
'''turnleft 90'''
 
}  
 
}  
 
}  
 
}  
 
|-
 
|-
|| Highlight square command  
+
|| Highlight '''square''' command  
||New command that we have defined  is called square.  
+
||New command that we have defined  is called '''square.'''
square takes one input argument,  $x to set the size of the square.  
+
 
 +
'''square''' takes one input argument,  '''$x''' to set the size of the square.  
 +
 
 
Note that when you run this  code, square returns no output.  
 
Note that when you run this  code, square returns no output.  
The command learn is just 'learning' the other command square to be used later.  
+
 
square command can now be used like a normal command in the rest of the code.  
+
The command '''learn''' is just 'learning' the other command square to be used later.  
 +
 
 +
'''square''' command can now be used like a normal command in the rest of the code.  
 
|-
 
|-
 
||Type the code
 
||Type the code
Line 104: Line 134:
 
Let me add few more lines here.  
 
Let me add few more lines here.  
 
Let's type
 
Let's type
Type the code
+
 
learn square $x  
+
'''learn square $x'''
 +
 
 
{  
 
{  
repeat 4  
+
 
 +
'''repeat 4'''
 +
 
 
{  
 
{  
forward $x  
+
 
turnleft 90  
+
'''forward $x'''
 +
 
 +
'''turnleft 90'''
 +
 
 
}  
 
}  
 
}  
 
}  
go 200,200  
+
 
square 100  
+
'''go 200,200'''
 +
 
 +
'''square 100'''
 
|-
 
|-
||Run the code
+
||'''Run the code'''
 
||Let's click on Run code  
 
||Let's click on Run code  
 +
 
Turtle draws a square on the canvas.
 
Turtle draws a square on the canvas.
 +
 
The command square can be used any where any number of times in the program.
 
The command square can be used any where any number of times in the program.
 
|-
 
|-
Line 124: Line 164:
 
||Let's  now replace 100 by 50.
 
||Let's  now replace 100 by 50.
 
|-
 
|-
||Run code
+
||'''Run the code'''
 
||Let's run again
 
||Let's run again
Turtle draws an another square with dimension 50.
+
 
 +
'''Turtle''' draws an another square with dimension 50.
 +
 
 
Please note that this command can be used only within the scope of this program
 
Please note that this command can be used only within the scope of this program
 
|-
 
|-
 
||
 
||
 
||I will clear the current code from editor.
 
||I will clear the current code from editor.
 +
 
Type “clear” command and Run to clean the canvas.
 
Type “clear” command and Run to clean the canvas.
 
|-
 
|-
Line 136: Line 179:
 
||Next we will  learn about “random” command.
 
||Next we will  learn about “random” command.
 
|-
 
|-
||Slide Number 6
+
||'''Slide Number 6'''
 +
 
 
"random" command
 
"random" command
 
||
 
||
 +
 
“random” command takes input and gives output.  
 
“random” command takes input and gives output.  
 +
 
Syntax for this command is “random X,Y”  
 
Syntax for this command is “random X,Y”  
 +
 
where X and Y are two inputs.  
 
where X and Y are two inputs.  
 +
 
X sets minimum output and Y sets maximum.
 
X sets minimum output and Y sets maximum.
 +
 
Output is a randomly chosen number between X and Y.  
 
Output is a randomly chosen number between X and Y.  
 
|-
 
|-
 
||
 
||
||
+
||Let's put the “random” command to use in the application.  
Let's put the “random” command to use in the application.  
+
 
|-
 
|-
 
||
 
||
 
||
 
||
 
I already have the code in a text editor.
 
I already have the code in a text editor.
 +
 
Let me explain the code.
 
Let me explain the code.
 
|-
 
|-
||Highlight reset
+
||Highlight '''reset'''
||“reset” command sets Turtle to default position
+
||“reset” command sets '''Turtle''' to default position
 
|-
 
|-
 
||Highlight  random 1,20
 
||Highlight  random 1,20
||Here, the command random 1,20 selects a random number which is equal or greater than 1 and equal or lesser than 20,  
+
||Here, the command '''random 1,20''' selects a random number which is equal or greater than 1 and equal or lesser than 20,  
 
and assigns it to the variable x.  
 
and assigns it to the variable x.  
 
|-
 
|-
||Highlight repeat 36  
+
||Highlight '''repeat 36'''
 +
 
 
{  
 
{  
forward $x  
+
 
turnleft 10  
+
'''forward $x '''
 +
 
 +
'''turnleft 10'''
 
}  
 
}  
||The repeat command and the commands within curly brackets draw a circle
+
||The '''repeat''' command and the commands within curly brackets draw a circle
 
|-
 
|-
||reset  
+
||'''reset''' '''
$x=random 1,20
+
 
repeat 36  
+
$x=random 1,2'''0
 +
 
 +
'''repeat 36'''
 +
 
 
{  
 
{  
forward $x  
+
 
turnleft 10  
+
'''forward $x'''
 +
 
 +
'''turnleft 10'''
 +
 
 
}  
 
}  
||I will copy the code from text editor and paste it into KTurtle editor.
+
||I will copy the code from text editor and paste it into '''KTurtle''' editor.
Pause the tutorial and type the program into your KTurtle editor.
+
 
 +
Pause the tutorial and type the program into your '''KTurtle''' editor.
 +
 
 
Resume the tutorial after typing the program
 
Resume the tutorial after typing the program
 
|-
 
|-
 
||
 
||
Run the code
+
'''Run the code'''
 
||When we run this code,  
 
||When we run this code,  
Turtle draws a  circle which is  between 1 and 20  on the canvas.  
+
 
 +
'''Turtle''' draws a  circle which is  between 1 and 20  on the canvas.  
 +
 
 
Let us execute this code a few times,
 
Let us execute this code a few times,
 +
 
and you can see that a circle with a different size is generated each time.  
 
and you can see that a circle with a different size is generated each time.  
 +
 
Every time you exceute this code, a circle with a different radius is drawn on the canvas.  
 
Every time you exceute this code, a circle with a different radius is drawn on the canvas.  
 
|-
 
|-
Line 192: Line 256:
 
|-
 
|-
 
||clear current code
 
||clear current code
||I will clear the current code and run to clean the canvas.
+
||I will clear the current code and '''Run''' to clean the canvas.
 
|-
 
|-
 
||
 
||
 
||I already have a code in the Text editor.
 
||I already have a code in the Text editor.
 +
 
I will explain the code.
 
I will explain the code.
 
|-
 
|-
 
||
 
||
Highlight reset
+
Highlight '''reset'''
 
||“reset” command sets Turtle to its default position.
 
||“reset” command sets Turtle to its default position.
 
|-
 
|-
 
||Highlight canvassize 300,300
 
||Highlight canvassize 300,300
||'canvassize 300,300' sets the width and height of the canvas to 300 pixels each.  
+
||'''canvassize 300,300''' sets the width and height of the canvas to 300 pixels each.  
 
|-
 
|-
||Highlight $R, $G, and $B
+
||Highlight '''$R, $G''', and '''$B'''
||$R, $G, and $B are three variables to which I am assigning random values between 0 and 255.  
+
||'''$R, $G,''' and '''$B''' are three variables to which I am assigning random values between 0 and 255.  
 
|-
 
|-
||Highlight 'canvascolor $R,$G,$B' ,
+
||Highlight '''canvascolor $R,$G,$B''' ,
||In the command 'canvascolor $R,$G,$B' ,  
+
||In the command '''canvascolor $R,$G,$B''' ,  
the Red-Green-Blue combination is replaced by the values assigned to the variables R, G, and B in the previous step.  
+
 
 +
the Red-Green-Blue combination is replaced by the values assigned to the  
 +
variables R, G, and B in the previous step.  
 +
 
 
The canvas color is randomly  set  when this command is executed.  
 
The canvas color is randomly  set  when this command is executed.  
 
|-
 
|-
 
||Highlight $red, $green and $blue
 
||Highlight $red, $green and $blue
 
||$red, $blue, $green are another set of variables  
 
||$red, $blue, $green are another set of variables  
 +
 
to which random values between 0 and 255 are assigned randomly.  
 
to which random values between 0 and 255 are assigned randomly.  
'pencolor  $red,  $green, $blue' the Red-Green-Blue combination values are replaced by the variables
 
  
$red, $green and $blue to which random values were assigned  
+
'''pencolor  $red, $green, $blue''' the Red-Green-Blue combination values are replaced by the variables
 +
 
 +
'''$red''', '''$green''' and '''$blue''' to which random values were assigned  
 
in the previous step.  
 
in the previous step.  
 
|-
 
|-
||Highlight pencolor $red,$blue,$green  
+
||Highlight '''pencolor $red,$blue,$green'''
 
||The color of the pen is also set randomly when the command is executed.  
 
||The color of the pen is also set randomly when the command is executed.  
 
|-
 
|-
||Highlight penwidth 2
+
||Highlight '''penwidth 2'''
||'penwidth 2' sets the width of the pen to 2 pixels.  
+
||'''penwidth 2''' sets the width of the pen to 2 pixels.  
 
|-
 
|-
 
||code to a circle
 
||code to a circle
 
|| Next I have entered the code to learn to draw a circle.  
 
|| Next I have entered the code to learn to draw a circle.  
 +
 
Here $x represents the size of the circle.  
 
Here $x represents the size of the circle.  
 +
 
The '''repeat''' command followed by the code in curly brackets draws a circle.
 
The '''repeat''' command followed by the code in curly brackets draws a circle.
 
|-
 
|-
||Highlight go commands and circle commands
+
||Highlight '''go commands and circle commands'''
 
||
 
||
The next set of commands i.e the go commands  
+
The next set of commands that is the '''go''' commands  
followed by the circle commands draws circles with the specified sizes.  
+
followed by the '''circle''' commands draws circles with the specified sizes.  
 
|-
 
|-
 
||Example circle
 
||Example circle
 
||For example:
 
||For example:
 
“ circle 5” draws a circle of size 5  
 
“ circle 5” draws a circle of size 5  
at the co-ordinates X and Y specified in the go command.  
+
 
 +
At the co-ordinates X and Y specified in the go command.  
 +
 
 
For each circle, I have specified different positions on the canvas.  
 
For each circle, I have specified different positions on the canvas.  
 
|-
 
|-
||reset  
+
||'''reset'''
canvassize 300,300  
+
 
$R= random 0,255  
+
'''canvassize 300,300'''
$G=random 0,255  
+
 
$B=random 0,255  
+
'''$R= random 0,255'''
canvascolor $R,$G,$B  
+
 
$red=random 0,255  
+
'''$G=random 0,255'''
$blue=random 0,255  
+
 
$green=random 0,255  
+
'''$B=random 0,255'''
pencolor $red,$blue,$green  
+
 
penwidth 2  
+
'''canvascolor $R,$G,$B'''
learn circle $x{  
+
 
repeat 36{  
+
'''$red=random 0,255'''
forward $x  
+
 
turnleft 10  
+
'''$blue=random 0,255'''
 +
 
 +
'''$green=random 0,255'''
 +
 
 +
'''pencolor $red,$blue,$green'''
 +
 
 +
'''penwidth 2'''
 +
 
 +
'''learn circle $x'''{  
 +
 
 +
'''repeat 36'''{  
 +
 
 +
'''forward $x'''
 +
 
 +
'''turnleft 10'''
 
}  
 
}  
 
}  
 
}  
go 85,85  
+
 
circle 5  
+
'''go 85,85'''
go 115,115  
+
 
circle 5  
+
'''circle 5'''
go 145,145  
+
 
circle 5  
+
'''go 115,115'''
go 190,190  
+
 
circle 5  
+
'''circle 5'''
go 220,220  
+
 
circle 10  
+
'''go 145,145'''
go 0,0  
+
 
 +
'''circle 5'''
 +
 
 +
'''go 190,190'''
 +
 
 +
'''circle 5'''
 +
 
 +
'''go 220,220'''
 +
 
 +
'''circle 10'''
 +
 
 +
'''go 0,0'''
 
||
 
||
 
I will copy this code from text editor and paste it into KTurtle's editor.
 
I will copy this code from text editor and paste it into KTurtle's editor.
 +
 
Pause the tutorial and type the program into ypur KTurtle editor.
 
Pause the tutorial and type the program into ypur KTurtle editor.
 +
 
Resume the tutorial after typing the program.
 
Resume the tutorial after typing the program.
 
|-
 
|-
||Exetecute code
+
||Execute code
I will exetecute this  code in Fullspeed.
+
||I will execute this  code in Fullspeed.
 +
 
 
You can execute your code at any of the speeds specified in the Run option.  
 
You can execute your code at any of the speeds specified in the Run option.  
 +
 
I will run this code few more times.
 
I will run this code few more times.
 +
 
You can see the difference in randomly set values of pen color and canvas color.  
 
You can see the difference in randomly set values of pen color and canvas color.  
 +
 
Note the change in the color of the pen and the canvas on each execution.  
 
Note the change in the color of the pen and the canvas on each execution.  
You can execute the code how many ever times you want and  note the change in the randomly set values.  
+
 
 +
You can execute the code how many ever times you want and  note the change in  
 +
the randomly set values.  
 
|-
 
|-
 
||
 
||
||
+
||With this we come to the end of this tutorial.
Withthis we come to the end of this tutorial.
+
 
Let's summarize
 
Let's summarize
 
|-
 
|-
Line 292: Line 398:
 
||In this tutorial we have learnt about,
 
||In this tutorial we have learnt about,
  
“learn” command  and
+
* “learn” command  and
“random” command.
+
* “random” command.
 
|-
 
|-
 
||Switch to Slide 6  
 
||Switch to Slide 6  
Line 300: Line 406:
 
||As an assignment for you to solve,  
 
||As an assignment for you to solve,  
  
Using the learn command,  
+
* Using the learn command, draw a  
draw a pentagon, a square, a rectangle, a hexagon on the four corners of your canvas  
+
* pentagon
and a circle at the centre of the canvas.  
+
* square
Using the “random” command create various colors and customize your geometric shapes and canvas.  
+
* rectangle
 +
* hexagon on the four corners of your canvas and a
 +
* circle at the centre of the canvas.  
 +
 
 +
* Using the “random” command create various colors and  
 +
 
 +
* Customize your geometric shapes and canvas.  
 
|-
 
|-
||Slide number 11  
+
||'''Slide number 11'''
Acknowledgement  
+
 
 +
'''Acknowledgement'''
 
||Watch the video available at this URL
 
||Watch the video available at this URL
http://spoken-tutorial.org/What is a Spoken Tutorial
+
 
 +
'''http://spoken-tutorial.org/What is a Spoken Tutorial'''
 
It summarises the Spoken Tutorial project
 
It summarises the Spoken Tutorial project
 +
 
If you do not have good bandwidth, you can download and watch it  
 
If you do not have good bandwidth, you can download and watch it  
 
|-
 
|-
||Slide Number 12  
+
||'''Slide Number 12'''
 
||The Spoken Tutorial Project Team :  
 
||The Spoken Tutorial Project Team :  
 +
 
Conducts workshops using spoken tutorials
 
Conducts workshops using spoken tutorials
 +
 
Gives certificates to those who pass an online test  
 
Gives certificates to those who pass an online test  
 +
 
For more details, please write to  
 
For more details, please write to  
contact@spoken-tutorial.org  
+
 
 +
'''contact@spoken-tutorial.org'''
 
|-
 
|-
||Slide number 13  
+
||'''Slide number 13'''
 
||Spoken Tutorial Project is a part of the Talk to a Teacher project  
 
||Spoken Tutorial Project is a part of the Talk to a Teacher project  
 +
 
It is supported by the National Mission on Education through ICT, MHRD, Government of India
 
It is supported by the National Mission on Education through ICT, MHRD, Government of India
More information on this Mission is available at this link http://spoken-tutorial.org/NMEICT-Intro ]  
+
 
 +
More information on this Mission is available at this link  
 +
 
 +
'''http://spoken-tutorial.org/NMEICT-Intro ]'''
  
 
The script is contributed by IT for change, Bangaluru.
 
The script is contributed by IT for change, Bangaluru.
 +
 
This is Madhuri Ganpathi from IIT Bombay signing off. Thank you for joining.  
 
This is Madhuri Ganpathi from IIT Bombay signing off. Thank you for joining.  
 
|-
 
|-

Revision as of 13:21, 19 March 2013

Visual Cue Narration
Slide Number 1

Title slide

Hello everybody.

Welcome to this tutorial on Special Commands in KTurtle.

Slide Number 2

Learning Objectives

In this tutorial, we will learn about
  • “learn” command and
  • “random” Command
Slide Number 3

System Requirement

To record this tutorial I am using,

Ubuntu Linux OS version. 12.04.

KTurtle version. 0.8.1 beta.

Slide Number 4

Pre-requisites

We assume that you have basic working knowledge of KTurtle

If not,

for relevant tutorials, please visit our website.

http://spoken-tutorial.org

Switch to KTurtle Application

Dash home >>In the Search bar type KTurtle.

Click on the KTurtle icon.

Let's open a new KTurtle Application.

Click on Dash home.

In the Search bar, type KTurtle.

Click on the KTurtle icon.

Let's first look at “learn” command
Slide Number 5

learn command

learn is special command as it is used to create your own commands.

'learn' Command you create can take input and return output.

Zoom text I will zoom the program text to have a clear view.

Switch to Kturtle Window

repeat 4

{

forward 10

turnleft 90

}

Let us take a look at how a new command is created.

Let's type a code in the editor to draw a square:

repeat 4 within curly brackets

{ forward 10

turnleft 90

}

here the number 10 specfies the length of the side of the square.

Highlight learn and square commands Now let's learn the commands involved to draw a square, using the learn command.

We will name of this set of commands to draw a square as square.

The command 'learn' is followed by the name of the command to be learnt, in this case it is a square.

Type the code

Let's type the following code

learn space square $x

let's include the learn command within curly brackets {

repeat 4 {

let's repace number 10 by $x

forward $x

turnleft 90 } }

Highlight square command New command that we have defined is called square.

square takes one input argument, $x to set the size of the square.

Note that when you run this code, square returns no output.

The command learn is just 'learning' the other command square to be used later.

square command can now be used like a normal command in the rest of the code.

Type the code

Let me add few more lines here. Let's type

learn square $x

{

repeat 4

{

forward $x

turnleft 90

} }

go 200,200

square 100

Run the code Let's click on Run code

Turtle draws a square on the canvas.

The command square can be used any where any number of times in the program.

Replace 100 by 50. Let's now replace 100 by 50.
Run the code Let's run again

Turtle draws an another square with dimension 50.

Please note that this command can be used only within the scope of this program

I will clear the current code from editor.

Type “clear” command and Run to clean the canvas.

Next we will learn about “random” command.
Slide Number 6

"random" command

“random” command takes input and gives output.

Syntax for this command is “random X,Y”

where X and Y are two inputs.

X sets minimum output and Y sets maximum.

Output is a randomly chosen number between X and Y.

Let's put the “random” command to use in the application.

I already have the code in a text editor.

Let me explain the code.

Highlight reset “reset” command sets Turtle to default position
Highlight random 1,20 Here, the command random 1,20 selects a random number which is equal or greater than 1 and equal or lesser than 20,

and assigns it to the variable x.

Highlight repeat 36

{

forward $x

turnleft 10 }

The repeat command and the commands within curly brackets draw a circle
reset

$x=random 1,20

repeat 36

{

forward $x

turnleft 10

}

I will copy the code from text editor and paste it into KTurtle editor.

Pause the tutorial and type the program into your KTurtle editor.

Resume the tutorial after typing the program

Run the code

When we run this code,

Turtle draws a circle which is between 1 and 20 on the canvas.

Let us execute this code a few times,

and you can see that a circle with a different size is generated each time.

Every time you exceute this code, a circle with a different radius is drawn on the canvas.

Let us now use both the learn and random commands in an example.

clear current code I will clear the current code and Run to clean the canvas.
I already have a code in the Text editor.

I will explain the code.

Highlight reset

“reset” command sets Turtle to its default position.
Highlight canvassize 300,300 canvassize 300,300 sets the width and height of the canvas to 300 pixels each.
Highlight $R, $G, and $B $R, $G, and $B are three variables to which I am assigning random values between 0 and 255.
Highlight canvascolor $R,$G,$B , In the command canvascolor $R,$G,$B ,

the Red-Green-Blue combination is replaced by the values assigned to the variables R, G, and B in the previous step.

The canvas color is randomly set when this command is executed.

Highlight $red, $green and $blue $red, $blue, $green are another set of variables

to which random values between 0 and 255 are assigned randomly.

pencolor $red, $green, $blue the Red-Green-Blue combination values are replaced by the variables

$red, $green and $blue to which random values were assigned in the previous step.

Highlight pencolor $red,$blue,$green The color of the pen is also set randomly when the command is executed.
Highlight penwidth 2 penwidth 2 sets the width of the pen to 2 pixels.
code to a circle Next I have entered the code to learn to draw a circle.

Here $x represents the size of the circle.

The repeat command followed by the code in curly brackets draws a circle.

Highlight go commands and circle commands

The next set of commands that is the go commands followed by the circle commands draws circles with the specified sizes.

Example circle For example:

“ circle 5” draws a circle of size 5

At the co-ordinates X and Y specified in the go command.

For each circle, I have specified different positions on the canvas.

reset

canvassize 300,300

$R= random 0,255

$G=random 0,255

$B=random 0,255

canvascolor $R,$G,$B

$red=random 0,255

$blue=random 0,255

$green=random 0,255

pencolor $red,$blue,$green

penwidth 2

learn circle $x{

repeat 36{

forward $x

turnleft 10 } }

go 85,85

circle 5

go 115,115

circle 5

go 145,145

circle 5

go 190,190

circle 5

go 220,220

circle 10

go 0,0

I will copy this code from text editor and paste it into KTurtle's editor.

Pause the tutorial and type the program into ypur KTurtle editor.

Resume the tutorial after typing the program.

Execute code I will execute this code in Fullspeed.

You can execute your code at any of the speeds specified in the Run option.

I will run this code few more times.

You can see the difference in randomly set values of pen color and canvas color.

Note the change in the color of the pen and the canvas on each execution.

You can execute the code how many ever times you want and note the change in the randomly set values.

With this we come to the end of this tutorial.

Let's summarize

Summary In this tutorial we have learnt about,
  • “learn” command and
  • “random” command.
Switch to Slide 6

Switch to KTurtle Window & Show Assignment

As an assignment for you to solve,
  • Using the learn command, draw a
  • pentagon
  • square
  • rectangle
  • hexagon on the four corners of your canvas and a
  • circle at the centre of the canvas.
  • Using the “random” command create various colors and
  • Customize your geometric shapes and canvas.
Slide number 11

Acknowledgement

Watch the video available at this URL

http://spoken-tutorial.org/What is a Spoken Tutorial It summarises the Spoken Tutorial project

If you do not have good bandwidth, you can download and watch it

Slide Number 12 The Spoken Tutorial Project Team :

Conducts workshops using spoken tutorials

Gives certificates to those who pass an online test

For more details, please write to

contact@spoken-tutorial.org

Slide number 13 Spoken Tutorial Project is a part of the Talk to a Teacher project

It is supported by the National Mission on Education through ICT, MHRD, Government of India

More information on this Mission is available at this link

http://spoken-tutorial.org/NMEICT-Intro ]

The script is contributed by IT for change, Bangaluru.

This is Madhuri Ganpathi from IIT Bombay signing off. Thank you for joining.

Contributors and Content Editors

Krupali, Madhurig, PoojaMoolya, Pratik kamble, Pravin1389, Sandhya.np14, Sneha