0% found this document useful (0 votes)
2 views

Program

The document outlines a simple interactive program where a character named Mr. Smort greets the user and prompts them to create a square. The user is asked for their name and a color choice, which determines the pen color for drawing. If the user selects 'multicolour', they can control a turtle to move and change colors based on arrow key inputs.

Uploaded by

rishabhunni0912
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Program

The document outlines a simple interactive program where a character named Mr. Smort greets the user and prompts them to create a square. The user is asked for their name and a color choice, which determines the pen color for drawing. If the user selects 'multicolour', they can control a turtle to move and change colors based on arrow key inputs.

Uploaded by

rishabhunni0912
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

TextWindow.WriteLine("Hi, I'm Mr. Smort.

")
TextWindow.WriteLine("You are going to make a square.")
TextWindow.Write("What is your name?")
name = TextWindow.Read()
TextWindow.WriteLine("Hi, " + name)
TextWindow.Write("Black, Red, Green, Blue, or Multicolour?")
color = TextWindow.Read()

If color = "black" Then


GraphicsWindow.PenColor = "black"
ElseIf color = "red" Then
GraphicsWindow.PenColor = "red"
ElseIf color = "green" Then
GraphicsWindow.PenColor = "green"
ElseIf color = "blue" Then
GraphicsWindow.PenColor = "blue"
ElseIf color = "multicolour" Then
Turtle.Show()
If GraphicsWindow.LastKey = "ArrowUp" Then
GraphicsWindow.PenColor = "red"
Turtle.Move(15)
EndIf
If GraphicsWindow.LastKey = "ArrowDown" Then
GraphicsWindow.PenColor = "blue"
Turtle.Move(-15)
EndIf
If GraphicsWindow.LastKey = "ArrowLeft" Then
Turtle.TurnLeft()
Turtle.Move(15)
EndIf
If GraphicsWindow.LastKey = "ArrowRight" Then
Turtle.TurnRight()
Turtle.Move(15)
EndIf
EndIf

You might also like