Logo Programming

advertisement
Logo Programming
What is LOGO?




LOGO is one of a number of computer languages to have
been developed in the field of Artificial Intelligence.
LOGO was developed at the Massachusetts Institute of
Technology in the late 1960's as part of a research project
to create a language for the teaching of mathematical
ideas to children through computer programming.
It was intended to be easy to learn, easy to use, easy to
read, but also powerful, and therefore able to cope with
complex activities.
LOGO was evolved by a team including Wallace Feurzeig
(who suggested the name LOGO), Cynthia Solomon and
the man who is now the most well-known LOGO figure,
Seymour Papert.
Different versions




MSW Logo
HKU Logo
PC Logo
StarLogo (used for modeling)
HKU Logo Vs MSW Logo
HOW DOES LOGO WORK?



Logo programs are built up through the use of
procedures.
A computer program in LOGO is just a collection
of procedures which achieve a particular
objective.
The work TO is used when creating ('defining')
procedures; this is to emphasize the way we can
think of procedures as being like verbs.
LOGO and THINKING

Proponents of LOGO argue that LOGO programming can be seen
as a direct analogy of the thinking process itself.

The similarity between the building up of LOGO programs and
the building up of thought-structures is clear. The evolution of a
LOGO program by developing and testing simple procedures,
then incorporation them in more complicated ones can to some
extent parallel the process of thinking.

For Papert, this similarity between LOGO-work and 'thoughtwork' is what makes LOGO not just a programming language but
a 'tool to think with'.

Learning, at any level, proceeds by a process of trial and error.
LOGO and THINKING

The unexpected response is seen as a positive step in the
right direction, and the learner is encouraged to think
about why the unexpected result occurred. Unexpected
results are therefore seen as useful stages in the learning
process.

'Debugging', is considered to be an essential part of the
learning process, by which conceptual structures are
tested and altered until found acceptable.

'Bugs' are not seen as 'wrong answers' but as unexpected
outcomes which should stimulate thinking and lead to the
mastery of ideas that comes from an understanding of how
to use them successfully.
LOGO and SCHOOLS
LOGO is often suggested as ' ideal
computer language for children' ; and
most of the current interest in it comes
from educational practitioners.
What does LOGO offer schools in particular?




The main justification for LOGO-use in
schools arises from the nature of the LOGOuse in schools arises from the nature of the
LOGO learning experience. Exploration and
discovery are generally accepted as
essential parts of the experience which the
schools can offer.
LOGO also offers a ready avenue into
familarisation with and general use of the
computer
LOGO offers an introduction to computer
programming which is highly structured and
encourages 'top-down' programming.
The importance of 'debugging' in learning
has been mentioned above.



It is a common observation of those who
have used LOGO in the classroom, that
LOGO is enjoyable. The fact that learning is
enjoyable is not trivial, for enjoyment in
learning is a source of motivation and of
concentration.
LOGO is most effectively used with groups,
and when so used enables the learning
benefits of group activity to be obtained.
Because of the range of 'microworlds' which
it can support. LOGO can be used to allow
children to explore various and different
elements of the curriculum, while
maintaining a unity of good thinking practice.
Logo as a Programming
Language






Logo is procedural
Logo is interactive
Logo is recursive
Logo has list processing
Logo is not typed
Logo is extensible
Logo as a Learning Language





Logo, though, was developed as a learning
language, not for a specific branch of
mathematics, but for problem-solving behavior.
Logo is 'tuned' for interesting applications.
Logo is user-friendly.
Logo has no threshold and ceiling.
Logo is for learning learning.
What facilities Does LOGO
offer?








Different sets of LOGO facilities can place the user in
different 'micro-worlds' which can become environments for
exploration and discovery, and thus environments for
learning.
Some micro-worlds :
the 'turtle world' of the plane geometry
the 'music world'
the 'dynaturtle world' of movement in outer space;
database possibilities;
robotics and control possibilities;
facilities for poetry and creative writing etc
Learning Styles



Planner
 likes to build structured programs from the top level down
or from the bottom level up, but always from a coherent
formulated plan.
macro-explorer
 likes to mess about with subprocedures or building blocks
to arrive at a product, rather than starting out with a specific
goal.
micro-explorer
 explore their environment on a microlevel before they can
establish patterns of planning or directed exploration.
As Logo is a popular programming language, there exists different
versions of Logo. In your school, you may find the following versions:





