Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 8

'Chat Bot

continue = "yes"
TextWindow.Title="
Javier's Chat Bot :)"
textwindow.BackgroundColor=("deepskyblue")
TextWindow.WriteLine("Hello human. What is your name?")
name = TextWindow.Read()
While continue = "yes"
TextWindow.WriteLine("")
TextWindow.WriteLine("Hello " + name + ". What do you want to do?")
TextWindow.WriteLine("A. Chat Bot ")
TextWindow.WriteLine("B. Capital Test ")
TextWindow.WriteLine("C. Draw Shapes")
TextWindow.WriteLine("D. Number Guesser Program")
TextWindow.WriteLine("E. The Time")
answer = TextWindow.Read()
answer = Text.ConvertToLowerCase(answer)
IF answer = "a"
THEN
TextWindow.WriteLine("Hello " +name+ ", how are you? Good or bad?")
variable = TextWindow.Read()
variable = Text.ConvertToLowerCase(variable)
IF
variable = "good"
THEN
TextWindow.WriteLine("Good for you!")
TextWindow.WriteLine("What is you favourite colour?")
colour = TextWindow.Read()
Textwindow.WriteLine("Do you wear "+ colour +" clothes?")
a = TextWindow.Read()
Textwindow.WriteLine("What is your favourite number?")
number = TextWindow.Read()
Textwindow.WriteLine("Are you "+ number+ " years old?")
a = TextWindow.Read()
Textwindow.WriteLine("Do you have any siblings?")
sib = TextWindow.Read()
Text.ConvertToLowerCase(sib)
IF sib = "yes"
THEN
TextWindow.WriteLine("How many do you have?")
a1 = TextWindow.Read()
Textwindow.WriteLine("When were you born?")
a2 = TextWindow.Read()
Textwindow.WriteLine("Where were you born?")
a3 = TextWindow.Read()
Textwindow.WriteLine("Where do you live?")
a4 = TextWindow.Read()
Textwindow.WriteLine("What is your full name?")
a5 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite sport?")
a6 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite movie ")
a7 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite TV show")
a8 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite food")
a9 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite game?")
a10 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite football team")
a11 = TextWindow.Read()
Textwindow.WriteLine("Ok")
Textwindow.WriteLine("You have " + a1 + " siblings")
Textwindow.WriteLine("You were born on " + a2)
Textwindow.WriteLine("You were born in " + a3)
Textwindow.WriteLine("You live in " + a4)
Textwindow.WriteLine("Your full name is "+ a5)
Textwindow.WriteLine("Your favourite sport is " + a6)
Textwindow.WriteLine("Your favourite movie is " + a7)
Textwindow.WriteLine("Your favourite TV show is " + a8)
Textwindow.WriteLine("Your favourite food is " + a9)
Textwindow.WriteLine("Your favourite game is " + a10)
Textwindow.WriteLine("Your favourite football team is " + a11)
Textwindow.WriteLine("Right?")
ENDIF
ENDIF
ENDIF
IF
variable = "bad"
THEN
TextWindow.WriteLine("Why?")
a = TextWindow.Read()
TextWindow.WriteLine("Oh, I'm sorry for you")
TextWindow.WriteLine("What is you favourite colour?")
colour = TextWindow.Read()
Textwindow.WriteLine("Do you wear "+ colour +" clothes?")
a = TextWindow.Read()
Textwindow.WriteLine("What is your favourite number?")
number = TextWindow.Read()
Textwindow.WriteLine("Are you "+ number+ " years old?")
a = TextWindow.Read()
Textwindow.WriteLine("Do you have any siblings?")
sib = TextWindow.Read()
Text.ConvertToLowerCase(sib)
IF sib = "yes"
THEN
TextWindow.WriteLine("How many do you have?")
a1 = TextWindow.Read()
Textwindow.WriteLine("When were you born?")
a2 = TextWindow.Read()
Textwindow.WriteLine("Where were you born?")
a3 = TextWindow.Read()
Textwindow.WriteLine("Where do you live?")
a4 = TextWindow.Read()
Textwindow.WriteLine("What is your full name?")
a5 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite sport?")
a6 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite movie ")
a7 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite TV show")
a8 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite food")
a9 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite game?")
a10 = TextWindow.Read()
Textwindow.WriteLine("What is your favourite football team")
a11 = TextWindow.Read()
Textwindow.WriteLine("Ok")
Textwindow.WriteLine("You have " + a1 + " siblings")
Textwindow.WriteLine("You were born on " + a2)
Textwindow.WriteLine("You were born in " + a3)
Textwindow.WriteLine("You live in " + a4)
Textwindow.WriteLine("Your full name is "+ a5)
Textwindow.WriteLine("Your favourite sport is " + a6)
Textwindow.WriteLine("Your favourite movie is " + a7)
Textwindow.WriteLine("Your favourite TV show is " + a8)
Textwindow.WriteLine("Your favourite food is " + a9)
Textwindow.WriteLine("Your favourite game is " + a10)
Textwindow.WriteLine("Your favourite football team is " + a11)
Textwindow.WriteLine("Right?")
ENDIF
ENDIF

