Difference between revisions of "KTurtle/C3/Special-Commands-in-KTurtle/English-timed"
From Script | Spoken-Tutorial
PoojaMoolya (Talk | contribs) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{|border =1 | {|border =1 | ||
− | + | |'''Time''' | |
− | + | |'''Narration''' | |
+ | |||
|- | |- | ||
||00:01 | ||00:01 | ||
− | ||Hello everybody. Welcome to this tutorial on '''Special Commands | + | ||Hello everybody. Welcome to this tutorial on '''Special Commands in KTurtle.''' |
+ | |||
|- | |- | ||
||00:08 | ||00:08 | ||
− | ||In this tutorial, we will learn about | + | ||In this tutorial, we will learn about: |
+ | '''“learn”''' command and | ||
+ | '''“random”''' command. | ||
− | |||
− | |||
− | |||
|- | |- | ||
||00:15 | ||00:15 | ||
− | ||To record this tutorial I am using | + | ||To record this tutorial, I am using: |
+ | '''Ubuntu Linux OS''' version '''12.04''' | ||
+ | '''KTurtle''' version '''0.8.1 beta'''. | ||
+ | |||
|- | |- | ||
− | || 00:28 | + | ||00:28 |
− | ||We assume that you have basic working knowledge of KTurtle | + | ||We assume that you have basic working knowledge of 'KTurtle'. |
|- | |- | ||
− | || 00:33 | + | ||00:33 |
− | ||If not, for relevant tutorials, please visit our website | + | ||If not, for relevant tutorials, please visit our website:http://spoken-tutorial.org |
+ | |||
|- | |- | ||
− | || 00:39 | + | ||00:39 |
− | ||Let's open a new KTurtle Application. | + | ||Let's open a new '''KTurtle Application'''. |
|- | |- | ||
− | || 00:42 | + | ||00:42 |
||Click on '''Dash home.''' | ||Click on '''Dash home.''' | ||
|- | |- | ||
− | || 00:44 | + | ||00:44 |
− | ||In the | + | ||In the '''Search bar''', type: "kturtle". |
|- | |- | ||
− | || 00:47 | + | ||00:47 |
||Click on the''' KTurtle''' icon. | ||Click on the''' KTurtle''' icon. | ||
+ | |||
|- | |- | ||
||00:50 | ||00:50 | ||
− | ||Let's first look at | + | ||Let's first look at '''learn''' command. |
+ | |||
|- | |- | ||
− | || 00:53 | + | ||00:53 |
− | ||''' learn''' is a special command as it is used to create your own commands. | + | ||''' learn''' is a special '''command''' as it is used to create your own commands. |
|- | |- | ||
− | || 01:01 | + | ||01:01 |
− | ||'learn' | + | ||'''learn''' command takes '''input''' and returns '''output'''. |
+ | |||
|- | |- | ||
||01:05 | ||01:05 | ||
||Let's take a look at how a new command is created. | ||Let's take a look at how a new command is created. | ||
+ | |||
|- | |- | ||
||01:10 | ||01:10 | ||
||Let me zoom the program text to have a clear view. | ||Let me zoom the program text to have a clear view. | ||
+ | |||
|- | |- | ||
||01:14 | ||01:14 | ||
− | ||Let's type a code in the editor to draw a square: | + | ||Let's type a code in the '''editor''' to draw a square: |
|- | |- | ||
− | || 01:19 | + | ||01:19 |
||'''repeat 4''' within curly brackets | ||'''repeat 4''' within curly brackets | ||
− | |||
{ | { | ||
'''forward 10''' | '''forward 10''' | ||
− | |||
'''turnleft 90''' | '''turnleft 90''' | ||
− | |||
} | } | ||
|- | |- | ||
− | || 01:31 | + | ||01:31 |
− | ||Here the number '''10''' | + | ||Here, the number '''10''' specifies the length of the side of the square. |
+ | |||
|- | |- | ||
− | || 01:37 | + | ||01:37 |
− | ||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. |
|- | |- | ||
− | || 01:45 | + | ||01:45 |
− | ||We will name | + | ||We will name this set of commands, to draw a square, as '''square'''. |
|- | |- | ||
− | || 01:50 | + | ||01:50 |
− | ||The command ''''learn'''' is followed by the name of the command to be learnt | + | ||The command ''''learn'''' is followed by the name of the command to be learnt. In this case, it is "square". |
+ | |||
|- | |- | ||
− | || 01:59 | + | ||01:59 |
− | ||Let us type the following code | + | ||Let us type the following code: |
|- | |- | ||
− | || 02:02 | + | ||02:02 |
− | ||'''learn''' space '''square''' space '''$x''' | + | ||'''learn''' space '''square''' space '''$x'''. |
|- | |- | ||
− | || 02:10 | + | ||02:10 |
− | || | + | ||Let's include curly brackets. |
− | + | ||
|- | |- | ||
− | || 02:13 | + | ||02:13 |
− | || | + | ||Let's replace '''10''' by '''$x'''. |
|- | |- | ||
− | || 02:19 | + | ||02:19 |
||New command that we have defined is called '''square.''' | ||New command that we have defined is called '''square.''' | ||
|- | |- | ||
− | || 02:23 | + | ||02:23 |
− | ||'''square''' takes one input argument, | + | ||'''square''' takes one input argument, '''$x''', to set the size of the square. |
|- | |- | ||
− | || 02:31 | + | ||02:31 |
− | ||Note that when you run this code,''' square''' returns no output. | + | ||Note that when you '''run''' this code,''' square''' returns no output. |
|- | |- | ||
− | || 02:37 | + | ||02:37 |
− | ||The command '''learn''' is just 'learning' other command ''' square''' to be used later. | + | ||The command '''learn''' is just 'learning' other command ''' square''', to be used later. |
|- | |- | ||
− | || 02:43 | + | ||02:43 |
||'''square''' command can now be used like a normal command in the rest of the code. | ||'''square''' command can now be used like a normal command in the rest of the code. | ||
+ | |||
|- | |- | ||
− | || 02:51 | + | ||02:51 |
||Let me add few more lines here. | ||Let me add few more lines here. | ||
+ | |||
|- | |- | ||
− | || 02:54 | + | ||02:54 |
− | ||Let's type | + | ||Let's type: '''go 200,200''' '''square 100''' |
− | + | ||
− | + | |- | |
− | + | ||03:04 | |
− | + | ||Using the command '''square 100''', Turtle draws a square of dimension 100. | |
− | '''square 100''' | + | |
|- | |- | ||
− | || 03: | + | ||03:11 |
− | || | + | ||Let's '''Run''' the code now. |
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | || 03:13 | + | ||03:13 |
||'''Turtle''' draws a square on the canvas. | ||'''Turtle''' draws a square on the canvas. | ||
|- | |- | ||
− | || 03:17 | + | ||03:17 |
||Let's now replace 100 by 50. | ||Let's now replace 100 by 50. | ||
+ | |||
|- | |- | ||
− | || 03:22 | + | ||03:22 |
− | ||Let's run again | + | ||Let's '''run''' again,'''Turtle''' draws another '''square''' with dimension 50. |
|- | |- | ||
− | || 03: | + | ||03:28 |
− | ||''' | + | ||Please note that this '''command''' can be used only within the scope of this program. |
|- | |- | ||
− | + | ||03:35 | |
− | + | ||
− | + | ||
− | || 03:35 | + | |
||I will clear the current code from editor. | ||I will clear the current code from editor. | ||
|- | |- | ||
− | || 03:38 | + | ||03:38 |
− | ||Type | + | ||Type '''"clear"''' command and '''Run''' to clean the canvas. |
+ | |||
|- | |- | ||
||03:44 | ||03:44 | ||
− | ||Next we will learn about “random” command. | + | ||Next, we will learn about '''“random”''' command. |
+ | |||
|- | |- | ||
− | || 03:48 | + | ||03:48 |
||'''random''' command takes input and returns output. | ||'''random''' command takes input and returns output. | ||
+ | |||
|- | |- | ||
− | || 03:52 | + | ||03:52 |
− | || Syntax for the random command is “random X,Y” | + | ||Syntax for the random command is: '''“random X,Y”''' |
|- | |- | ||
− | || 03:57 | + | ||03:57 |
− | || where X and Y are two inputs. | + | ||where X and Y are two inputs. |
|- | |- | ||
− | || 04:01 | + | ||04:01 |
− | || X sets minimum output and Y sets maximum output. | + | ||X sets minimum output and Y sets maximum output. |
|- | |- | ||
− | || 04:07 | + | ||04:07 |
− | || Output is randomly chosen number between X and Y. | + | ||Output is randomly chosen number between X and Y. |
+ | |||
|- | |- | ||
||04:13 | ||04:13 | ||
− | ||Let's put the “random” command to use in the application. | + | ||Let's put the “random” command to use in the '''application'''. |
+ | |||
|- | |- | ||
− | || 04:18 | + | ||04:18 |
− | ||I already have | + | ||I already have a code in a text-editor. |
|- | |- | ||
− | || 04:22 | + | ||04:22 |
− | ||I will explain the code. | + | ||I will explain the code now. |
+ | |||
|- | |- | ||
− | || 04:24 | + | ||04:24 |
− | ||“reset” command sets '''Turtle''' to default position | + | ||'''“reset”''' command sets '''Turtle''' to default position. |
+ | |||
|- | |- | ||
− | || 04:29 | + | ||04:29 |
− | ||Here, the command '''random 1,20''' selects a | + | ||Here, the command '''random 1,20''' selects a number which is equal or greater than 1 and equal or less than 20 and assigns it to the variable 'x'. |
+ | |||
|- | |- | ||
− | || 04:44 | + | ||04:44 |
− | ||'''repeat''' command and the commands within curly brackets draw a circle | + | ||'''repeat''' command and the commands within curly brackets draw a circle. |
+ | |||
|- | |- | ||
− | || 04:51 | + | ||04:51 |
− | ||I will copy the code from text editor and paste it into '''KTurtle's''' editor. | + | ||I will '''copy''' the code from text editor and '''paste''' it into '''KTurtle's''' editor. |
|- | |- | ||
− | || 04:58 | + | ||04:58 |
− | ||Pause the tutorial and type the program into your '''KTurtle''' editor. | + | ||Pause the tutorial here and type the program into your '''KTurtle''' editor. |
|- | |- | ||
− | || 05:03 | + | ||05:03 |
− | ||Resume the tutorial after typing the program | + | ||Resume the tutorial after typing the program. |
+ | |||
|- | |- | ||
− | || 05:08 | + | ||05:08 |
− | ||When we run this code, | + | ||When we '''run''' this code, |
|- | |- | ||
− | || 05:10 | + | ||05:10 |
||'''Turtle''' draws a circle with radius between 1 and 20 on the canvas. | ||'''Turtle''' draws a circle with radius between 1 and 20 on the canvas. | ||
|- | |- | ||
− | || 05:16 | + | ||05:16 |
− | ||Let us execute this code a few times | + | ||Let us execute this code a few times. |
|- | |- | ||
− | || 05:20 | + | ||05:20 |
||You can see that a circle with a different size is generated each time. | ||You can see that a circle with a different size is generated each time. | ||
|- | |- | ||
− | || 05:26 | + | ||05:26 |
||Every time you execute this code, a circle with a different radius is drawn on the canvas. | ||Every time you execute this code, a circle with a different radius is drawn on the canvas. | ||
+ | |||
|- | |- | ||
||05:33 | ||05:33 | ||
− | ||Let us now use both | + | ||Let us now use both '''learn''' and '''random''' commands in an example. |
+ | |||
|- | |- | ||
− | || 05:39 | + | ||05:39 |
− | ||I will clear the current code | + | ||I will clear the current code from the editor. Type "clear" command and '''Run''' to clean the canvas. |
+ | |||
|- | |- | ||
− | || 05:48 | + | ||05:48 |
− | ||I already have a program in the Text editor. | + | ||I already have a program in the Text-editor. |
|- | |- | ||
− | || 05:52 | + | ||05:52 |
||I will explain the code now. | ||I will explain the code now. | ||
+ | |||
|- | |- | ||
||05:55 | ||05:55 | ||
− | ||“reset” command sets Turtle to its default position. | + | ||'''“reset”''' command sets Turtle to its default position. |
+ | |||
|- | |- | ||
− | || 06:00 | + | ||06:00 |
||'''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. | ||
+ | |||
|- | |- | ||
− | || 06:09 | + | ||06:09 |
− | ||'''$R, $G | + | ||'''$R, $G''' and '''$B''' are three variables to which I am assigning random values between 0 and 255. |
+ | |||
|- | |- | ||
− | || 06:19 | + | ||06:19 |
− | ||In the command '''canvascolor $R,$G | + | ||In the command '''canvascolor $R, $G''' and '''$B''', |
|- | |- | ||
− | || 06:23 | + | ||06:23 |
− | ||the Red-Green-Blue combination is replaced by the values assigned to the variables R, G | + | ||the Red-Green-Blue combination is replaced by the values assigned to the variables 'R', 'G' and 'B' in the previous step. |
|- | |- | ||
− | || 06:34 | + | ||06:34 |
− | ||The canvas color is randomly set | + | ||The canvas color is randomly set when this command is executed. |
+ | |||
|- | |- | ||
− | || 06:41 | + | ||06:41 |
||'''$red, $blue, $green''' are another set of variables | ||'''$red, $blue, $green''' are another set of variables | ||
|- | |- | ||
− | || 06:45 | + | ||06:45 |
||to which random values between 0 and 255 are assigned randomly. | ||to which random values between 0 and 255 are assigned randomly. | ||
|- | |- | ||
− | || 06:53 | + | ||06:53 |
− | ||'''pencolor $red, $blue and $green''' the Red-Blue -Green combination values are replaced by the variables | + | ||'''pencolor $red, $blue''' and '''$green''' the Red-Blue-Green combination values are replaced by the variables. |
+ | |||
|- | |- | ||
− | || 07:02 | + | ||07:02 |
− | || '''$red''', '''$green''' and '''$blue''' to which random values were assigned | + | ||'''$red''', '''$green''' and '''$blue''' to which random values were assigned in the previous step. |
− | in the previous step. | + | |
|- | |- | ||
− | || 07:10 | + | ||07:10 |
− | ||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. |
+ | |||
|- | |- | ||
− | || 07:18 | + | ||07:18 |
||'''penwidth 2''' sets the width of pen to 2 pixels. | ||'''penwidth 2''' sets the width of pen to 2 pixels. | ||
+ | |||
|- | |- | ||
||07:25 | ||07:25 | ||
− | || Next I have entered the code to learn to draw a circle. | + | ||Next, I have entered the code to learn to draw a circle. |
|- | |- | ||
− | || 07:30 | + | ||07:30 |
||Here '''$x''' represents the size of the circle. | ||Here '''$x''' represents the size of the circle. | ||
|- | |- | ||
− | || 07:35 | + | ||07:35 |
||'''repeat''' command followed by the code in curly brackets draws a circle. | ||'''repeat''' command followed by the code in curly brackets draws a circle. | ||
+ | |||
|- | |- | ||
− | || 07:43 | + | ||07:43 |
− | ||The next set of commands that is '''go''' | + | ||The next set of commands, that is, '''go''' command followed by '''circle''' command draw circles with the specified sizes. |
+ | |||
|- | |- | ||
− | || 07:54 | + | ||07:54 |
− | ||For example: circle with size 5 draws a circle with size 5 | + | ||For example: circle with size 5, draws a circle with size 5 |
|- | |- | ||
− | || 08:01 | + | ||08:01 |
− | || | + | ||at the co-ordinates specified at 'X' and 'Y' positions, in the '''go''' command. |
|- | |- | ||
− | || 08:09 | + | ||08:09 |
||For each circle, I have specified different positions on the canvas. | ||For each circle, I have specified different positions on the canvas. | ||
+ | |||
|- | |- | ||
− | || 08:16 | + | ||08:16 |
− | ||I will copy the code from text editor and paste it into KTurtle's editor. | + | ||I will copy the code from text-editor and paste it into KTurtle's editor. |
|- | |- | ||
− | || 08:23 | + | ||08:23 |
||Pause the tutorial here and type the program into your KTurtle editor. | ||Pause the tutorial here and type the program into your KTurtle editor. | ||
|- | |- | ||
− | || 08:29 | + | ||08:29 |
||Resume the tutorial after typing the program. | ||Resume the tutorial after typing the program. | ||
+ | |||
|- | |- | ||
− | || 08:33 | + | ||08:33 |
||I will execute this code in''' Fullspeed'''. | ||I will execute this code in''' Fullspeed'''. | ||
|- | |- | ||
− | || 08:37 | + | ||08:37 |
||You can execute this code at any of the speeds specified in the ''' Run''' option. | ||You can execute this code at any of the speeds specified in the ''' Run''' option. | ||
|- | |- | ||
− | || 08:43 | + | ||08:43 |
− | ||I will run this code a few times. | + | ||I will '''run''' this code a few times. |
|- | |- | ||
− | || 08:46 | + | ||08:46 |
||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. | ||
|- | |- | ||
− | || 08:54 | + | ||08:54 |
− | ||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. |
|- | |- | ||
− | || 09:01 | + | ||09:01 |
− | ||You can execute the code how many ever times you want and note the changes in | + | ||You can execute the code how many ever times you want and note the changes in the randomly set values of the '''pen''' and '''canvas'''. |
− | the randomly set values of the pen and canvas. | + | |
|- | |- | ||
||09:15 | ||09:15 | ||
||With this we come to the end of this tutorial. | ||With this we come to the end of this tutorial. | ||
+ | |||
|- | |- | ||
− | || 09:20 | + | ||09:20 |
− | ||Let's summarize | + | ||Let's summarize. |
+ | |||
|- | |- | ||
||09:22 | ||09:22 | ||
− | ||In this tutorial we have learnt about | + | ||In this tutorial, we have learnt about: “learn” command and “random” command. |
− | |||
− | |||
− | |||
|- | |- | ||
||09:30 | ||09:30 | ||
Line 365: | Line 392: | ||
|- | |- | ||
− | || 09:32 | + | ||09:32 |
− | || | + | ||using '''learn''' command- draw a |
− | + | pentagon | |
− | + | square | |
− | + | rectangle | |
− | + | hexagon | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
on all four corners of your canvas and | on all four corners of your canvas and | ||
|- | |- | ||
− | || 09:45 | + | ||09:45 |
− | || | + | ||a circle at the centre of the canvas. |
+ | |||
|- | |- | ||
− | || 09:49 | + | ||09:49 |
− | || Using the “random” command create various colors and | + | ||Using the “random” command, create various colors and |
|- | |- | ||
− | || 09:55 | + | ||09:55 |
− | || | + | ||customize your geometric shapes and canvas. |
+ | |||
|- | |- | ||
− | || | + | ||10:00 |
− | ||Watch the video available at this URL | + | ||Watch the video available at this URL:http://spoken-tutorial.org/What_is_a_Spoken-Tutorial |
+ | |||
|- | |- | ||
− | || 10:04 | + | ||10:04 |
− | ||It | + | ||It summarizes the Spoken Tutorial project. |
|- | |- | ||
− | || 10:08 | + | ||10:08 |
− | ||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. |
+ | |||
|- | |- | ||
− | || 10:13 | + | ||10:13 |
− | ||The Spoken Tutorial Project | + | ||The Spoken Tutorial Project team : |
|- | |- | ||
− | || 10:15 | + | ||10:15 |
− | ||Conducts workshops using spoken tutorials | + | ||Conducts workshops using spoken tutorials. |
|- | |- | ||
− | || 10:19 | + | ||10:19 |
− | ||Gives certificates to those who pass an online test | + | ||Gives certificates to those who pass an online test. |
|- | |- | ||
− | || 10:22 | + | ||10:22 |
− | ||For more details, please write to | + | ||For more details, please write to: contact@spoken-tutorial.org |
+ | |||
|- | |- | ||
− | || 10:29 | + | ||10:29 |
− | ||Spoken Tutorial | + | ||'''Spoken Tutorial''' project is a part of the '''Talk to a Teacher''' project. |
|- | |- | ||
− | || 10:33 | + | ||10:33 |
− | ||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. |
|- | |- | ||
− | || 10:40 | + | ||10:40 |
− | ||More information on this | + | ||More information on this mission is available at this link: http://spoken-tutorial.org/NMEICT-Intro |
|- | |- | ||
− | || 10:46 | + | ||10:46 |
||This script is contributed by '''IT for change, Bangaluru.''' | ||This script is contributed by '''IT for change, Bangaluru.''' | ||
|- | |- | ||
− | || 10:50 | + | ||10:50 |
− | ||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. |
|- | |- |
Latest revision as of 17:31, 24 March 2017
Time | Narration |
00:01 | Hello everybody. Welcome to this tutorial on Special Commands in KTurtle. |
00:08 | In this tutorial, we will learn about:
“learn” command and “random” command. |
00:15 | To record this tutorial, I am using:
Ubuntu Linux OS version 12.04 KTurtle version 0.8.1 beta. |
00:28 | We assume that you have basic working knowledge of 'KTurtle'. |
00:33 | If not, for relevant tutorials, please visit our website:http://spoken-tutorial.org |
00:39 | Let's open a new KTurtle Application. |
00:42 | Click on Dash home. |
00:44 | In the Search bar, type: "kturtle". |
00:47 | Click on the KTurtle icon. |
00:50 | Let's first look at learn command. |
00:53 | learn is a special command as it is used to create your own commands. |
01:01 | learn command takes input and returns output. |
01:05 | Let's take a look at how a new command is created. |
01:10 | Let me zoom the program text to have a clear view. |
01:14 | Let's type a code in the editor to draw a square: |
01:19 | repeat 4 within curly brackets
{ forward 10 turnleft 90 } |
01:31 | Here, the number 10 specifies the length of the side of the square. |
01:37 | Now, let's learn the commands involved to draw a square, using the learn command. |
01:45 | We will name this set of commands, to draw a square, as square. |
01:50 | The command 'learn' is followed by the name of the command to be learnt. In this case, it is "square". |
01:59 | Let us type the following code: |
02:02 | learn space square space $x. |
02:10 | Let's include curly brackets. |
02:13 | Let's replace 10 by $x. |
02:19 | New command that we have defined is called square. |
02:23 | square takes one input argument, $x, to set the size of the square. |
02:31 | Note that when you run this code, square returns no output. |
02:37 | The command learn is just 'learning' other command square, to be used later. |
02:43 | square command can now be used like a normal command in the rest of the code. |
02:51 | Let me add few more lines here. |
02:54 | Let's type: go 200,200 square 100 |
03:04 | Using the command square 100, Turtle draws a square of dimension 100. |
03:11 | Let's Run the code now. |
03:13 | Turtle draws a square on the canvas. |
03:17 | Let's now replace 100 by 50. |
03:22 | Let's run again,Turtle draws another square with dimension 50. |
03:28 | Please note that this command can be used only within the scope of this program. |
03:35 | I will clear the current code from editor. |
03:38 | Type "clear" command and Run to clean the canvas. |
03:44 | Next, we will learn about “random” command. |
03:48 | random command takes input and returns output. |
03:52 | Syntax for the random command is: “random X,Y” |
03:57 | where X and Y are two inputs. |
04:01 | X sets minimum output and Y sets maximum output. |
04:07 | Output is randomly chosen number between X and Y. |
04:13 | Let's put the “random” command to use in the application. |
04:18 | I already have a code in a text-editor. |
04:22 | I will explain the code now. |
04:24 | “reset” command sets Turtle to default position. |
04:29 | Here, the command random 1,20 selects a number which is equal or greater than 1 and equal or less than 20 and assigns it to the variable 'x'. |
04:44 | repeat command and the commands within curly brackets draw a circle. |
04:51 | I will copy the code from text editor and paste it into KTurtle's editor. |
04:58 | Pause the tutorial here and type the program into your KTurtle editor. |
05:03 | Resume the tutorial after typing the program. |
05:08 | When we run this code, |
05:10 | Turtle draws a circle with radius between 1 and 20 on the canvas. |
05:16 | Let us execute this code a few times. |
05:20 | You can see that a circle with a different size is generated each time. |
05:26 | Every time you execute this code, a circle with a different radius is drawn on the canvas. |
05:33 | Let us now use both learn and random commands in an example. |
05:39 | I will clear the current code from the editor. Type "clear" command and Run to clean the canvas. |
05:48 | I already have a program in the Text-editor. |
05:52 | I will explain the code now. |
05:55 | “reset” command sets Turtle to its default position. |
06:00 | canvassize 300,300 sets the width and height of the canvas to 300 pixels each. |
06:09 | $R, $G and $B are three variables to which I am assigning random values between 0 and 255. |
06:19 | In the command canvascolor $R, $G and $B, |
06:23 | the Red-Green-Blue combination is replaced by the values assigned to the variables 'R', 'G' and 'B' in the previous step. |
06:34 | The canvas color is randomly set when this command is executed. |
06:41 | $red, $blue, $green are another set of variables |
06:45 | to which random values between 0 and 255 are assigned randomly. |
06:53 | pencolor $red, $blue and $green the Red-Blue-Green combination values are replaced by the variables. |
07:02 | $red, $green and $blue to which random values were assigned in the previous step. |
07:10 | The color of the pen is also set randomly when the command is executed. |
07:18 | penwidth 2 sets the width of pen to 2 pixels. |
07:25 | Next, I have entered the code to learn to draw a circle. |
07:30 | Here $x represents the size of the circle. |
07:35 | repeat command followed by the code in curly brackets draws a circle. |
07:43 | The next set of commands, that is, go command followed by circle command draw circles with the specified sizes. |
07:54 | For example: circle with size 5, draws a circle with size 5 |
08:01 | at the co-ordinates specified at 'X' and 'Y' positions, in the go command. |
08:09 | For each circle, I have specified different positions on the canvas. |
08:16 | I will copy the code from text-editor and paste it into KTurtle's editor. |
08:23 | Pause the tutorial here and type the program into your KTurtle editor. |
08:29 | Resume the tutorial after typing the program. |
08:33 | I will execute this code in Fullspeed. |
08:37 | You can execute this code at any of the speeds specified in the Run option. |
08:43 | I will run this code a few times. |
08:46 | You can see the difference in randomly set values of pen color and canvas color. |
08:54 | Note the change in the color of the pen and the canvas on each execution. |
09:01 | You can execute the code how many ever times you want and note the changes in the randomly set values of the pen and canvas. |
09:15 | With this we come to the end of this tutorial. |
09:20 | Let's summarize. |
09:22 | In this tutorial, we have learnt about: “learn” command and “random” command. |
09:30 | As an assignment for you to solve, |
09:32 | using learn command- draw a
pentagon square rectangle hexagon on all four corners of your canvas and |
09:45 | a circle at the centre of the canvas. |
09:49 | Using the “random” command, create various colors and |
09:55 | customize your geometric shapes and canvas. |
10:00 | Watch the video available at this URL:http://spoken-tutorial.org/What_is_a_Spoken-Tutorial |
10:04 | It summarizes the Spoken Tutorial project. |
10:08 | If you do not have good bandwidth, you can download and watch it. |
10:13 | The Spoken Tutorial Project team : |
10:15 | Conducts workshops using spoken tutorials. |
10:19 | Gives certificates to those who pass an online test. |
10:22 | For more details, please write to: contact@spoken-tutorial.org |
10:29 | Spoken Tutorial project is a part of the Talk to a Teacher project. |
10:33 | It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
10:40 | More information on this mission is available at this link: http://spoken-tutorial.org/NMEICT-Intro |
10:46 | This script is contributed by IT for change, Bangaluru. |
10:50 | 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