HKU Logo (CGA version)
HKU Logo (VGA version)
PC Logo for DOS
PC Logo for Windows
MSW Logo
Some differences ….
Working environment of HKU Logo.
Graphic Window
The Upper part is the
graphic window while
the lower part is the
text window. You can
type the commands in
the text window to
instruct the turtle
Text Window
MSW LOGO
The turtle is sitting at
the centre of its
playground. Down
below the playground
is the Commander
window. To instruct
the turtle, you simply
type the commands in
the Input Box and
click on the execute
button (or just press
the ENTER key) to
execute them
Menu Bar
Turtle's
Playground
The turtle
Commander Window
Input Box
Output/Command-Recall List
Box
Command buttons
(for HKU Logo users)
Learn Turtle’s ABC
Press the Enter key at the end of
each instruction.
?FD 50
Press the spacebar to add a
space here.
?FD 50
?RT 90
?FD 40
?LT 90
?BK 100
Add these instructions
and remember to press
the Enter key at the end
of each instruction.
Learn Turtle’s ABC
Press the spacebar to add a
space here.
FD 50
RT 90
FD 40
RT 90
BK 100
(for MSW Logo users)
Press the Enter key at the end of
each instruction.
Add these instructions and
remember to press the
Enter key at the end of
each instruction.
First procedure for HKU Logo user
The prompts are
different!
You can enter the Logo
commands when you see the
question mark (?) again.
?TO SQUARE
>REPEAT 4[FD 100 RT 90]
>END
SQUARE DEFINED
?
Logo tells you that the
procedure called SQUARE
has been defined.
The above procedure can be used to draw a square. If you
want to use the procedure, you only need to type the name of
the procedure after the prompt ‘?’, for example,
?SQUARE
and then a square will be drawn.
First procedure for MSW Logo user
Type to square in the input box
In MSW Logo, the
commands can be typed in
upper or lower cases.
You will see a dialog box which let you
input the Logo commands.
Type repeat 4[fd 100 rt 90] and press Enter.
Input end to indicate that you have completed
procedure.
Remember to press Enter or click the OK button
The commander box will tell you that your
procedure has been defined
Logo tells you that the
procedure called
SQUARE has been
defined.
The above procedure can be used to draw a
square.
If you want to use the procedure, you only
need to type the name of the procedure in the
input box.
A square will be drawn on screen.
Group Activity
Compare and contrast HKU LOGO with MSW LOGO
Try to compare and contrast these two versions of LOGO in
the following aspects:






Working environment
Basic Movements
Procedures
Workspace and file management
Flow control
Project Handling
Designing a programming
project
How to tackle a Logo Project
Defining the
problem
Completing the project
and sharing your work
with others
Setting up
appropriate goals
Debugging and
Revising the project
Creating a Working
Draft
Some hints for developing
Logo projects:




Top-down analysis
Modular approach
State-transparent
Meaningful variable names and procedure
names
Project example:
Defining the problem
I want to ask the
turtle to build a
house.
Setting up appropriate goals
My dream house
should have a roof, a
door, walls and
windows.
Creating a working draft
House
Roof
Triangle
Wall
Wall face
Rectangle 1
Door
Rectangle 2
Window
Rectangle 3
TO TRIANGLE
REPEAT 3 [FD 80 RT 120]
END
TO ROOF
RT 30
TRIANGLE
LT 30
END
TO WALL
WALLFACE
RT 90 FD
DOOR
RT 90 BK
PU FD 80
WINDOW1
PU BK 80
PU FD 80
WINDOW1
PU BK 80
END
25 LT 90
25 LT 90
RT 90 FD 10 LT 90 PD
LT 90 FD 10 RT 90 PD
RT 90 FD 50 LT 90 PD
LT 90 FD 50 RT 90 PD
The house can be built now!
TO HOUSE
WALL
FD 100
ROOF
BK 100
END
Debugging and Revising
:LENGTH
:LENGTH*30/80
:HEIGHT*10/100
:LENGTH*20/80
:HEIGHT
:HEIGHT*60/100
Completing the project and
sharing your work with others
House
Roof
Triangle
Wall
Wall face
Rectangle
Door
Rectangle
Window
Rectangle
TO TRIANGLE :LENGTH
REPEAT 3[FD :LENGTH RT 120]
END
TO RECTANGLE :H :L
REPEAT 2 [FD :H RT 90 FD :L RT 90]
END
To be a Town Planner
How to design an IT task for
learning Logo?
Activity
Try to draft a learning task for a selected Logo topic.
Download