IF answer = "b"
THEN
Points = 0
TextWindow.WriteLine("What is you the USA's capital city?")
Textwindow.WriteLine("A. Chicago ")
Textwindow.WriteLine("B. Washington")
Textwindow.WriteLine("C. New York")
capital = TextWindow.Read()
capital = Text.ConvertToLowerCase(capital)
If capital = "b"
THEN
Points= Points + 1
Textwindow.WriteLine("You did it")
Else
Textwindow.WriteLine("Wrong it's Washington")
ENDIF
TextWindow.WriteLine("What is you the Germany's capital city?")
Textwindow.WriteLine("A. Dortmund ")
Textwindow.WriteLine("B. Hamburg")
Textwindow.WriteLine("C. Berlin")
capital = TextWindow.Read()
capital = Text.ConvertToLowerCase(capital)

If capital = "c"
THEN
Points= Points + 1
Textwindow.WriteLine("You did it")
Else
Textwindow.WriteLine("Wrong")
ENDIF
TextWindow.WriteLine("What is you the Finland's capital city?")
Textwindow.WriteLine("A. Tampere ")
Textwindow.WriteLine("B. Helsinki")
Textwindow.WriteLine("C. Turku")
capital = TextWindow.Read()
capital = Text.ConvertToLowerCase(capital)

If capital = "b"
THEN
Points= Points + 1
Textwindow.WriteLine("You did it")
Else
Textwindow.WriteLine("Wrong")
ENDIF
TextWindow.WriteLine("What is you the India's capital city?")
Textwindow.WriteLine("A. Hyderabad ")
Textwindow.WriteLine("B. Bangalore")
Textwindow.WriteLine("C. New Delhi")
capital = TextWindow.Read()
capital = Text.ConvertToLowerCase(capital)
If capital = "c"
THEN
Points= Points + 1
Textwindow.WriteLine("You did it")
Else
Textwindow.WriteLine("Wrong")
ENDIF

TextWindow.WriteLine("What is you the Russia's capital city?")


Textwindow.WriteLine("A. Moscow ")
Textwindow.WriteLine("B. Novosibirsk")
Textwindow.WriteLine("C. Saint Petersburg")
capital = TextWindow.Read()
capital = Text.ConvertToLowerCase(capital)

If capital = "a"
THEN
Points= Points + 1
Textwindow.WriteLine("You did it")
Else
Textwindow.WriteLine("Wrong")
ENDIF
Textwindow.WriteLine("You got " + Points + " points!")
EndIF

IF answer = "c"
THEN
TextWindow.WriteLine("In what color do you want it?")
TextWindow.WriteLine("A. Blue")
TextWindow.WriteLine("B. Green")
TextWindow.WriteLine("C. yellow ")
TextWindow.WriteLine("D. red ")
TextWindow.WriteLine("E. orange")
TextWindow.WriteLine("F. pink")
shapecolor = TextWindow.Read()
shapecolor = Text.ConvertToLowerCase(shapecolor)
IF shapecolor = "a"
THEN
GraphicsWindow.PenColor = "#0000FF"
ENDIF
IF shapecolor = "b"
THEN
GraphicsWindow.PenColor = "#008000"
ENDIF
IF shapecolor = "c"
THEN
GraphicsWindow.PenColor = "#FFFF00"
ENDIF
IF shapecolor = "d"
THEN
GraphicsWindow.PenColor = "#FFA500"
ENDIF
IF shapecolor = "e"
THEN
GraphicsWindow.PenColor = "#0000FF"
ENDIF
IF shapecolor = "f"
THEN
GraphicsWindow.PenColor = "#FFC0CB"
ENDIF
TextWindow.WriteLine("What do you want to draw?")
TextWindow.WriteLine("A. A square ")
TextWindow.WriteLine("B. A rectangle")
TextWindow.WriteLine("C. A triangle ")
TextWindow.WriteLine("D. A circle ")
TextWindow.WriteLine("E. A hexagon")
shape = TextWindow.Read()
shape = Text.ConvertToLowerCase(shape)

If shape = "a"
THEN
For i = 1 To 4
Turtle.Move(100)
Turtle.TurnRight()
EndFor
ENDIF
If shape = "b"
THEN
Turtle.Move(100)
Turtle.TurnRight()
Turtle.Move(200)
Turtle.TurnRight()
Turtle.Move(100)
Turtle.TurnRight()
Turtle.Move(200)
Turtle.TurnRight()
ENDIF
If shape = "c"
THEN
For i = 1 To 3
Turtle.Move(100)
Turtle.Turn(120)
EndFor
ENDIF
If shape = "d"
THEN
For i = 1 To 72
turtle.Move(10)
turtle.Turn(5)
EndFor
ENDIF
If shape = "e"
THEN
For i = 1 To 6
Turtle.Move(100)
Turtle.Turn(60)
ENDFOR
ENDIF
EndIF

IF answer = "d"
THEN
'Number Guesser Program
For i = 1 to 10
secretnumber= math.GetRandomNumber(10)
TextWindow.WriteLine("Enter a number between 1 and 10")
guess=TextWindow.Read()
IF guess = secretnumber
THEN
TextWindow.WriteLine("You did it")
Else
TextWindow.WriteLine("Wrong, try again ")
ENDIF
EndFor
EndIf

IF answer = "e"
THEN
TextWindow.WriteLine("What do you want to know")
TextWindow.WriteLine("A. Time")
TextWindow.WriteLine("B. Date")
TextWindow.WriteLine("C. Year")
TextWindow.WriteLine("D. Month")
TextWindow.WriteLine("E. Week Day")
TextWindow.WriteLine("F. Day ")
TextWindow.WriteLine("G. Hour")
TextWindow.WriteLine("H. Minute")
TextWindow.WriteLine("I. Second")
TextWindow.WriteLine("J. Millisecond")
TextWindow.WriteLine("K. The number of milliseconds that have elapsed since
1900.")
TextWindow.Read()
answer1 = TextWindow.Read()
answer1 = Text.ConvertToLowerCase(answer1)
IF answer1 = "a"
THEN
TextWindow.WriteLine("It is ")
TextWindow.WriteLine(Clock.Time)
ENDIF
IF answer1 = "b"
THEN
TextWindow.WriteLine("The time is: ")
TextWindow.WriteLine(Clock.Date)
ENDIF
IF answer1 = "c"
THEN
TextWindow.WriteLine("The year is: ")
TextWindow.WriteLine(Clock.Year)
ENDIF
IF answer1 = "d"
THEN
TextWindow.WriteLine("The month is: ")
TextWindow.WriteLine(Clock.Month)
ENDIF
IF answer1 = "e"
THEN
TextWindow.WriteLine("The week day is: ")
TextWindow.WriteLine(Clock.WeekDay)
ENDIF
IF answer1 = "f"
THEN
TextWindow.WriteLine("The day of the month is: ")
TextWindow.WriteLine(Clock.Day)
ENDIF
IF answer1 = "g"
THEN
TextWindow.WriteLine("The hour is: ")
TextWindow.WriteLine(Clock.Hour)
ENDIF
IF answer1 = "h"
THEN
TextWindow.WriteLine("The time is: ")
TextWindow.WriteLine(Clock.Minute)
ENDIF
IF answer1 = "i"
THEN
TextWindow.WriteLine("The second is: ")
TextWindow.WriteLine(Clock.Second)
ENDIF
IF answer1 = "j"
THEN
TextWindow.WriteLine("The millisecond is: ")
TextWindow.WriteLine(Clock.Millisecond)
ENDIF
IF answer1 = "k"
THEN
TextWindow.WriteLine("The number of milliseconds that have elapsed
since 1900 is: ")
TextWindow.WriteLine(Clock.ElapsedMilliseconds)
EndIF

ENDIF

TextWindow.WriteLine("Do you want to continue? Yes or no?")


continue = TextWindow.Read()
Text.ConvertToLowerCase(continue)

If continue = "yes" or continue = "no"


THEN
flag = 1
else
flag = 0
EndIf
While flag=0
TextWindow.WriteLine("Please write yes or no!!")
TextWindow.WriteLine("Do not write " + continue)
continue = TextWindow.Read()
Text.ConvertToLowerCase(continue)
If continue = "yes" or continue = "no"
THEN
flag = 1
else
flag = 0
EndIf
EndWhile

EndWhile

You might also like