100% found this document useful (1 vote)
100 views

An Introduction to Programming Using Alice 2 2 2nd Edition Charles W. Herbert 2024 Scribd Download

Charles

Uploaded by

hakemgavali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
100 views

An Introduction to Programming Using Alice 2 2 2nd Edition Charles W. Herbert 2024 Scribd Download

Charles

Uploaded by

hakemgavali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

Visit https://ebookultra.

com to download the full version and


explore more ebooks

An Introduction to Programming Using Alice 2 2 2nd


Edition Charles W. Herbert

_____ Click the link below to download _____


https://ebookultra.com/download/an-introduction-to-
programming-using-alice-2-2-2nd-edition-charles-w-
herbert/

Explore and download more ebooks at ebookultra.com


Here are some recommended products that might interest you.
You can download now and explore!

An introduction to programming using Visual Basic 2008


with Visual Studio Expression edition DVD Schneider

https://ebookultra.com/download/an-introduction-to-programming-using-
visual-basic-2008-with-visual-studio-expression-edition-dvd-schneider/

ebookultra.com

An introduction to programming in emacs lisp 2nd Edition


Robert J. Chassell

https://ebookultra.com/download/an-introduction-to-programming-in-
emacs-lisp-2nd-edition-robert-j-chassell/

ebookultra.com

Doing time an introduction to the sociology of


imprisonment 2. ed Edition Matthews

https://ebookultra.com/download/doing-time-an-introduction-to-the-
sociology-of-imprisonment-2-ed-edition-matthews/

ebookultra.com

Foundations of Object Oriented Programming Using NET 2 0


Patterns 1st Edition Christian Gross (Auth.)

https://ebookultra.com/download/foundations-of-object-oriented-
programming-using-net-2-0-patterns-1st-edition-christian-gross-auth/

ebookultra.com
Computability Theory An Introduction to Recursion Theory
1st Edition Herbert B. Enderton

https://ebookultra.com/download/computability-theory-an-introduction-
to-recursion-theory-1st-edition-herbert-b-enderton/

ebookultra.com

Struts 2 Design and Programming A Tutorial 2nd Edition


Budi Kurniawan

https://ebookultra.com/download/struts-2-design-and-programming-a-
tutorial-2nd-edition-budi-kurniawan/

ebookultra.com

Introduction to Scientific Programming and Simulation


Using R 1st Edition Owen Jones

https://ebookultra.com/download/introduction-to-scientific-
programming-and-simulation-using-r-1st-edition-owen-jones/

ebookultra.com

The Life and Letters of Charles Darwin Volume 2 Including


an Autobiographical Chapter 1st Edition Charles Darwin

https://ebookultra.com/download/the-life-and-letters-of-charles-
darwin-volume-2-including-an-autobiographical-chapter-1st-edition-
charles-darwin/
ebookultra.com

Programming Wireless Devices with the Java 2 Platform 2nd


Edition Roger Riggs

https://ebookultra.com/download/programming-wireless-devices-with-the-
java-2-platform-2nd-edition-roger-riggs/

ebookultra.com
An Introduction to Programming Using Alice 2 2 2nd
Edition Charles W. Herbert Digital Instant Download
Author(s): Charles W. Herbert
ISBN(s): 9780538478663, 0538478667
Edition: 2
File Details: PDF, 68.37 MB
Year: 2010
Language: english
An Introduction
to Programming
Using Alice 2.2
Second Edition
pi
ii ' H i '

Charles W. Herbert
m to Programming Using A
« COURSE TECHNOLOGY
ond Edition Herbert «• C t N i j A G E Learning"
Leilehua Maly graduated from the University of Hawaii
at Hilo in 2003 with a B.S. in Computer Science. After
graduation, he moved to Seattle to work as a software
engineer at Amazon.com. Leilehua is currently
employed as a software engineer in the Windows
Mobile and Embedded division of Microsoft.
J

You knew you were headed for a career in Computer Science when...
I realized how much fun it was to make a computer do what I want.

What was your favorite class and why?


Compiler theory. It gave me the ability to understand how programming languages
are designed, and how programs are translated from text we can read and write to
the bits a computer can understand. Believe it or not, that process has applications
far beyond just compilers.

What was your last technology-related purchase?


All the shiny pieces I needed to build my new gaming rig.

One piece of advice for first year students:


Persevere. The field can be challenging, but you're in for an exciting ride.

What's the most interesting project you've worked on as a professional?


I was a key player in the design of a system that would change the way
international trade was implemented for a major online retailer.

What has surprised you most about the IT industry?


When I was in college, the general gossip was that it was getting harder to find
good jobs in the computer science field. For me, especally approaching graduation,
this was more than a little worrysome. What I learned almost immediately upon
entering the professional world is that this is anything but true—companies are
constantly looking to hire as many motivated, talented engineers as they can. If
you know your stuff, it won't take long for you to find a great job.

Where do you see yourself in ten years?


Having just as much fun at my job as I am now.

fcreate. Contribute. Lead, www.cengage.com/coursetechnology


345

AN INTRODUCTION
PROGRAMMING
2.2
S E C O N D EDITION

by Charles W. Herbert
; COURSE TECHNOLOGY
t% CENGAGE Learning-

A n Introduction t o Programming © 2011 Course Technology, Cengage Learning


Using Alice 2.2, Second Edition ALL RIGHTS RESERVED. N o part o f this w o r k covered by the copyright
Charles W. Herbert herein may be reproduced, t r a n s m i t t e d , stored or used in any f o r m or by
any means graphic, electronic, or mechanical, including but not limited t o
Executive Editor: Marie Lee p h o t o c o p y i n g , recording, scanning, digitizing, taping, Web d i s t r i b u t i o n ,
Acquisitions Editor: A m y Jollymore i n f o r m a t i o n networks, or i n f o r m a t i o n storage and retrieval systems, except
as p e r m i t t e d under Section 107 or 108 o f the 1976 United States Copyright
Senior Product Manager: Alyssa Pratt
Act, w i t h o u t the prior w r i t t e n permission o f the publisher.
Development Editor: M a r y Pat Shaffer
Content Project Manager: Melissa Panagos
For product information and technology assistance, contact us at
Copyeditor: Harold Johnson Cengage Learning Customer & Sales Support, 1-800-354-9706
Proofreader: Christine Smith For permission t o use material from this text or product, submit all
requests online at cengage.com/permissions
Indexer: Sharon Hilgenberg
Further permissions questions can be emailed to
QA Manuscript Reviewers: Chris Scriver and permissionrequest@cengage.com
Serge Palladino
Print Buyer: Julio Esperas
Library o f Congress Control Number: 2010931093
Art Director: Marissa Falco
ISBN-13: 978-0-538-47866-3
Cover Designer: Marissa Falco
ISBN-10: 0-538-47866-7
Compositor: GEX Publishing Services
Course Technology
20 Channel Center Street
Boston, Massachusetts 02210
USA

Cengage Learning is a leading provider of customized learning solutions


w i t h office locations around the globe, including Singapore, the United
Kingdom, Australia, Mexico, Brazil, and Japan. Locate your local office at:
international.cengage.com/region

Cengage Learning products are represented in Canada by Nelson


Education, Ltd.

For your lifelong learning solutions, visit course.cengage.com

Purchase any of our products at your local college store or at our preferred
online store www.cengagebrain.com

Some of the product names and company names used in this Course Technology, a part of Cengage Learning, reserves the
book have been used for identification purposes only and may right t o revise this publication and make changes f r o m t i m e t o
be trademarks or registered trademarks o f their respective t i m e in its c o n t e n t w i t h o u t notice.
manufacturers and sellers.
The programs in this book are for instructional purposes only.
Any fictional data related t o persons or companies or URLs used
throughout this book is intended for instructional purposes only. They have been tested w i t h care, but are not guaranteed for any
At the time this book was printed, any such data was fictional particular intent beyond educational purposes. The author and
and not belonging t o any real persons or companies. the publisher do not offer any warranties or representations, nor
do they accept any liabilities w i t h respect t o the programs.

Printed in the United States of America


1 2 3 4 5 6 7 14 13 12 11 10
Index 345

While tile, 145, 206 world.salute method, 232, 236


WhiteRabbit class, 45, 48 world.salute who roll instruction, 233
white'Rabbitjump method, 5 0 - 5 2 , 5 4 - 5 7 world.salute who = toySoldierl instruction, 237
wKiteRabbit.jump tile, 5 7 , 1 1 4 world.salute who turn command, 234
whiteRabbit move down instruction, 56 world.squadMarch method, 229
whiteRabbit move tile, 5 1 - 5 2 world.squadSalute method, 2 3 7 - 2 3 8
whiteRabbit move up instruction, 56 World Statistics submenu, 1 0 , 3 1 5
whiteRabbit object, 4 8 - 5 0 , 53, 55 world tile, 13, 52, 7 2 , 1 1 3 , 1 1 9 , 1 3 6 , 2 2 1 , 223, 230, 235
who parameter, 2 3 2 - 2 3 4 World window
who roll right .2 revolutions instruction, 233 ADD OBJECTS button, 7 , 1 4 , 39
who's part named rightArm.forearm turn backward camera, 7
.3 revolutions instruction, 235 player controls, 11
wide shot, 254 recording view, 2 3 - 2 5
Windows, 278, 311 Restart button, 11
Windows Live MovieMaker, 248, 266 view of airport, 199
Windows Media Player, 266
w i n g j l a p method, 39 X
w i n g j l a p times tile, 139 X-axis, 67, 68
wipes, 2 5 9
Xerox PARC (Xerox Palo Alto Research Center), 6 4
wonderland Alice world, 259 X variable, 106
Wonderland revised Alice world, 261
words spoken by character, 1 5 6 - 1 5 8 Y
world.bothSpin method, 72, 73
Y-axis, 67, 68
world.company method, 224
YouTube, 266
world.game method, 2 8 4 - 2 8 5 , 288 Yoyo Games, 276
world-level methods, 52, 72
world.marching Boolean variable, 229 Z
World.my first method method, 1 8 - 1 9 , 5 2 - 5 3 , 73,
Z-axis, 68
1 1 0 - 1 1 2 , 1 1 9 - 1 2 0 , 1 4 4 , 165, 1 7 3 , 1 7 8 , 203, 221 - 2 2 2 ,
Zoom-in and Zoom-out shots, 255
224, 235, 238, 3 0 3 - 3 0 5 , 305
zooming, 81
World of Warcraft, 272
Zork, 272
world.routine instruction tile, 235
Brief Contents
PREFACE ix
F O R E W O R D T O T H E FIRST E D I T I O N xv
CHAPTER ONE

An Introduction to Alice and Object-Oriented Programming 1

CHAPTER T W O

Methods 31

CHAPTER THREE

Events 63

CHAPTER FOUR

Algorithms 97

C H A P T E R FIVE

Boolean Logic in Programming 127

C H A P T E R SIX

Text and Sound 155

CHAPTER SEVEN

Recursive Algorithms 189

C H A P T E R EIGHT

Lists and Arrays in Alice 213

C H A P T E R NINE

Making Animated Movies with Alice 245

CHAPTER TEN

Video Game Programming 271

APPENDIX A

Acquiring and Installing the Alice Software 311

APPENDIX B

The Alice Menus 313

APPENDIX C

Computer Programming Languages 317

GLOSSARY 321

INDEX 327
Table of Contents
PREFACE ix
FOREWORD TO THE FIRST EDITION xv
CHAPTER ONE
A n Introduction t o Alice a n d O b j e c t - O r i e n t e d P r o g r a m m i n g 1
Object-Oriented Programming and Alice 2
Tutorial 1A—Exploring the Alice Interface 4
The Main Work Areas of the Alice Interface 7
Other Elements of the Alice Interface 9
Menus 9
Tutorial 1 B — P l a y i n g an Alice World 10
Tutorial 1 C — C r e a t i n g Your First Alice World 12
Adding Objects to an Alice World 14
Object Classes and Instances in Alice 15
Positioning Objects 17
Adding Some Action 18
Closing and Reloading a Saved World 22
Tutorial 1 D — P r i n t i n g Code from an Alice World 22
Tutorial 1 E — S a v i n g an Alice World as a Movie File 23
Chapter Summary 26
Review Questions 26
Exercises 27
CHAPTER TWO
Methods 31
Top-Down Design and Modular Development 32
The Software Development Cycle 36
Designing Methods 36
Coding Methods in Alice 37
Testing and Debugging Alice Methods 37
Tutorial 2 A — W o r k i n g with Primitive Methods in Alice 39
Running Primitive Methods Directly 41
Using Primitive Camera Methods to Find a Lost Object 43
Tutorial 2 B — C r e a t i n g New Methods in Alice 45
Setting the Scene 46
Designing a Method 49
Coding the J u m p Methods 50
Creating the Main Method 52
Testing (and Debugging) Your Finished Software 53
Tutorial 2 C — M e t h o d s With Parameters 54
Creating a Parameter 55
Using a Parameter 56
Chapter Summary 58
Review Questions 59
Exercises 59
Table of Contents V

CHAPTER THREE
Events 63
Event-Driven Software 64
Three-Dimensional Space 65
Tutorial 3 A — E v e n t s in Alice 70
Exploring Events 70
Creating a Sample World for Event Exploration 71
Alice Event Types 74
The When a Key is Typed Event 76
The While a Key Is Pressed Event 78
The When the Mouse Is Clicked on Anything Event 78
Additional Notes About Mouse Events 79
Tutorial 3 B — B u i l d i n g Camera Controls with Events 80
Open an Existing World 80
The Let the Mouse Orient the Camera Event 82
The Let the Mouse Move the Camera Event 82
The Let the Arrow Keys Move the Camera Event 83
Tutorial 3 C — B u i l d i n g a Flying Machine in Alice 84
Software Specifications 84
Refining Specifications 84
Code the World—Specification 1 , Create a World with a Seaplane 87
Code the World—Specification 2, Animate the Seaplane 89
Code the World—Specification 3, Add Turn Controls 89
Code the World—Specification 4 , Add a Find Control 90
Test the World 90
Debug the World 91
Chapter Summary 92
Review Questions 93
Exercises 94
CHAPTER FOUR
Algorithms 97
Elements of Logical Structure 98
Flowcharts 99
Flowcharting Template 100
Flowchart Symbols 100
Linear Sequences 101
Selection S e q u e n c e s — B r a n c h i n g Routines 103
Binary and Multiple Branching 103
Binary Branching 104
Pseudocode 104
Repetition S e q u e n c e s — L o o p i n g 105
Pretest and Posttest Loops 106
Count-Controlled and Sentinel Loops 108
Parallel Algorithms 110
Tutorial 4 A — B r a n c h i n g in Alice Methods 110
User Functions in Alice 111
Tutorial 4 B — A Simple Count-Controlled Loop 116
Tutorial 4 C — U s i n g the While Instruction 118
VI An Introduction to Programming Using Alice 2.2

Chapter Summary 122


Review Questions 123
Exercises 124
CHAPTER FIVE
B o o l e a n Logic in P r o g r a m m i n g 127
Boolean Logic 128
Comparing Values 129
String Comparisons 130
Boolean Functions 131
Tutorial 5 A — B r a n c h i n g with Random Numbers 134
Tutorial 5 B — T h e Nervous Penguin 137
Tutorial 5 C — A Sentinel Sailing Loop 142
The Sail to Island World 143
The Sail to Any Object World 146
Chapter Summary 150
Review Questions 151
Exercises 153
CHAPTER SIX
Text a n d S o u n d 155
Adding Elements of Language to an Alice World 156
The s a y and t h i n k Methods 156
The print Instruction 159
3D Text in Alice 161
Picture Files as Alice Billboards 162
Sounds in Alice 163
Tutorial 6 A — U s i n g The s a y and t h i n k Methods 164
Tutorial 6 B — T h e print Instruction 171
Tutorial 6C—Three-Dimensional Text 174
Tutorial 6 D — P i c t u r e Files as Alice Billboards 180
Tutorial 6 E — S o u n d in Alice Worlds 183
Chapter Summary 185
Review Questions 186
Exercises 187
CHAPTER SEVEN
Recursive Algorithms 189
What is Recursion? 190
Recursive Algorithms 191
Recursion Compared to Iteration 193
The Cost of Recursion 194
Linear Recursion and Exponential Recursion 195
Infinite Recursion and Conditional Recursion 196
Tutorial 7 A — C r e a t i n g a Recursive Method 197
Setting the Scene 198
Coding the Recursion 200
Tutorial 7 B — C o n v e r t i n g an Existing Iterative Method to Recursion 204
Chapter Summary 208
Review Questions 209
Exercises 210
Table of Contents

CHAPTER EIGHT
Lists a n d A r r a y s in Alice 213
Data Structures in Alice 214
The Need for Different Data Structures 214
Lists in Alice 217
Arrays in Alice 219
Tutorial 8 A — E i g h t Ballerinas 220
Exploring the Ballerina Movement Methods 221
Creating a List of the Ballerinas 222
Creating a Dance Routine for the Ballerinas 224
Tutorial 8 B — M a r c h i n g Toy Soldiers 227
The Toy Soldiers World 227
Creating a Marching Routine 229
Tutorial 8 C — S a l u t i n g Toy Soldiers 232
Creating a Generic Salute Method 232
Making All of the Soldiers Salute 237
Tutorial 8 D — S o r t i n g an Array of Sixteen Ballerinas 238
Chapter Summary 241
Review Questions 242
Exercises 243
CHAPTER NINE
M a k i n g A n i m a t e d M o v i e s with Alice 245
Introduction 246
The Moviemaking Process 247
Tutorial 9 A — R e c o r d i n g a Movie from Alice 248
Preproduction 250
Movie Types 252
Movie Topics 253
Outlining the Plot: Scenes, Shots, and Storyboarding 254
Tutorial 9 B — S t o r y b o a r d i n g 257
Camera Placement And Shot Transitions 258
Tutorial 9 C — S i m u l a t i n g Multiple Cameras 259
Tutorial 9 D — R e c o r d i n g Camera Positions for a Multi-Shot Scene 261
Postproduction 266
Chapter Summary 267
Review Questions 268
Exercises 269
CHAPTER TEN
Video G a m e Programming 271
What Is a Video Game? 272
Video Game Careers 274
Game Development Project Management 274
Game Design 275
Script Writing 275
Graphics Arts 275
Music and Sound Engineering 276
Programming 276
Quality Assurance 277
viii An Introduction to Programming Using Alice 2.2

Video Game Programming Features 278


A User Interface 278
Scorekeeping 279
Graphics 280
Physics Engines 281
Tutorial 1 0 A — W h e r e ' s Alice? 282
Tutorial 1 0 B — D o n ' t Splash the Penguin! 289
Tutorial 1 0 C — V i d e o Game Ballistics 300
Chapter Summary 307
Review Questions 308
Exercises 309
APPENDIX A
Acquiring a n d Installing the Alice S o f t w a r e 311
Acquiring the Alice Software 311
Installing the Alice Software 311
APPENDIX B
T h e Alice M e n u s 313
The File Menu 313
The Edit Menu 314
The Tools Menu 315
The Help Menu 315
APPENDIX C
Computer Programming Languages 317
GLOSSARY 321
INDEX 327
Preface
Few subjects have changed as much in the past few decades as computer science. Yet, even
in computer science, some things, perhaps the most important things, don't change. Our job
as students and teachers in computer science is to develop a firm understanding of the
important things that don't change—the immutable foundations of the discipline—while
developing the ability to handle the things that do change. The second edition of this book
is intended to provide students who are new to the discipline with knowledge of some of
the foundational concepts in computer programming—such as Boolean logic, the structure
of branching and looping routines, and the notion that you should plan something before
you try build it—while exposing them to some of the newest and most popular areas of
computing—virtual worlds, animated moviemaking, and video game development—in a
fun and interesting way.

Three things have been changed in this new edition of the text:

It is based on Alice 2.2, rather than Alice 2.0.


Two new chapters have been added, one on moviemaking and one on
video games.
The language and examples in the chapters from the previous edition have
been revised, taking into account feedback from instructors and students
on what worked and what didn't work, and how they use the book.

Alice 2.2

The second edition of this book is based on Alice 2.2 because this is the best current version
of Alice for learning introductory programming for most students. Some of the features that
did not work well, or at all, in Alice 2.0 now work in Alice 2.2, such as the ability to export
movie files. Alice 3.0 is still not yet ready for prime time, and when it is it may not be the
best vehicle for a general introduction to programming. It is significantly more complicated
and more difficult to use than Alice 2.2. Alice 3.0 will probably be a better vehicle for a
course in which students wish to develop more sophisticated programming skills, or for stu-
dents who wish to dive deeper into things like the nature of events or human computer inter-
action in second-level Java courses. Because it is not as easy to use as Alice 2.0 or Alice 2.2,
Alice 3.0 could be a barrier to getting started with programming for many students.
Therefore, this book, which is intended to introduce students to the nature of computer pro-
gramming, is based on Alice 2.2.

New Chapters

The two new chapters on making animated movies and video game programming aren't
included to displace any of the previous chapters, but rather to extend them. The chapters
should provide students with a good foundation in each area. The animated movie chapter
teaches students about things like camera angles, fades, and transitions so that they can use
An Introduction to Programming Using Alice 2.2

these in programming virtual worlds or in making movies. The video game chapter discusses
careers in the video game industry and exposes students to the kinds of programming needed
for video games.

These chapters aren't intended for courses in filmmaking or game development, but to intro-
duce these areas to students learning programming because these are things that many mod-
ern professional programmers need to learn. Moviemaking and gaming are also areas of
interest to most students, which could spark an interest in computer programming and
related math and physics.

Many years ago, Galileo and others explored the most fundamental concepts in the universe—
optics, heat, mechanics, and so on—as a foundation for understanding and developing the
newest technologies of the day. And so it is with modern computer science. The more we
understand things that don't change, the more we can explore and affect things that do
change. Conversely, the more we wish to know about today's newest and hottest technologies,
the more we find ourselves learning about the immutable foundations of the universe in
which we live. Today's emerging technologies that motivate people to learn include personal
moviemaking and interactive gaming. It may seem like they have been around forever, but
moviemaking and video gaming are relatively new topics that are becoming increasingly
important for computer programmers, are motivating for students, and are just beginning to
appear in most introductory computer programming courses.

R e v i s i o n in E x i s t i n g C h a p t e r s

The chapters that were in the first edition have been revised for this new edition in response
to feedback from instructors and students. More images are included, the language of the text
has been clarified in places, and some of the examples and exercises have been changed. The
fundamental goals and approach of the text remain the same.

O r g a n i z a t i o n o f t h e Text

Each lesson in this text is composed of two parts—lecture and lab. The lecture part of the les-
son includes reading material for the student and lecture material for the teacher that
parallels the reading material. For the most part, the reading material is relatively brief and is
intended to establish a foundation for the lab component. The new chapter on video game
development contains a bit more reading material than most chapters, providing students
with an overview of video game development careers and the kinds of programming used in
video games.

The lab component includes hands-on tutorials in Alice, and sometimes related work intended
to help them explore the concepts of the lesson. The lab component consists of one or more
hands-on step-by-step tutorials, followed by review questions and open-ended exercises the
students should be able to complete on their own, either individually, or in groups, once they
Preface

understand the step-by-step exercises. The exercises contain notes directing the students'
attention to what they should be learning as they carry out the exercise. It is not enough to com-
plete the steps in the exercise, each student should understand what was done, why it was
done, and should be able to repeat the exercise without the directions.

This edition of the book is organized in ten chapters, with goals as follows:

Chapter 1—An Introduction to Alice and Object-Oriented Programming


Goal: The student will develop a basic understanding of the concept of
object-oriented programming and become familiar with the Alice interface.
• Chapter 2 — M e t h o d s
Goal: The student will learn to create methods in Alice that demonstrate
the application of good modular design.
Chapter 3 — E v e n t s
Goal: The student will learn to create events in Alice that allow the user to
manipulate objects in three-dimensional space and the Alice camera show-
ing viewers those objects.
Chapter 4 — A l g o r i t h m s
Goal: The student will develop a basic understanding of the logical struc-
ture of algorithms.
Chapter 5 — B o o l e a n Logic in Programming
Goal: The student will develop a basic understanding of Boolean logic and
its application in computer programming and algorithm development.
i Chapter 6 — T e x t and Sound
Goal: The student will learn to use text, graphic images showing text, and
sound as objects in Alice programs.
• Chapter 7 — R e c u r s i v e Algorithms
Goal: The student will develop a basic understanding of recursion in com-
puter programming, and learn to create and manipulate recursive algo-
rithms in Alice.
• Chapter 8 — L i s t s and Arrays in Alice
Goal: The student will develop an understanding of the concept of a data
structure and learn to implement the simple data structure known as a list
in Alice.
Chapter 9 — M a k i n g Animated Movies with Alice
Goal: The student will develop a basic understanding of moviemaking
concepts, and will be able to produce short animated movies using Alice.
An Introduction to Programming Using Alice 2.2

Chapter 1 0 — V i d e o Game Programming


Goal: The student will develop a basic understanding of careers in video
game development, the nature of video games, and the role of program-
ming in video game development, and will be able to create simple video
games using Alice.

The notion of objects is introduced in the first chapter. Understanding the nature of an object
as a collection of properties and methods that can manipulate those properties is critical in
modern computer programming. The text mentions but does not explore more sophisticated
concepts of object-oriented programming, such as inheritance and polymorphism. In that
sense, like Alice, it is not truly object-oriented, but might better be described as object-based.
I have found that attempts to introduce students to a complete understanding of objects upon
their first exposure to programming is counterproductive. Students can learn more about
inheritance and polymorphism after they have some experience with objects and program-
ming. This approach actually enables students to develop a better grasp of important funda-
mental concepts, like Boolean logic and the nature of algorithms, and to more deeply explore
in a second course how inheritance—with public, private, and protected properties, sub-
classes, super-classes, and so on—really works.

Chapter 3 on event-driven programming precedes the chapters introducing algorithmic struc-


tures and Boolean logic for three reasons: first, because of the increasing importance of events
in modern computer software; second, because students seem to enjoy working with events
more than branching and looping; and third, because Alice handles events in such a simple,
easy-to-use way. In practice, Chapters 4 and 5 could easily be covered before chapter three.

Chapters 7 and 8 present topics that are not covered by everyone in an introductory pro-
gramming course. They are intended to provide students with a first exposure to recursion
and to data structures. Some preliminary work with developmental math and English stu-
dents has shown that the chapters work in making this material accessible to them.

The text can be used for:

An introduction to the concepts of object-oriented programming during the


first several weeks of a semester in which Java or a similar "real" program-
ming language is used for the remainder of the semester. This is the way
Alice is being used in many places, with most teachers reporting that at the
end of the semester they had actually covered more Java material than if
they had not used Alice.
A semester-long course in programming and problem solving for the general
student population. Such a course has been shown to be remarkably suc-
cessful in helping "borderline" students succeed academically. It is espe-
cially helpful for students in developmental mathematics and English.
Preface

A programming component for a general computer literacy or applications


course. The National Research Council and other groups have suggested that
all college graduates should be exposed to computer programming, yet cur-
rently less than ten percent of college students are required to take a course
in programming. Not much can be done with Java or C++ in three weeks, but
Alice and the material in the first few chapters of this book can be used to
provide a basic understanding of objects and algorithms.
A programming course or component of a programming course at the front of
a multimedia development curriculum or a game development curriculum.

Lesson plans, course outlines, and additional instructional materials for all three approaches,
as well as a complete proposal for a course based on Alice, can be found on the Web site for
the text.

Acknowledgements

May people are responsible for the production of this book, and I am grateful to them all.

Mary Pat Shaffer was the Development Editor, who worked most closely with me in creating
the book's second edition. I appreciate her hard work, and thank her for her patience and
guidance in working with me. This is a much better book because of her efforts.

The book's copy editor was Harold Johnson. Copy editors are the unsung heroes of the pub-
lishing world; guardians of language and thought who painstakingly sift through material
with a fresh eye, finding things that others miss. Chris Scriver and Serge Palladino served as
quality assurance testers, checking each of the tutorials and exercises in the manuscript to
make sure that the final text, the student data files, and the solutions for instructors are cor-
rect. Course Technology stands out among publishers in part because of their attention to
such details.

I am grateful to Alyssa Pratt, Senior Product Manager and Amy Jollymore, Acquisitions
Editor for Computer Science & Programming, two key people at Course Technology who
helped make this edition of the book possible. Thanks also to Melissa Panagos, Content
Product Manager, who guided this book through the production process, and to Marissa
Falco, Art Director, who led the efforts to create the new cover and update the interior design
for this edition.

The original manuscript for the second edition of this book was reviewed by:

Carol Buser, Owens Community College, Findlay Area Campus


Linda Cohen, Forsyth Tech
Norma Hall, Manor College
Stanley Leja, Del Mar College
Brian Snyder, Northampton Community College
An Introduction to Programming Using Alice 2.2

I am grateful for their time and the influential insights they offered. Many improvements
were made because of their efforts.

I'd like to thank Walt Johnson, one of my colleagues at Community College of Philadelphia,
who provided the IBM flowchart template shown in chapter 4. Walt is retired now, but for
years I had the opportunity to teach with him and learn much about programming from him.
Early in his career, Walt worked with some now-primitive IBM equipment, like the 1401 and
360 series, and became a master at improvising and inventing new techniques to get a pro-
gramming job done. Many things change rapidly in the world of computing, but one thing that
will never change is the need for people like Walt, filled with intelligence, enthusiasm, and
the ability to work well with computers and with the people who use them.

This book is dedicated to my father, George William Herbert, Jr., who passed away during the
week when the first edition of the book went to press. He was the athletic director for the
Maplewood School District in Colonie, NY for more than 30 years, but spent most of his sum-
mers driving our family around the country to visit as many of America's national parks as
possible. There are many heroes in the world, but few as important as a good father.

R e a d This B e f o r e You Begin

The Alice software can be found at www.Alice.org, the official Alice Web site.

Each chapter of this book has clearly stated objectives, one or more readings related to those
objectives, and several hands-on tutorials. A chapter summary, review questions, and further
exercises are included at the end of each chapter. Note that Appendix A of this text contains
technical information about the Alice software, which is easy to install and use.

Note that the text was quality assurance tested using Alice v. 2.2 on Windows 7 Ultimate.

Student Data Files These are provided on the Course Technology Web site at www.cengage.com/
coursetechnology. The student data files contain all of the Alice worlds, image files, and so on
that are needed within the tutorials.

Solution Files Solutions to the review questions and exercises found in the book are
provided for instructors on the text's Companion Site at www.cengage.com/coursetechnology.
The solutions are password protected. The solution files contain the completed Alice worlds
that are the final product of each tutorial.
Foreword to the First Edition
Note from the author: I asked Randy Pausch, Dennis Cosgrove, and Caitlin Kelleher to tell us
about the development of Alice, the current state of affairs regarding Alice, and where things
seem to be headed in the future. The sections that follow are what they wrote in reply. We've
also included their individual bios at the end of this foreword.

All A b o u t A l i c e

So far there have been three distinct phases in the development of Alice, the Goggles and
Gloves phase, the "rapid prototyping 3D graphics phase," and the Teaching Introductory
Programming phase.

The Goggles and Gloves phase started in the early 1990's at the University of Virginia, where
Randy was on the faculty, heading a 20-person User Interface Group investigating the bound-
ary where people and technology interact. We were trying to make virtual reality more acces-
sible by developing improved interfaces and lower-cost human computer interaction
hardware and software. The paper Virtual Reality on Five Dollars a Day, which was pub-
lished in the April 1991 edition of the ACM SIGCHI's journal Human Factors in Computing
Systems, describes some of our work. It's available online through www.alice.org, where we
provide links to publications related to our work on Alice.

We call that first phase the Goggles and Gloves phase because we really were focusing on the
development of virtual reality systems in which the participant (the term user really doesn't
seem to capture the sense of it; Disney Imagineering uses the term "guest") enters a virtual
world by putting on a VR helmet and gloves. One mantra was "If it doesn't have a glove, it's
not VR." At the time, virtual reality was in its infancy. So, in addition to developing VR inter-
faces, we were working on software systems to test the interfaces. One of our early reseach
projects was SUIT, the Simple User Interface Toolkit, to which Matt Conway and Rob DeLine
contributed heavily. Matt was instrumental in recognizing that vocabulary matters—that the
choice of names for behaviors is critically important in a system for novices. His work was
very influential in shaping the direction of the development work that led to the Alice sys-
tem we have today. His doctoral dissertation, Alice: Easy-to-Learn 3D Scripting for Novices
should be required reading for people interested in how to design systems for novices. It's
available on the Web at www.alice.org.

The language for programming VR systems required one to think in terms of X,Y,Z coordi-
nates, and to use terms like translate, scale, and rotate to describe things happening in a vir-
tual world. On the early Silicon Graphics machines, angles were measured in integers
representing tenths of a degree, so commands like rotate -3600 were common. A person
needed fairly advanced mathematics skills to program graphical objects in a 3D system.
An Introduction to Programming Using Alice 2.2

Engineers and physicists had the keys to get in, but many other intelligent, talented and cre-
ative people, such as artists, and filmmakers, did not. Matt saw that the language of VR was
a part of the problem and that if we could change the language, then VR systems would be
easier to use, and thus more accessible for novices and more powerful for experts at the same
time. In his dissertation he wrote that "the tradeoff between power and simplicity is often a
false one." He led us in discovering that using more everyday terms terms like move, turn,
and resize instead of technically-oriented terms like translate, rotate, and scale could go a
long way toward achieving the powerful simplicity that would become one of the hallmarks
of Alice. Turn left 1 revolution makes sense to a lot more people than rotate X -3600.

The first version of Alice emerged as an easy-to-use scripting system for building virtual
worlds. The system itself was a combination of C and Python code, with which one could
rapidly create virtual worlds by iterating Python scripts. Over the years, the programming
features of Python have been replaced with dragging and dropping code elements.

It's important to note that even early versions of Alice could not have been created without
the efforts of a dedicated team of people. In particular, PhD student Rich Gossweiler, was
responsible for the implementation of the very early versions of Alice, and its co-system
DIVER. Tommy Burnette was also responsible for a great deal of the early Alice software
implementation. A complete listing of people who have contributed to the Alice project over
the years is available at www.alice.org .

At about this time (the mid 1990's) our work was funded by a variety of sources, including
the National Science Foundation (NSF) and the Defense Advanced Research Projects Agency
(DARPA). These are two of the most amazing agencies in the federal government, when it
comes to return on investment of public money. A while back, NSF and DARPA asked for
funding to explore using computers as tools for communication among educators, scientists,
and engineers, and the result is the Internet. We believe that any time they ask for money,
Congress should jump at the chance to spend public funds so wisely. One day one of the peo-
ple from the Department of Defense who was overseeing our project said that we should for-
get about the virtual reality hardware and concentrate on the software we were building. He
argued that our most important contribution was the way in which our software could be
used as a rapid development system for 3D graphics prototyping.

During the summer and fall of 1995, Randy spent a sabbatical at Walt Disney Imagineering's
Virtual Reality Studio working on the "Aladdin" project which was featured at EPCOT
Center and, later, at DisneyQuest. The experience working with the Imagineering team
helped to make it clear that we were moving into a realm of work that would require both
artists and engineers. In the spirit of bringing artists and engineers together, Randy created a
course called "Building Virtual Worlds" in which teams of artists and engineers work together
Foreword to the First Edition xvii

to create interactive virtual worlds. In the Spring of 1997, the research group moved to
Carnegie Mellon University, in order to take advantage of the fairly unique cross-disciplinary
focus at CMU. However, no story of the Alice system would be complete without acknowl-
edging how gracious the University of Virginia was in allowing us to continue work on Alice
seamlessly, by allowing us to transfer our funding and research to another university, and we
are very grateful for their support. We have fond memories of the University of Virginia and
highly recommend it to students looking for a great place to go to school.

Over the next few years we gradually moved into the third phase of our work as we devel-
oped better ways to build virtual worlds. Alice became a workhorse for the "Building Virtual
Worlds" course, which was then being taught at Carnegie Mellon, for several years, finally
realizing our dream of allowing "a 1,000 creative flowers to bloom." However, with respect to
making 3D graphics programming easier, we slowly began to realize that we had the problem
inside-out. Instead of thinking about how to improve programming to make 3D graphics
more accesible, it started to become clear that 3D graphics could make programming more
accesible. A seminal event occured one day when Randy was on a family trip to
DisneyWorld. His ten year old nephew Christopher spent the day working with Alice on a
laptop as they drove. Chris programmed 3D graphics for eight hours straight, never really
having trouble with the 3D part, but constantly asking for help about "where the commas and
semicolons had to go." In Randy's words: "I immediately realized that this was a problem we
could solve." Some work had already been done on the drop and drag interface, but now the
creation of a drag and drop interface for creating Alice programs became a priority.

Wanda Dann and Steve Cooper both became important contributors to the future of Alice at
about this time. Wanda, who teaches Computer Science at Ithaca College, and Steve, who
teaches at St. Joseph's University, have long been interested in how visualization can be used to
teach object-oriented programming concepts. They began to work with us to shape Alice as a
better tool to teach introductory programming. We were all beginning to recognize that Alice
works well for teaching introductory programming for three primary reasons: minimization of
the problems of syntax, the ability to see the results of object-oriented programming in a live
virtual world, and the motivation provided by working in such an exciting environment.
Since 1999 Steve and Wanda's efforts developing educational materials based on Alice, test-
ing Alice in the classroom, and providing feedback to Dennis and company as the software
was refined have been instrumental in shaping the current look and feel of Alice.

In addition to helping students with the technical hurdles, Alice is allowing us to begin
changing the ways in which we introduce students to computer programming. The way we
teach computer programming hasn't changed much in the past 50 years, despite the fact
that the way we use computers has. The first computers that appeared in the middle of the
20 th
century were literally used to help bombs hit their targets. The early high-level pro-
gramming language, FORTRAN, was designed to help scientists and engineers with their
An Introduction to Programming Using Alice 2.2

number crunching. Today, how many high school students are excited about writing code
to generate the first 10 Fibonacci numbers? Using Alice, students learn the basics of pro-
gramming while creating animated stories and games. Wanda Dann has been a strong pro-
ponent for using Alice to introduce programming through storytelling at the college-level,
and Caitlin has been studying using the activity of storytelling in Alice to interest middle-
school girls in learning to program. In addition to being more motivating than assignments
like sorting a list of numbers, creating animated stories helps to make computer program-
ming seem less foreign. Not many people are familiar with the concept of mathematical
algorithms, but everyone is familiar with storytelling. By using Alice to tell story in a vir-
tual world, young people become engaged in linear sequencing, modular development,
and planning before implementation—three of the most important skills for early success
in computer programming.

One highly desirable side effect of using Alice to introduce programming through story-
telling is that more young women are attracted to the discipline. It's no secret that Computer
Science, unlike Law and Medicine, has failed to attract women in significant numbers.
Currently, women constitute less than one-third of all Computer Science majors in the US,
and less than one-fourth of those earning Ph.Ds in Computer Science. According to Caitlin s
research (her dissertation, when completed, will be available at www.alice.org), Alice has the
power to begin to change that; thereby changing the culture of the Computer Science class-
room and workplace.

So where do things stand now? Well, Chuck Herbert's programming textbook is only the second
book to use Alice as a tool to teach programming. The Dann, Cooper and Pausch book was the
first. Course Technology's Alice CourseCard is the first widely available reference material for
Alice 2.0. More material is sure to follow as the number and type of schools using Alice
increases. Last year we knew of approximately 30 colleges and universities using Alice. This
year we are aware of about 60 colleges and universities and at least that many high schools, as
well—and there are probably more folks using Alice that we don't know about.

Currently most people who use Alice seem to be doing so to teach introductory program-
ming, although it is starting to be used in other disciplines. The most widespread educa-
tional model for the use of Alice is to use Alice for the first half of an introductory
programming course, followed by the use of Java or a similar commercial programming
language in the second half of the semester. That model seems to be working remarkably
well in places like Duke University, the University of Mississippi, Haverford College, and
here at Carnegie Mellon.
Foreword to the First Edition xix

Within the past three years other models for the use of Alice have emerged, particularly in
the community colleges, and in courses other than computer programming. Here are just a
few of the efforts we know about:

Bill Taylor is leading a group of faculty members at Camden County College


in New Jersey who are studying the use of Alice in problem solving and
programming courses for students in developmental Mathematics and
English courses. Their preliminary work has shown that Alice is an effec-
tive tool for improving the overall academic performance of developmental
students.
Chuck Herbert is leading a team of 4 0 faculty members at Community
College of Philadelphia exploring the use of Alice for a programming mod-
ule in computer literacy and applications courses. Their preliminary work
shows that the use of Alice in such courses is attracting new students to
computer-related disciplines.
Sharon Wavle at Tompkins Cortland County College in New York is offer-
ing an online programming course using Alice.
For each of the past two Fall semesters, 1,300 freshman engineering stu-
dents at Virginia Tech have used Alice as a tool to explore programming
and problem solving in their introductory engineering course.
ITESM, a 33-campus, 80,000 student high-end University in Mexico has
been using Alice.and reports very similar results to the American experi-
ence, giving us hope that the storytelling approach works in a fairly
culture-independent way.

The most common question people ask us these days is about the future of Alice. Right now,
the 04/05/2005 Version of Alice 2.0 is reasonably stable and reliable, and runs on Windows and
the Macintosh. There are no plans develop it further. Instead, work is beginning on Alice 3.0.
How will Alice 3.0 be different? Well, to start with, one thing about it will be the s a m e —
it will continue to be provided free of charge to the public from Carnegie Mellon University.
The University has been very gracious in supporting us, and we are committed to maintain-
ing Alice as an open source, non-commercial, piece of software. This "purity" is important;
many students have worked hard over the years to contribute to the Alice effort, and we
believe it must continue to be "for the people." All of Randy Pausch's royalties from the
Dann, Cooper and Pausch book are donated by him to Carnegie Mellon, to help support the
software development. We are glad to hear that Chuck Herbert has also pledged a portion of
his royalties from this book to the Alice effort. We had various corporate sponsors over the
years, most notably Intel and Microsoft, and we are pleased to say that Electronic Arts (EA) is
a major sponsor of Alice version 3.0.
xx An Introduction to Programming Using Alice 2.2

We expect that Alice 3.0 will be a pure Java implementation, and that you will be able to dump
the Java code for an Alice 3.0 world and then work with it in Java. That's a big change from
Alice 2.0, which does not create Java code, but works more like an interpreter that directly exe-
cutes Alice methods. This should serve several purposes, including helping to make the transi-
tion form Alice to Java smoother in introductory programming courses.

You can expect the new version of Alice to be more truly object-oriented than the current
version. Alice 2.0 is a good tool to introduce the concept of an object as a collection of prop-
erties and methods, but it does not provide the ability to create true class-level methods, true
inheritance, or the overriding necessary for polymorphism. Alice 3.0 should have some, if
not all, of these features.

Caitlin's work has shown that users, especially young people, can do more and learn more
with objects that have higher order primitive methods, such as walk, sit, and touch instead of
just move, turn, and so on. There will probably be more methods that manipulate objects and
their sub-parts together, and the gallery of available objects will probably be richer that the
current Alice gallery.

The overall look and feel of Alice will also probably be less toy-like. Anyone who has used Alice
for more than a few minutes knows it's not a toy, but it looks like a toy. The new version should
still be easy to use, but people probably won't think "Fisher Price" when they first see it.

The team that started working on virtual reality interfaces years ago at the University of
Virginia had no idea that our work would lead to Alice and that it would become such an
important tool in Computer Science education. As is the case with many NSF funded projects,
the taxpayers have gotten more than their money's worth, but just not in the way one would
have thought reading the original proposals. Such is the path of science and exploration. Now
that we know where we are headed, our goal is to make Alice the vehicle of choice for some-
one's first exposure to computer programming, for everyone—worldwide—from 5 th
grade
through college.

Randy Pausch
Dennis Cosgrove
Caitlin Kelleher
Carnegie Melon University,
December 2005
Foreword to the First Edition

Randy Pausch was a Professor of Computer Science, Human-Computer Interaction, and


Design at Carnegie Mellon University, where he co-founded the university's Entertainment
Technology Center (etc.cmu.edu). He led the research group at CMU responsible for the
development of Alice. This groups' mission is "to explore and develop the mechanisms by
which humans can more effectively and enjoyably interact with technology, and to have fun
while doing s o . " Randy Pausch died as a result of pancreatic cancer on July 25, 2008. He was
4 7 years old and will be missed by many people in the world of computing.

Dennis Cosgrove is a Human Computer Interaction Project Scientist (formerly Senior Research
programmer) at Carnegie Mellon University, where he has spent the last several years as the pri-
mary software architect and implementer for Alice 2.0, 2.2, and 3.0. He was one of the principal
developers of the earlier PC/Windows 95 Alice implementation at the University of Virginia.
In addition to his work on Alice, he has contributed to the development of an eye-tracking sys-
tem that allows quadriplegics to interact with a computer.

Caitlin Kelleher is an assistant professor of Computer Science and Engineering at Washington


University in St. Louis. As a Graduate Research Assistant at Carnegie Mellon University she
developed Story Telling Alice as part of her Ph.D. thesis work, which focused on creating a pro-
gramming system that is attractive to middle school girls by focusing on storytelling. She devel-
oped the online, stencil-based tutorials that are part of the current Alice software.
An Introduction t o Alice a n d
Object-Oriented Programming

After finishing this chapter, you should be able to:


Provide a brief definition of the following terms: algorithm, computer program, object,
property, method, state of an object, object-oriented programming (OOP), computer
programming language, Integrated Development Environment (IDE), function, event,
class, instance, instantiation, and method parameter

Run the Alice software and locate and describe the following components of the Alice
interface: World window, Object tree, Details area, Editor area, Events area, menu bar,
Trash can icon, Clipboard icon, Play button, Undo button, and Redo button

Load and play an existing Alice world

Create a new Alice world by adding objects to a blank world, positioning them, and
using simple methods to animate those objects

Print the code for Alice methods and events

Save an Alice world as a QuickTime movie file (*,mov)


2 Chapter 1 • An Introduction to Alice and Object-Oriented Programming

OBJECT-ORIENTED PROGRAMMING AND ALICE

An algorithm is a step-by-step process. A computer program is a set of instructions telling a


computer how to perform a specific task. As such, every computer program is an algorithm.
Early computers were far less complex than computers today—their memories were smaller
and their programs were much simpler. To help manage the growing complexity of comput-
ers, computer scientists developed the notion of objects and object-oriented programming.
Anything that is manipulated by a computer program is an object. It is possible for modern
computers to manipulate many objects at the same time.

An object can be something in the physical world or just an abstract idea. An airplane, for
example, is a physical object that can be manipulated by an autopilot—a computer that can
fly the plane. To the computer, the airplane is an object.

Most objects that computers manipulate are not physical objects. A bank transaction is an
example of an object that is not physical. There is usually a paper record of a transaction;
however, the transaction itself is simply a concept. It is an object, but not a physical object.

Whether an object exists in the physical world doesn't matter much in terms of what hap-
pens inside a computer. To a computer, an object is simply something that can be repre-
sented by data in the computer's memory and manipulated by computer programs. The data
that represents the object is organized into a set of properties. Each property describes the
object in some way. For example, the weight of an airplane, its location, the direction in
which it is facing, and so on are all properties of the airplane. A computer manipulates an
object by changing some of its properties or some of the properties of parts of the object. For
instance, the autopilot might change the angle of a wing flap, which in turn affects the
entire airplane.

Sometimes the hardware in a computer translates these changes in properties into actions
that affect the physical world—as an airplane's autopilot does—and sometimes the changes
in an object only affect information in the computer's memory and have no direct effect on
the physical world. For example, when a bank deposit is recorded on a computer, the
amount of money in the bank balance property of the bank account object is changed, but
there is no other immediate effect on the physical world.

The programs that manipulate the properties of an object are called the object's methods.
An object is a collection of properties along with the methods that are used to manipulate
those properties. The values stored in the properties of an object at any given time are col-
lectively called the state of an object. This modern approach to computer programming is
known as object-oriented programming, or OOP for short.
Object-Oriented Programming and Alice 3

A computer programming language is an instruction set for programming a computer, along


with the grammar and syntax for using those instructions. Most modern computer program-
ming languages are object-oriented languages, in which programs are organized as sets of
methods that manipulate the properties of objects.

Learning to program a computer is often a difficult task because it requires learning about
programming concepts and the language of programming at the same time. It's also difficult
because people find it hard to visualize all of the changes that are occurring as a computer
program runs. Alice can make it easier to learn to program a computer by helping with both
of these problems.

Alice uses an object-oriented style of programming. The objects in Alice exist in a three-
dimensional virtual world, much like a modern video game. In fact, the virtual world itself
is an object in Alice—it has properties and methods that can be used to manipulate those
properties. Alice is similar to other modern object-oriented programming languages, such as
Java, C++, or Visual Basic. However, as you will see, Alice is constructed so that you don't
need to memorize the grammar and syntax of the language to write computer programs. As
you are learning Alice, you can concentrate on learning about the ideas of computer pro-
gramming, such as the logic of your algorithms, instead of having to worry about the
spelling and grammar of a new language at the same time.

The virtual world of Alice is one that you can see. Like the real world, it has three-dimensional
space (and time), and each object has properties just like physical objects have properties;
these include color, size, position, the direction in which the object is facing, and so on. Alice
has a camera that allows you to see its virtual world on a computer screen, just as you might
view a movie or a video game. This ability to see what happens to objects in your virtual world
makes it easier to learn computer programming with Alice than with almost any other system
of programming. For instance, if you try to program a white rabbit to run around in a circle,
and instead he simply stays in one spot and spins, you can see that happening on the screen.
You can get instant feedback from viewing the way Alice runs the programs you have created.
Not every programming system is so easy to use.

For more information on computer programming languages, see Appendix C of this book.
Chapter 1 • An Introduction to Alice and Object-Oriented Programming

In summary, there are three things about Alice that make it a more effective tool for learning
programming than almost any other system of programming:

Minimal memorization of syntax—Alice is constructed so that you do not


need to learn the grammar and syntax of a strange new language and can
instead focus your attention on the concepts of computer programming.
Visualization—Alice allows you to see the effects of your programs and
any changes you make to them.
Rapid feedback—Alice provides rapid feedback, which you may get at any
time by simply starting your virtual world and watching what happens.

You will also find that Alice is fun and interesting to use, which never hurts when one is
trying to learn something new.

TUTORIAL 1A—EXPLORING THE ALICE INTERFACE


In this tutorial, you will explore the Alice 2.2 interface, and then load and play an Alice
world. Before starting, you should have a computer system with the Alice software properly
installed. Fortunately, installing Alice is easy. The software is available freely from Carnegie
Mellon University via their Web site at www.alice.org. See Appendix A for further instruc-
tions on acquiring, installing, and starting the Alice software.

Anyone attempting this exercise should have experience using a computer. You certainly
don't need to be an expert, but you should have some experience with things like word pro-
cessing and accessing the Internet so that you are familiar with Windows, a mouse, a key-
board, and a printer.

1. Start the Alice software. You will see the Welcome to Alice! dialog box
open in front of the Alice Integrated Development Environment (IDE), as
shown in Figure 1-1. If Alice opens without showing you the Welcome to
Alice! dialog box, click File, and then click New World to open this win-
dow. An Integrated Development Environment (IDE) is a computer pro-
gram that is used to write other computer programs. Most modern
programming languages have IDEs with everything you need to create and
run computer programs. Alice is no exception, but its IDE is simpler than
most. The Alice IDE is often called the Alice interface.

The Show this dialog at start check box appears in the lower-left corner o f the Welcome
H W I * to Alice! dialog box. It should be checked so that the Welcome to Alice! dialog box will
appear when Alice starts.
Tutorial 1 A—Exploring the Alice Menace

FIGURE 1 - 1 : The Alice interface with the Welcome to Alice! dialog box

l<u Ida loot, uup

j lit
ft"*" Alice
H Tutora
il "(Recent Wod
rls T
(empa
ltes "| Examp
e
ls ( O p a n a world

Vcfeli*! m
[ ethods f rations create new variable
myfNSt method

DoUiotdtrr ftjtotjother l*Hu> Loop wti.le Foradmorder Fo. allio.jettier Wad prmt

2. Notice that the Welcome to Alice! dialog box has five tabs: Tutorial, Recent
Worlds, Templates, Examples, and Open a world. You can return to this
dialog box at any time while using Alice by clicking File on the menu bar,
and then clicking New World or Open World. Let's look at each of these
tabs before continuing.
3. Click the Tutorial tab and you will see four Alice tutorials. You won't use
the tutorials now, but you may want to come back to them later as an exer-
cise on your own. When you are ready to use the tutorials, either click the
tutorial you would like to run, or click the large Start the Tutorial button to
follow them in order. They are quite easy to follow.

Dr. Caitlin Kelleher from Washington University in St. Louis created the original version
of these tutorials while she was a graduate student at Carnegie Mellon University.

4 . Click the Recent Worlds tab. You will see thumbnail sketches of the most
recently saved Alice worlds. If no worlds have been saved since the Alice
software was installed on your system, this tab will say No recent worlds.
6 Chapter 1 • An Introduction to Alice and Object-Oriented Programming

5. Click the Templates tab. Alice comes with six blank templates for starting a
new virtual world—dirt, grass, sand, snow, space, and water. Each of the
templates includes a texture for the surface, which is called the ground in
Alice, and a background color for the sky.
6. Click the Examples tab. Several example worlds created by the Alice devel-
opers are provided with the Alice software. We'll return to the Examples
tab later in this tutorial.
7. Click the Open a world tab. This tab is used to access Alice worlds saved
on your computer. Click the Browse button to open the Open dialog box, as
shown in Figure 1-2. This dialog box is very similar to the Open File dialog
boxes seen in other programs, such as Microsoft Windows, with navigation
icons across the top, a list of folders and Alice worlds from the current
directory in the middle, and some controls to view and open files at the
bottom. Notice that the Alice world files end with the extension .a2w. This
extension indicates that the files were created with either version 2.0 or
version 2.2 of the Alice software, the two most recent versions. Alice uses a
generic interface that looks the same when using the Windows, Apple, or
UNIX operating systems. Click the Cancel button to return to the Open a
world tab when you are ready to move on.

FIGURE 1-2: The Open dialog box

Look In: . Alice Wot Ids H 3 5


a ® .
Frank Gutekunst's Worlds navigation icons

w
Jim Watson's Worlds
Recent Ray Sweeney's Worlds folders
Walt Johnson's Worlds
airport.a2w
baseball.a2w
Desktop boat game.a2w Alice worlds
chicken is tasty.a2w
cows.a2w
My haunted house.a2w
Documents tiny dancer.a2w
toy soldiers.a2w

My
Computer controls

File Name: I I Open


My Network
Places a2w Files •w 1 Cancel
Tutorial 1A—Exploring the Alice Interface 7

8. Next, you will look at the Alice interface with an Alice world open. Click
the Examples tab, click the lakeSkater thumbnail, and then click the Open
button to open the lakeSkater Alice world. It will take a few seconds for
Alice to load all of the elements of the world. The name of each element
will briefly appear in a small window in the center of the screen while this
happens. When Alice is finished loading the world, your screen should
resemble Figure 1-3.

FIGURE 1-3: The Alice interface after loading the lakeSkater world

World window

Events area

Object tree

T h e M a i n W o r k A r e a s of t h e Alice Interface

The Alice interface has five main work areas, as shown in Figure 1-3: the World window, the
Object tree, the Details area, the Editor area, and the Events area. There are also several ele-
ments across the top of the interface—a menu bar, three control buttons, a Trash can icon,
and a Clipboard icon. Let's look at each of these before playing the lakeSkater world.

The World Window

The World window contains a view of the lakeSkater virtual world. The set of blue arrows
below the window controls the Alice camera, which provides you with the view in the win-
dow. Next to the arrows is a large green ADD OBJECTS button, which you will use in
Tutorial l C when you create your first Alice world.
8 Chapter 1 • An Introduction to Alice and Object-Oriented Programming

The Object Tree

The Object tree appears to the left of the World window. It shows the objects in the current
Alice world organized as a tree of tiles, with a tile for each object. The plus sign next to an
object shows that it has sub parts, which may be seen by clicking the plus sign. Click the plus
sign to see the parts of the IceSkater object, and then click the minus sign to hide its parts.

T h e Details A r e a

The Details area of the Alice interface is located below the Object tree. It has tabs to show
properties, methods, and functions for the currently selected Alice object. Properties con-
tain information about an object, such as its color and position in the world. Methods are
programs that manipulate an object. A function is a method that returns a value, such as the
distance between two objects.

You may select an object by clicking that object in the World window or by clicking its tile in the
Object tree. Information about the currently selected object will be displayed in the Details area.

Try each of the following:

Click the World tile in the Object tree to see the World's details in the
Details area.
Click the lake tile to see the lake's details in the Details area.
Click the IceSkater tile in the Object tree and then the properties tab in
the Details area to see the IceSkater's properties.
• Click the methods tab to see the IceSkater's methods.
Click the functions tab to see the IceSkater's functions.

T h e Editor A r e a

The largest area of the Alice interface is the Editor area, which appears to the right of the
Details area. Here, you assemble and edit methods by clicking and dragging tiles from other
parts of the interface. The bottom of the Editor area has a row of logic and control tiles that
can be used to put branching, looping, and other logical structures into the algorithms that
will make up an object's methods. Most of the time that you spend working with Alice will
be spent using the Editor area.

The Events Area

The Events area in Alice is above the Editor area. The Events area shows existing events
and is used to create new events. An event consists of a condition, called an event trigger,
and a method, called an event handler. Whenever the event trigger occurs, the event han-
dler is called into action. For example, you might want the sound of a splash to occur if an
ice skater falls through the ice. Falling through the ice would be the event trigger, and the
method that makes the splash sound would be the event handler.
Tutorial 1A—Exploring the Alice Interface

Some events, such as causing a method to run when a key is pressed, provide user interac-
tion for an Alice world. The flight simulator world that can be accessed through the
Examples tab is an interactive world that you might want to take a look at after finishing
this chapter. Events are very important for interactive simulations and gaming and are cov-
ered in detail in Chapter 3.

O t h e r E l e m e n t s o f t h e Alice I n t e r f a c e

In addition to the main work areas that you have just explored, the Alice interface also has
two icons, three buttons, and a menu bar near the top of the screen.

Buttons and Icons

The Trash can icon and the Clipboard icon are used for editing Alice worlds.

You can delete an item in an Alice world, such as an object or instruction tile, by dragging
and dropping it in the Alice Trash can. You can also right-click an object or tile, and select
delete from the menu that appears.

You can copy any object, event, or method in the Editor area by dragging and dropping its
tile onto the Clipboard icon in the top-right corner of the interface, and then dragging it
from the Clipboard icon to a new location. You can also duplicate a method tile by right-
clicking it and selecting make copy from the menu that appears; however, this does not
work with Alice objects or events.
The Undo and Redo buttons near the top-left corner of the interface are also useful for edit-
ing an Alice world. You can undo the last change you made by clicking the Undo button.
The effects of the Undo button can be reversed by using the Redo button. Alice can remem-
ber the last several dozen changes that you made. The Ctrl+Z and Alt+U shortcut keys can
be used for Undo. The Ctrl+Y and Alt+R shortcut keys can be used for Redo. There are no short-
cut keys for cut, copy, and paste.

The Play button is used to play an Alice world.

Menus
The Alice interface has a menu bar at the top of the screen with four menus: File, Edit,
Tools, and Help. The menus in Alice are used much less frequently than in many other
computer programs. For now, you will look at only a few of the items on these menus. All
of the features on the Alice menus are listed in Appendix B.

File M e n u The Alice File menu has commands for opening and saving Alice worlds, and
for exiting Alice. It also has several other items that you will explore later, including options
for exporting an Alice world as a Web page or as a video, and exporting code from an Alice
world for printing. You will use these options in later tutorials throughout this book.
10 Chapter 1 • An Introduction to Alice and Object-Oriented Programming

Edit M e n u Currently the only option on the Alice Edit menu is Preferences, which is
used to change settings for the Alice software. Appendix B of this book lists and describes
these settings. The most important thing to know for now is that the Alice Edit menu is not
used to edit Alice methods in the same way that an Edit menu might be used in other soft-
ware. Instead, Alice emphasizes the use of a drag-and-drop interface, which uses the editing
icons and buttons described throughout this book.

T o o l s M e n u The Alice Tools menu contains three options: Text Output, Error Console,
and World Statistics. The Text Output option allows you to see system messages generated
as you play Alice worlds, and the Error Console can be used to look at detailed Alice error
messages. Both of these are rather sophisticated, and are not very useful for novice program-
mers. The World Statistics option allows you to see statistics, such as the number of objects
in a world, the time the world has been open, and many other useful items. Only some of
the information here will be meaningful to you until you learn more about Alice and com-
puter graphics.

H e l p M e n u The Help menu does not contain an option to look up the features of Alice as
you might expect. By not providing a way to look up features, the developers of Alice were
hoping to encourage people to learn about Alice by experimenting with it.

The Help menu does have three options: Tutorials, Example Worlds, and About Alice.
Example Worlds and Tutorials will both take you back to the Welcome to Alice! dialog box.
The About Alice option provides general information about Alice and the Alice Web site,
www.alice.org.

Mil From time to time you may encounter errors while using the Alice software. The Alice
error message box contains a button to copy the error message to the clipboard. You can then
paste the message into programs such as Word or Notepad, although they are often too sophis-
ticated for novice programers to read. You may submit bugs and suggestions about Alice
through the Alice Web site. The Alice team wants to hear from the users of Alice.

TUTORIAL 1B—PLAYING AN ALICE W O R L D

In this tutorial, you will experiment with playing an Alice world. Alice worlds fit into one
of two different categories—some Alice worlds are interactive in the way a video game is;
others are simply run and viewed like a movie. In either case, experienced Alice users refer
to "playing" an Alice world the way most software developers talk about "running" a com-
puter program.

The Alice world you will play in this tutorial is the lakeSkater world discussed in Tutorial 1 A.
It is not an interactive world; rather, it is more like watching a movie of an ice-skater's
Tutorial 1B—Playing an Alice World

performance. If you have just finished Tutorial 1A and still have the lakeSkater world open,
then continue with the steps that follow. If not, you will need to run the Alice software and
open the lakeSkater world before starting this tutorial.

1. There are three buttons near the top of the Alice interface, labeled Play,
Undo, and Redo. Undo and Redo are used for editing, as described in
Tutorial 1A. The Play button is used to play the current Alice world. When
this button is clicked, the world will play in a larger version of the World
window, with player controls at the top of the window, as shown in
Figure 1-4. Click the Play button now and watch the show unfold. Let the
world play through to the end at least once before proceeding.

FIGURE 1-4: The World window with the lakeSkaterworld running

2. Notice that the new window has a speed slider control and five buttons
across the top of the window in which the Alice world plays. The buttons
are labeled Pause, Play, Restart, Stop, and Take Picture.
3 . The Restart button is used to begin playing the current world again from the
beginning. The Pause and Play buttons work like the pause and play buttons
on a DVD player. Click the Restart button now to restart the lakeSkater
world, and then experiment with the Pause and Play buttons.
4. The speed slider is used to change the speed of the world while it is play-
ing. Restart the world, and experiment with the speed slider control.
12 Chapter 1 • An Introduction to Alice and Object-Oriented Programming

5. The Take Picture button captures an image of the currently playing world
and saves it in a data file. Restart the world and click the Take Picture but-
ton to take a picture of the world. An Image captured and stored dialog box
will appear, showing you the full path name of the file that was saved. The
stored image file can be viewed and used as any other computer image file
can be. By default, the images are saved as JPEG files to the desktop.
Appendix B has more information on changing the settings for Alice's
screen capture feature. Click OK to close the dialog box.
6. The Stop button stops the world that is currently playing and returns you
to the standard Alice interface. Once the Stop button is pressed, you will
need to click the standard interface's Play button to replay the world. Try
this now. After you have finished experimenting, click the Stop button one
last time to return to the standard Alice interface.

Alice is a graphics-intensive program that can use a lot of a computer's memory, so you
should exit the Alice program when it is not in use. Now that you are finished with this
tutorial, you should exit the Alice program.

1. Click File on the menu bar, and then click Exit.


2. If you have made any changes to the current world since it was last
changed, a Save World? dialog box will appear, asking you if you want to
save the world first. If this happens when you attempt to exit Alice after
viewing the lakeSkater world, click No so that you do not change the saved
example world.

While you are viewing or editing an Alice world, a dialog box will appear every 15 min-
utes, warning you that you have not saved your Alice world. If this happens while you are
playing an Alice world, such as in Tutorial 1B, then it's probably safe to ignore the warn-
ing. If it happens while you are creating or editing your own Alice world, then you should
save your world.

TUTORIAL 1C—CREATING YOUR FIRST ALICE WORLD

In this tutorial, you will create, play, and save a new Alice world. You should finish
Tutorials 1A and I B before starting this tutorial. You will create an Alice world in which a
bunny will move from the right side of the screen to the center, turn to face the camera, and
then say "Hello, World!" This is an Alice equivalent of the Hello, World! program that stu-
dents traditionally write as their first program in a new programming language.

This tutorial begins with the Alice software closed. If you have an Alice world open, then
exit Alice before continuing.
Tutorial 1C—Creating Your First Alice World 13

1. Start the Alice software.


2. In the Welcome to Alice! dialog box, click the Templates tab. If the
Welcome to Alice! dialog box does not open automatically, click File on the
menu bar, and then click New World. You should now see the Templates
tab of the Welcome to Alice! dialog box, as shown in Figure 1-5.

FIGURE 1-5: The Templates tab with six templates for new Alice worlds

i Show this dialog at start

3. Thumbnail sketches for the six new world templates are now available—
dirt, grass, sand, snow, space, and water. The templates appear to be very
simple, but looks can be deceiving. There is actually a great deal of com-
puter programming behind a new Alice world, with a camera, ambient
light, and other elements already in place. Click the grass thumbnail, and then
click the Open button.

A new Alice world based on the grass template is now open, and you can see the standard
Alice interface that you used earlier in the chapter. Notice that the Object tree in the upper-left
part of the interface contains the four tiles that appear in every new Alice world: world,
camera, light, and ground, as shown in Figure 1-6. You can see from the way the tree is
organized that the other objects are subobjects of the world object.

FIGURE 1-6: The Object tree after starting a new world

world
iff camera
C n light
ground
14 Chapter 1 • An Introduction to Alice and Object-Oriented Programming

The new world also has the default event—When t h e world s t a r t s , do world.my first
method—in the Events area, and a blank default method—world.my f i r s t method—in the
Editor area.

A d d i n g O b j e c t s t o a n Alice W o r l d

The next several steps will introduce you to the Alice object galleries and the process of
adding objects to an Alice world. Many people get carried away with creating big worlds
with many objects when they first start to use Alice. In this tutorial, you will start with a
very small Alice world with a minimum number of objects. Objects are added to an Alice
world in Scene Editor mode.

1. Click the large green ADD OBJECTS button in the bottom-right corner of
the World window to enter Alice's Scene Editor mode, which is used to
add objects and position them in an Alice world.
2. Note that the Alice interface now looks different, as shown in Figure 1-7.
The Object tree and the Details area are still visible on the left, but there is
a new area on the right side of the screen. This new area is called the
Scene Editor.
Tutorial 1C—,
tin Crea
9 Your First Alice

Hot has new controls, a larger Worl


1 h e Events area and the Editor
There are two Alice o*«* a LoCti WW [ , ^ ^1 CO

Web
nection
Gallery maintained
to use the Web Gallery.)
Scene Editor mode, as shown
by Carnegie

in Figure
Mellon
The Local
1-7.
VmveVSlty.
Gallery is the (N>U
visible at
The galleries are organized
IW
the bottom Ot
as a tree of folders
SCTWU

containing related ob)ects. You can navigate the tree of galleries by clicking a gallery folder
to enter that gallery, or by using the gallery navigation bar, which is just above the galleries.
You will explore the galleries a bit before preparing to add objects to your new world.
1. Click the folder icon on the gallery navigation bar to move up one level in
the tree of galleries, so that you can see the top level in the tree, as shown
in Figure 1-8. Two icons are visible: one for the Local Gallery and one for
the Web Gallery.

FIGURE 1-8: The top level in the tree of object galleries

Home

2. Click the Local Gallery icon to go back to the Local Gallery. Scroll left and
right through the Local Gallery using the scroll bar below the gallery fold-
ers, and you will see some of the many categories of objects available in Alice.
3. Find and click the Animals folder icon to open the folder. Scroll left and
right through this gallery to see some of the animal objects available in Alice.

O b j e c t C l a s s e s a n d I n s t a n c e s in Alice

Each of the tiles in the Animals folder represents a class of objects. A class is a group of
objects with the same properties and the same methods. Objects in the same class are virtu-
ally identical to each other, except that the values stored in some of their properties may be
different. For example, you could have an Alice world with two Penguin objects. They
16 Chapter 1 • An Introduction to Alice and Object-Oriented Programming

would both have the same methods and the same properties, but the values of some of those
properties, such as location or color, might be different.

Each copy of an object from a particular class is called an instance of the object. As you use
Alice, you will notice that the object class tiles in the object galleries have the word class in
their title and each begins with a capital letter, such as Class Bunny or Class Chicken, but
once an instance of an object is placed in a particular Alice world, its name begins with a
lowercase letter. Of course, it is possible to rename objects, so this distinction is not always
maintained.

The act of adding an instance of an object class to an Alice world is called instantiation.
The same terminology—classes, instances, and instantiation—is used in most object-
oriented programming languages.

You are going to add an instance of an object from the Animals folder in the Local Gallery
to your new Alice world. You are going to instantiate a Bunny class object.

1. Click the Class Bunny icon. A window with information about Bunny class
objects, like the one in Figure 1-9, should appear.

FIGURE 1-9: The Bunny class information window

* Bunny X

2. Click the Add instance to world button to put a bunny into the world. This is
sometimes called dropping an object into the world. You should see a bunny
appear in the center of the World window.
3. You can also add an object to an Alice world by clicking an object class tile
and dragging it into place in the World window. Try this now: drag and
drop a chicken tile into your Alice world. This approach lets you place the
new object wherever you would like on the ground in the World window;
however, it does not show you the object's information window first.
4. You should now have an Alice world with two objects—a bunny and a
chicken. Notice that tiles for the new objects have also been added to the
Object tree. You really don't need the chicken for the rest of this exercise.
Tutorial 1C—Creating Your First Alice World 15

The Scene Editor has new controls, a larger World window, and object galleries on the bot-
tom. The Scene Editor replaces the Events area and the Editor area when you are in Scene
Editor mode.

There are two Alice object galleries: a Local Gallery provided with the Alice software, and a
Web Gallery maintained by Carnegie Mellon University. (You need an active Internet con-
nection to use the Web Gallery.) The Local Gallery is visible at the bottom of the screen in
Scene Editor mode, as shown in Figure 1-7. The galleries are organized as a tree of folders
containing related objects. You can navigate the tree of galleries by clicking a gallery folder
to enter that gallery, or by using the gallery navigation bar, which is just above the galleries.
You will explore the galleries a bit before preparing to add objects to your new world.

1. Click the folder icon on the gallery navigation bar to move up one level in
the tree of galleries, so that you can see the top level in the tree, as shown
in Figure 1-8. Two icons are visible: one for the Local Gallery and one for
the Web Gallery.

FIGURE 1-8: The top level in the tree of object galleries

Home

2. Click the Local Gallery icon to go back to the Local Gallery. Scroll left and
right through the Local Gallery using the scroll bar below the gallery fold-
ers, and you will see some of the many categories of objects available in Alice.
3. Find and click the Animals folder icon to open the folder. Scroll left and
right through this gallery to see some of the animal objects available in Alice.

O b j e c t C l a s s e s a n d I n s t a n c e s in Alice

Each of the tiles in the Animals folder represents a class of objects. A class is a group of
objects with the same properties and the same methods. Objects in the same class are virtu-
ally identical to each other, except that the values stored in some of their properties may be
different. For example, you could have an Alice world with two Penguin objects. They
16 Chapter 1 • An Introduction to Alice and Object-Oriented Programming

would both have the same methods and the same properties, but the values of some of those
properties, such as location or color, might be different.

Each copy of an object from a particular class is called an instance of the object. As you use
Alice, you will notice that the object class tiles in the object galleries have the word class in
their title and each begins with a capital letter, such as Class Bunny or Class Chicken, but
once an instance of an object is placed in a particular Alice world, its name begins with a
lowercase letter. Of course, it is possible to rename objects, so this distinction is not always
maintained.

The act of adding an instance of an object class to an Alice world is called instantiation.
The same terminology—classes, instances, and instantiation—is used in most object-
oriented programming languages.

You are going to add an instance of an object from the Animals folder in the Local Gallery
to your new Alice world. You are going to instantiate a Bunny class object.

1. Click the Class Bunny icon. A window with information about Bunny class
objects, like the one in Figure 1-9, should appear.

FIGURE 1-9: The Bunny class information window

ftiBunny X

4
M M

u..,rl.-l.-.HV
ii4i«ed by-
pans:

a o
2. Click the Add instance to world button to put a bunny into the world. This is
sometimes called dropping an object into the world. You should see a bunny
appear in the center of the World window.
3 . You can also add an object to an Alice world by clicking an object class tile
and dragging it into place in the World window. Try this now: drag and
drop a chicken tile into your Alice world. This approach lets you place the
new object wherever you would like on the ground in the World window;
however, it does not show you the object's information window first.
4. You should now have an Alice world with two objects—a bunny and a
chicken. Notice that tiles for the new objects have also been added to the
Object tree. You really don't need the chicken for the rest of this exercise.
Tutorial 1C—Creating Your First Alice World

To delete the chicken, right-click the object or the object's tile in the Object
tree and select delete from the menu that appears.

Positioning Objects

The layout tools to the right of the World window in Scene Editor mode can be used to
manipulate objects. This area contains the seven standard tools listed in Table 1-1.

TABLE 1 - 1 : The seven Scene Editor layout tools

Button Name Function

n Pointer tool Selects an object and moves the object parallel to the ground

H Vertical tool Moves an object up or down

m Turn tool Turns an object along its X-Y plane parallel to the ground

Rotate tool Rotates an object forward or backward (Z-axis rotate)

Ml Tumble tool Freely turns and rotates an object in any direction

Resize tool Changes the size of an object

Duplicate tool Creates a new instance of the same object

1. The Pointer tool is already selected, so experiment a bit by using the


pointer to click the bunny and move it around the screen. Notice that you
can move the bunny on the ground with the pointer, but you cannot use the
pointer to turn the bunny, rotate it, or move it up and down.
2 . Click the Rotate tool and try turning the bunny a few times. You may be
tempted to use the other tools, but please wait—for now they'll only con-
fuse things. You can come back and experiment with them after you've fin-
ished this chapter.
3. Before exiting Scene Editor mode, you need to properly position the bunny
in its starting position for the new Alice world you are creating. Remember,
in this world, the bunny will move from the right side of the screen to the
center, turn to face the camera, and then say "Hello, World!" Position the
bunny using the pointer and then the rotate tool, so that it is near the right
side of the window, facing toward the viewer's left, as shown in Figure 1-10.
Discovering Diverse Content Through
Random Scribd Documents
Edgar gave the fortune-teller the sovereign, and asked her to direct
them to the quay. She cautiously opened the door, and peered out
into the darkness, listening attentively. She beckoned them to step
out, and then pointed in the direction in which they should go.
They walked for some distance, and then reached the part of the
town where the cafés were still open, and men and women were
drinking coffee, seated round tables under the verandas and trees.
They sat down at one of the tables and rested, refreshing
themselves with some excellent coffee.
‘We must hurry back to the ship,’ said Edgar. ‘Your party may have
returned, and if so your mother will be very anxious.’
She was eager to go, and they rose from the table. As they walked
away a tall Egyptian followed them. It was one of the men Edgar
had knocked down. They were not out of danger yet.
A long avenue led down to the quay, where the boats were generally
waiting to sail or row passengers back to the ship.
The Egyptian followed them, keeping within the shadow of the trees,
his bare feet making no sound.
Muriel Wylde was still weak from the effect of the shock she had
received, and Edgar had to support her. He seemed nothing loath to
do so, and his companion felt a sense of pleasurable security with
his strong arm round her waist.
On reaching the quay Edgar called out to a boatman, who came
slowly towards them in his tiny craft.
He explained that he wanted to be taken to the Cuzco, and the
boatman agreed.
Edgar handed his companion down into the boat, and as she
stepped on to the seat she looked up and gave a cry of alarm.
Behind Edgar stood the tall Egyptian, who had crept stealthily up,
and was about to stab Edgar in the back. At her cry Edgar looked
round, and, seeing no other way of escape, he sprang into the
water. The Egyptian sprang after him, and grasped Edgar by the
arm. A terrible struggle then took place, and in the water the
Egyptian proved the more powerful.
The man in the boat made no movement until Muriel Wylde seized a
round pole, and tried to hit Edgar’s assailant on the head. The
boatman then took the part of his countryman, and attempted to
seize the pole and wrench it out of Muriel’s hands. The girl, however,
was now thoroughly roused. Edgar had rescued her, and she must
do the same for him, for he was in deadly peril. The Egyptian
dragged Edgar down and got his head under the water, with the
evident intention of drowning him.
A struggle commenced in the boat, but by a lucky stroke Muriel
managed to hit the boatman in the chest, and he fell overboard. The
Egyptian was not far from the boat, and Muriel, raising the pole,
brought it down heavily on his head, causing him to loose his hold of
Edgar.
Half suffocated, Edgar came to the surface, and struck out feebly for
the boat.
Muriel leaned over the side and grasped him by the arm. Pulling with
all her strength, she managed to give him sufficient assistance to
help him to scramble into the boat.
The two Egyptians in the water were on either side of the boat, and
were trying to upset it, and Muriel kept them from clambering in by
hitting at them with the pole.
Edgar was well-nigh exhausted, but he managed to set the sail, and,
as the breeze was blowing from the shore, the boat soon made
headway and left the Egyptians behind. Finding pursuit hopeless,
they swam ashore, and stood there gesticulating furiously.
Muriel, turning round to look at Edgar, saw he was unconscious. She
was accustomed to sailing-boats, and, having placed her jacket
under Edgar’s head, she steered with one hand and guided the sail
with the other. The boat sped along in the direction of the Cuzco,
whose lights were seen shining in the distance.
Muriel Wylde sat watching Edgar, and when she thought over their
night’s adventures, she was thankful they had escaped with life.
Edgar was a handsome young fellow, and Muriel Wylde felt her heart
beat fast as she looked at him. They had been good friends on
board during the voyage, and Edgar’s mates had chaffed him about
‘pretty Miss Wylde.’ Her mother had noticed her daughter’s partiality
for Edgar’s society, and did not discourage it, as she had taken a
fancy to the young fellow.
Before they reached the steamer, Muriel Wylde left the stern of the
boat for a moment to attend to Edgar. As she bent over him, he
opened his eyes and looked into her face, which was very near to his
own. Their eyes met, and they suddenly felt that something had
been revealed to each of them.
Edgar took Muriel Wylde’s hands, and drew her towards him. She did
not resist, and when he kissed her she was not surprised or startled.
It seemed a fitting climax to the dangers they had passed through.
So lost were they in each other, although neither spoke, they did not
notice they were close to the Cuzco. A loud ‘Ahoy!’ from the deck
roused them, and in a few minutes they were alongside the steamer,
and friendly hands were assisting them up the gangway.
CHAPTER XXIV.
HOME AGAIN.

Their adventures at Ismailia formed the subject of conversation for


several days between Edgar and Muriel Wylde. With her mother’s
consent, Muriel accepted Edgar’s offer of marriage, and when the
engagement became known on board they were regarded with
romantic interest by the passengers. The remainder of the voyage
proved uneventful. Muriel Wylde and her mother left the steamer at
Naples, and proceeded overland to London, but Edgar remained on
board with the team.
On arriving at Tilbury, the eleven received a hearty welcome from a
large number of influential cricketers and lovers of the game. To
Edgar, all this was as nothing to the joy he felt at meeting his father
and Doris again.
Elm Lodge looked much the same as when he went away, and the
old home was so peaceful that Edgar began to wonder how he had
ever made up his mind to leave it. He had much to relate to his
father and sister, and, needless to say, Will Brown entertained Doris
in a manner agreeable to that young lady.
The wreck of the Distant Shore was described again, and Robert
Foster noticed with pride how modestly Edgar spoke of the part he
took in saving Eva.
‘Poor Manton!’ said Robert Foster. ‘I am sorry he was drowned, for a
better seaman could not be found. I should like to meet Wal Jessop,
and we must try and have little Eva over here, for we cannot spare
you again, Edgar, now we have got you at home.’
‘It would be splendid if Wal could be induced to bring Eva and his
wife home,’ said Edgar. ‘I must write and ask him. You have to meet
Ben Brody, who came over with us, and I am sure you will be
amused at him. He is a character, and a rough-and-ready customer,
but a genuine good fellow.’
When Edgar spoke of his engagement to Muriel Wylde, his father
was pleased he had found a girl after his own heart, for his son’s
happiness always held a foremost place with him.
‘And what about the Australian eleven?’ said Robert Foster. ‘Are they
a strong team? It is rather too bad of you to play against the old
country. It places me in an awkward position. Of course, I am
patriotic enough to wish to see England victorious, and yet I shall be
highly delighted to see you pile up a big score.’
‘I shall do my best,’ said Edgar; ‘and every member of the team will
try hard to win the matches. I think we stand an excellent chance,
and you will have to put your best eleven in the field to beat us in
the test matches.’
‘Your men generally play well, and with constant practice they know
each other’s play thoroughly, but we have some splendid cricketers
now, and they will take a lot of beating,’ said his father.
‘All the more credit to us, then, if we win,’ said Edgar.
The members of an Australian eleven have plenty of hard work to go
through when in England, and Edgar could not remain idle at home.
He went to Mitcham to practise on the famous common, and his
father accompanied him to see how the men shaped. To two or
three of the older members of the team, who had been in England
before, Robert Foster was well known, and his appearance with
Edgar was hailed with delight.
William Murch, the captain of the Australians, shook hands heartily
with Robert Foster, and said with a smile:
‘We have had you against us on many occasions, but I think we can
cry quits now we have your son on our side.’
‘How does Edgar shape?’ asked Robert Foster.
‘I consider him one of our best bats, and expect great things of him.
He has a happy knack of making a big score when it is most wanted.
He is a smart fielder and a good change bowler. In fact, I cannot pay
him a higher compliment than to say he is as good a man as his
father,’ said Murch.
Edgar was now at the nets, and making the balls fly about merrily.
‘He does not seem very stiff after the voyage,’ said Robert Foster.
‘His wrist play is good, but his style could be improved a bit. I must
give him a wrinkle or two.’
‘That will be going over to the enemy’s camp,’ said Murch, with a
laugh; ‘but we shall be glad of such a valuable coach.’
‘By Jove! so it will,’ said Robert Foster. ‘But I cannot resist the
temptation, all the same. We cricketers, I am glad to say, are always
ready to help each other, and I have had many a good wrinkle given
me by Australians.’
‘Ah! it is a game that stands ahead of all other games,’ said Murch
enthusiastically. ‘It is a genuine sport, and a manly sport. It not only
gives pleasure to the players, but to thousands of people in all parts
of the world. Lovers of cricket, no matter where you go, are always
willing to help each other.’
‘You are right,’ said Robert Foster. ‘Cricket will never take a back seat
to any other game.’
‘Look out!’ said Murch, as he dodged a ball hit by Edgar. ‘Your son is
evidently bent upon letting us know he is at the nets.’
When he had finished his turn with the bat Edgar joined his father
and Murch.
‘How do you think I shape?’ said Edgar.
‘Very well,’ replied his father, ‘but your style is rather faulty. I think I
can give you a hint as to what I mean when we reach home.’
‘Now then, Will, it’s your turn,’ said Edgar, and Will Murch went to
the nets with his bat under his arm.
‘You have seen him play before?’ said Edgar.
‘Many times,’ said his father. ‘He is a splendid bat, and I should think
he will make a good captain. Is he popular with the team?’
‘Very,’ said Edgar. ‘I believe every one of us thinks he is the best man
that could have been selected.’
‘That is the proper feeling to start with,’ said Robert Foster. ‘If you
have no confidence in your captain, defeat is almost certain.’
When Robert Foster had seen the Australians at practice on several
occasions, he came to the conclusion it was the strongest team that
had yet come to England.
‘The test matches will be a treat,’ he said. ‘If honours are divided in
the first two matches, what tremendous excitement there will be
over the final!’
‘Which I hope we shall win,’ said Edgar.
Doris Foster was quite as interested as her father in the probable
result of the tour. Although Will Brown had not returned from
Australia with enough wealth to warrant him in setting up an
establishment of his own, Doris thought she would not be risking
much in accepting him as her lover. With Robert Foster’s sanction
they became engaged, and the family circle at Elm Lodge increased.
Ben Brody came to Elm Lodge, and soon made himself at home.
Robert Foster discovered that men of Brody’s stamp are to be
trusted, and although he might have been out of place amidst the
sham and humbug of a society drawing-room, Ben Brody was in his
element at Elm Lodge.
His quaint remarks caused roars of laughter, and he drew some
amusing pictures of station life in which Edgar and Will Brown were
conspicuous figures.
‘I’ll tell you what it is,’ he said to Edgar one day as they sat on the
lawn enjoying the fragrant weed, ‘this beats Yanda hollow. What a
trump your dad is! Talk about colonial hospitality, it is a mere trifle to
the way in which I have been treated here. I have lived on the fat of
the land, while those poor beggars at Yanda have been stifling their
ill-feelings with the usual mutton. Then there’s your sister—but she
ought to have a whole vocabulary to herself and not be mixed up
with such matters. Will Brown’s a lucky fellow, and so for the matter
of that are you. Girls like Miss Muriel Wylde are not found every day.
I wonder if you will ever return to Australia.’
‘That remains to be seen,’ said Edgar. ‘After the tour will be time
enough to think about that.’
The opening match of the tour was played at Sheffield Park against
Lord Sheffield’s eleven. Ever ready to assist in promoting honest
manly games, H.R.H. the Prince of Wales honoured them with his
presence. Will Murch was introduced to his Royal Highness, and was
naturally much elated. The match resulted in a win for the
Australians, but Edgar did not ‘come off’ on this occasion.
As the weeks rolled by and the tour progressed, it was easy to see
the Australian eleven was a fine team. So far they had only been
twice beaten—once by an M.C.C. eleven, and in the first match
against England.
Their second struggle with the cracks of the home team had resulted
in a win for the Australians. Edgar played well in these matches, but
had done nothing particularly wonderful. Against several of the
county elevens he had made good scores. He astonished W. G. at
Gloucester by the way he knocked the champion’s bowling about,
and the hero of a hundred fights warmly congratulated him on his
performance.
‘I always thought W. G. was a jealous man,’ said Edgar.
‘Not a bit of it,’ said Robert Foster. ‘He’s one of the first to recognise
merit in a cricketer. I’ll tell you what he is jealous about.’
‘And that is?’ asked Edgar.
‘The honour of the game, and the honour of his side when he
captains a team,’ said Robert Foster.
The final test match was to be played at Lord’s, and the greatest
interest was manifested in the result. Throughout England
enthusiastic cricketers waxed eloquent over the forthcoming
struggle. In Australia every item of news was eagerly read and
discussed. It might safely be said that millions of people anxiously
awaited the result of this great match. The picking of the England
eleven was a difficult task, but at last it was done, and Robert Foster
could not find a fault with the team.
‘They ought to beat you, Edgar,’ he said. ‘It is the best team that
could have been selected. Grace has had a large finger in that pie,
and no fault can be found with it. I cannot pick out a weak spot.’
‘They have not won yet,’ said Edgar; ‘and all our men are in splendid
trim. Murch is sanguine, and he’s not given to over-estimate our
chances. Lord’s has been our unlucky ground, but that is no reason
why we should not prove successful.’
‘What a sight it will be!’ said Robert Foster. ‘I hope you will pile up a
big score.’
‘So do I,’ replied Edgar. ‘This is my chance, and I shall do my best.’
The great match was to commence on Monday, and on the Sunday
quite a party of cricketers assembled at Elm Lodge. Will Murch,
Bannman, Black, Royle of the Australians, and two of the English
team enjoyed Robert Foster’s hospitality and listened to the yarns
spun by Ben Brody.
Muriel Wylde and her mother were in London for the match, and
came to spend the day at Elm Lodge. Muriel and Doris were great
friends, and found much to talk about. It was an eventful Sunday,
this day before the great match, which formed almost the sole topic
of conversation. Many were the surmises as to who would make the
big scores, and which bowler would secure the best average.
‘We count upon you this time,’ said Murch to Edgar. ‘It is your turn to
knock up a big score against England.’
‘I mean to try,’ said Edgar, ‘and I feel very fit.’
‘Muriel will be terribly disappointed if you make less than a hundred,’
said Doris.
‘That is rather a large order,’ laughed Edgar, ‘but I must do my best
to execute it.’
Late hours were not kept that night. Robert Foster packed them off
in good time.
‘You shall have a night of it when the match is over,’ he said to Will
Murch. ‘Win or lose, you must come here to celebrate the event.
Remember I am equally interested in both sides.’
As Edgar bade Muriel good-night, she said:
‘I am quite anxious about you, Edgar. I feel sure you will succeed. I
shall be terribly excited during the first over, but when you are firmly
set and making a score, it will be glorious.’
CHAPTER XXV.
THE SCENE AT LORD’S.

An enormous crowd assembled on the famous cricket-ground at


Lord’s to witness the final battle between England and Australia. The
record attendance was registered for the opening day of a match,
and it was with difficulty that the crowd could be kept within
bounds. It reminded old race-goers of a Derby Day to see so many
vehicles driving in the direction of the ground. Although the sky was
dull and threatening, this did not damp the ardour of the spectators.
The members’ pavilion was thronged, and also the reserved stands
and enclosure. A dense mass of people filled every available
standing and sitting place in the cheaper portion of the ground. No
sooner were the doors opened than a rush commenced for the best
seats, which were secured by those who had been patiently waiting
from an early hour in the morning.
Outside the high walls it was more like a fair than anything else.
Itinerant vendors of a variety of eatables did a good trade, and
evaded the attentions of the police with remarkable skill. No sooner
did the man in blue move a coster on than he ‘bobbed up serenely’
in a different place. Portraits of the cricketers were hawked about,
though the celebrities depicted would have had some difficulty in
recognising their own faces. The excitement over the match was
tremendous. The bus-drivers discussed the chances of success with
the passengers nearest to them, and many of the cabmen wore the
English colours on their whips. Morning editions of the evening
papers met with a ready sale, and every scrap of news anent the
great match was pounced upon with avidity.
Before noon a few drops of rain fell, and with the gathering clouds
the faces of the people became sombre, and their looks gloomy. A
heavy shower would make a good deal of difference, and none knew
it better than the members of the teams.
Robert Foster stood inside the pavilion, with his son and Will Murch,
anxiously scanning the clouds for a sign of a break. They had not
long to wait. The blue sky became visible, and the sun chased the
dulness away and shed its brilliant rays on the scene.
And what a sight it was as they looked from the pavilion over the
ground! A dense mass of people lined the enclosure, and even
pressed over the boundary line in some parts of the ground. To the
left of the pavilion the enclosure was gay with the costumes of the
ladies, and they seemed as eager for the game to commence as any
of the male sex.
Doris Foster accompanied Muriel Wylde and her mother, and they
were escorted by Will Brown and Ben Brody, who felt slightly
uncomfortable in a hard hat and a pair of gloves—not to mention a
new suit, made by a fashionable tailor. They occupied seats in the
first enclosure, and had an excellent view of the ground.
The mere mention of Lord’s conjures up wonderful feats in the
cricket field, and recalls memories of men who played on its green
sward. A glance round the pavilion shows the members have not
been unmindful of their doughty champions of the game. It gives
the history of cricket, its rise and progress, in a pictorial form, to
look at the various prints, paintings, and engravings hanging on the
walls. The ‘tall hat’ period is well represented, and young cricketers
may well be forgiven for smiling at the costumes of the men who
made the game what it is. The smile, however, was not at the men—
there was nothing but praise for them. Old stagers waxed eloquent
over the doings of the cricketers of their younger days. They vowed
there were as good men then as now, although they had to confess
the game had improved—and consequently the players also.
A gray-headed veteran came up to Robert Foster and said:
‘We had big crowds in our day, but nothing like this,’ and he waved
his hand in a comprehensive sweep round the circle of faces.
Edgar was introduced to the veteran, who said:
‘I remember the first time I saw your father play. He was about your
age then, and he was a bat. I’ll never forget it. It was on this very
ground—Surrey against Middlesex. He won the match, my boy. I’d
sooner you were for us than against us to-day, if you can play as
well as your father did then.’
‘I recollect that match,’ said Robert; ‘but you give me too much
credit when you say I won it for the team.’
‘Not a bit of it,’ replied the veteran. ‘Ask any man who saw it, and I’ll
guarantee he tells the same story. Is it not recorded in the annals of
cricket?’
‘We’ve lost the toss,’ said Edgar. ‘The usual luck at Lord’s.’
‘I expect they will bat,’ said Robert Foster.
‘I doubt it,’ said Edgar. ‘The ground is a bit tricky and in favour of the
bowlers. Grace has gone to have a good look at the wicket. He
knows there are no chances to be thrown away.’
The tall figure of the English captain, with his black, bushy beard,
stood out boldly against the background of people. It was in the
days when Grace was at his best, and Dr. E. M. was another of the
valiant brothers who took the field; Shaw and Morley, the famous
Notts bowlers, were in their prime, and Daft had not yet retired from
the field—when such grand men as A. P. Lucas, A. G. Steel, A.
Lyttelton and Lord Harris were seen at nearly every big match. It
was an anxious moment for everyone as Grace consulted with two of
his team as to whether they should bat.
At last the decision came. The Englishmen were to bat, and a mighty
cheer went up from the crowd.
‘The pitch is all right, or Grace would not have gone in,’ said Robert
Foster.
‘Perhaps he thinks it will wear all right for their innings, and leave us
with the ground cut up,’ said Murch.
People settled down in their places, and made themselves as
comfortable as possible. As the Australians filed on the ground,
headed by Murch, cheer after cheer was given them—for the
‘Kangaroo boys’ had become very popular.
The commencement of a great match is always fraught with intense
excitement. How will the game go? Will there be a stand for the first
wicket?
The brothers Grace, W. G. and E. M., came out to face the bowling,
and again the cheers broke out from all parts of the ground. Two
good men and good bats were going to open the game for the
honour of Old England against the attack of her young country’s
sons.
The English captain went through the preliminaries usual with him.
He calmly surveyed the field, noting with keen eyes how each man
was placed. He took his block, and then patted the ground in a
fatherly way with his bat, as though requesting the pitch to behave
well to him. Then he put his bat under his arm and leisurely fastened
his glove. Having put himself to rights, he was ready for the attack.
The battle had commenced, and it soon became lively. Both men
were in form, and the Australians had plenty of leather-hunting.
Boundary hits did not come quite so quickly as might have been
expected, as the ball seemed to fall rather dead, and did not roll far.
When an adjournment for luncheon was made, both Graces were
still in, and the crowd was jubilant.
Murch was not at all depressed. He never gave in, or had the
faintest intention of doing so.
‘After luncheon will do it,’ he said. ‘There will be a separation then.’
He was right, for in the first over E. M. Grace had his stumps upset.
It was, however, uphill work fighting against such a powerful batting
team. Man after man came in and piled up a score, and the captain
was not got rid of until he had placed one hundred and fifty-two to
his credit. He had played a grand innings, and fully maintained his
great reputation.
The Englishmen were not disposed of until they had piled up the
large score of four hundred and two.
‘What do you think of it now?’ asked Robert Foster of Edgar.
‘It is a big score, but we may equal it,’ he replied.
‘I admire your pluck, but I hardly think you will do that,’ was the
remark of a friend of Mr. Foster’s.
They did not do it. The Australians made an unfortunate start, for
Murch, their great bat and popular captain, was caught before he
had scored.
Edgar made a fair show, and put on thirty runs before he was
bowled; but none of the team made a good stand, and the innings
closed, for a hundred and fifty runs—two hundred and fifty-two
behind their opponents. This was a terribly black outlook for the
Australians, and everyone was disappointed at their display.
Muriel Wylde felt vexed, and she knew Edgar would be much cut up
about it. He came to see her, and tried to put the best face he could
on the matter.
‘We must avoid a one innings defeat, anyhow,’ he said; ‘I cannot
make it out at all. It is sheer bad luck, for the wicket was good. I
think when Murch got out for a duck it made our fellows feel a bit
nervous.’
‘You played well enough,’ said Brody.
‘That you did,’ said Will Brown; ‘but I’m afraid you are in for an awful
dressing.’
‘No telling what may happen in cricket,’ said Edgar. ‘I have seen an
even worse match than this pulled out of the fire.’
‘Then you have not lost hope?’ said Muriel.
‘By no means,’ said Edgar. ‘I have a presentiment we shall make a
big score, and prove what we really can do.’
Robert Foster was proud of the display of the home eleven, but he
could not help feeling a pang of regret that the Australians had not
made a better show.
Will Murch was determined to have his revenge for the catch that
disposed of him, and said he felt like making a big score. He got his
men together, and talked the matter over.
‘I’ll go in first again,’ he said, ‘with Bannman, and we must make a
stand somehow. If we can make a big score the other side may be
got out without getting the requisite runs, or they may not have time
to get them, and we shall make a draw of it.’
Edgar Foster was to go in at the fall of the first wicket, and Murch
was very anxious every man should do his level best.
‘They will be very down in the mouth about it at home,’ he said. ‘We
can all imagine how they felt when they saw the poor stand we
made; we’ll try and change the tune for them. Remember, lads, that
every run tells. Run carefully, but run well, and then it is surprising
how a few singles tot up and swell the total. Bat carefully until you
are set, and when you feel safe don’t spare them. They have given
us some leather-hunting, let us return the compliment.’
The cheery words of their captain put heart into the team, and it
was with considerable confidence they saw Murch and Bannman
walk to the wickets to commence the second innings.
Edgar went over to his father to watch the start, and his heart beat
fast as he saw Murch prepare to take the first over.
‘This is better, much better,’ said Robert Foster, as Murch hit a couple
of fours in his first over. ‘We can afford to be generous, and wish you
all to do well this innings.’
Bannman played a cautious game, and left the bulk of the run-
getting to his captain. After half an hour’s play there was a change
of bowling. Will Murch treated the new-comer with scant ceremony.
To Edgar’s great delight the Australian captain hit the bowling all
over the field. His powerful drives and clean cuts elicited well
deserved applause, which was freely bestowed.
‘If you go on at this rate,’ said Robert Foster, ‘it will put a very
different complexion on the game. Your men always did play a good
uphill fight.’
‘And will do so to-day,’ said Edgar. ‘By Jove! that was a narrow
shave.’
Bannman made a miss-hit, and the ball went near to the fielder at
point, but he just failed to hold it, although he touched it.
When the second day’s play ended, Murch and Bannman were not
out, and the score stood at one hundred and thirty, of which number
Will Murch had made eighty-four.
CHAPTER XXVI.
AN UPHILL GAME.

The brilliant stand made by the Australian captain and Bannman


caused intense excitement, and the attendance on the final day of
the match was enormous. Hundreds of people who anticipated a
tame finish, and a one-sided affair, changed their opinions upon
reading the score in the morning papers. Contrary to expectation,
the third day’s play promised to be the most interesting of all.
When Murch and Bannman commenced again, every stroke was
followed with interest. Runs came freely, and Bannman was not
disposed of until he had made seventy. Then Edgar Foster joined his
captain, and the reception he received on going to the wicket proved
his father’s prowess in the field was not forgotten. Foster, in days
gone by, was a name to conjure by, and people remembered Robert
Foster’s feats with the bat.
Muriel Wylde felt anxious, and whispered to Doris Foster:
‘I do hope Edgar will make a score.’
‘He will try to do so, because he knows it will give you pleasure,’ said
Doris.
Murch spoke to Edgar when he went in to bat, and gave him a hint
or two as to the bowling. Edgar played the last ball of the over, and
then Murch scored a couple in the next over.
The bowling was splendid. Both Shaw and Morley were doing their
level best. Edgar found Alf Shaw could deceive a batsman, and put
in a swift ball when least expected. He scored a single off the last
ball, and then faced Morley. Edgar was partial to swift bowling, as
Morley soon discovered, and the over proved productive.
‘I’m getting well set,’ thought Edgar. ‘I believe I’m in for a good
score.’
The runs came freely, and it was not until he had made a hundred
and sixty runs that Murch was caught.
He had done splendidly, and his return to the pavilion was a triumph.
Royle joined Edgar and played steadily.
Grace took the ball and faced Edgar. The English captain knew Edgar
was a free hitter, and placed his men far out. Then he tried to tempt
him to send a catch. Edgar narrowly escaped being caught at the
second ball of the over, and this made him careful. The last ball,
however, was one he could not resist hitting. He drove it straight as
a dart, and it landed over the boundary. It was a tremendous hit,
and caused an outburst of cheering.
The next exciting moment came when E. M. Grace made a
magnificent catch at long-on from a very high hit by Royle. He
caught the ball with one hand, having had to run for it, and, much to
Royle’s surprise, held it.
Donnell came next, and then there was some big hitting. Both
batsmen knocked the bowling about terribly. When Edgar had scored
fifty there was a hearty cheer, and he appeared likely to make as big
a score as his captain. The Australians were playing a splendid uphill
game, and keeping up their reputation as ‘men who never know
when they are beaten.’
At the fall of the seventh wicket the two hundred and fifty-two runs
had been wiped off, and they were over fifty to the good.
The game now became most exciting, as the Englishmen knew if
they did not quickly dispose of the Australians the game would end
in a draw. Each man worked hard, and the fielding and bowling was
splendid.
Still Edgar Foster kept on increasing his score, and passed his
century, to the great delight of his father and his friends.
Connor was now in, and his hits were marvellous. The giant—he was
about six feet four—lifted the balls all over the ground, and safely
out of the reach of the fielders.
When the last wicket fell Edgar Foster was a hundred and fifty, not
out, and the score was five hundred and two runs, or two hundred
and fifty ahead of the Englishmen.
Such a grand uphill game it was generally acknowledged had never
been played before. Edgar Foster was overwhelmed with
congratulations, and Muriel Wylde showed her delight on her face.
‘It was splendid, Edgar,’ she said. ‘I believe you would have made
two hundred or more.’
‘I felt like it,’ said Edgar. ‘I knew you were watching me, and that put
me on my mettle.’
It seemed well nigh a hopeless task for the Englishmen to get two
hundred and fifty runs in the short time at their disposal. However,
they lost no time in making a start to try to do so.
Strange to say, they did not bat in anything like the form shown in
their first innings. Three wickets fell for under fifty runs, W. G. Grace
being unluckily run out.
The Australians fielded with wonderful skill. Hardly a ball got past
them, and many boundary hits were saved.
Seven wickets fell for a hundred runs, and now it was the turn of the
Australians to endeavour to get their opponents out before the call
of time.
The Englishmen had reckoned with certainty upon a draw, but they
now had to fight hard to avert defeat, and even a draw would not be
in their favour.
‘It is a most extraordinary game,’ said Robert Foster. ‘The glorious
uncertainty of cricket again. You never can tell how it will go until a
match is over, no matter how favourable it may look for a particular
side.’
He had joined the ladies, and they were all watching the game with
interest, taking keen note of every good stroke and every brilliant
piece of fielding.
Will Brown looked at his watch.
‘They have only half-an-hour left,’ he said. ‘I should not wonder if
they were got out in that time.’
The thousands of spectators also wondered how the game would
end.
Ten minutes before time Morley joined Shaw at the wickets. They
were not good bats—anything but that, and the crowd knew it.
Morley hit out recklessly and made a couple of fours, and Shaw
played steadily. The Australians did all in their power to separate
them, but, as luck would have it, they failed to do so. The game
ended in a draw, which practically amounted to a victory for the
Australians, as the English eleven required over seventy runs to win.
The result of this match was the subject of conversation for some
days, and the grand struggle made by the Australians was
commented upon on all sides.
At Elm Lodge the event was duly celebrated, and, as Robert Foster
promised, the party made a night of it.
When the tour of the Australians was finished they left for home, but
Edgar Foster did not return with them. At his father’s request he
remained at home.
‘What will Eva think when she finds that I have not returned?’ said
Edgar. ‘I promised her I would go back.’
‘We must try and get her over here,’ said his father. ‘I shall feel
lonely when you and Doris have left me, and Eva will be nice
company for me.’
‘She is a dear little thing,’ said Edgar, ‘and you will love her as much
as though she were your own child.’
‘Do you think every soul on board the Distant Shore, with the
exception of Eva and yourself, was drowned?’ said Robert Foster.
‘There can hardly be any doubt about it,’ said Edgar. ‘Why do you
ask?’
‘Because I have received a rather mysterious letter,’ said Robert
Foster; ‘it bears the Sydney postmark, and contains news that may
interest you. I will show it you.’
Robert Foster unlocked his desk, and put his hand in one of the
pigeon-holes. He looked through the letters, but could not find the
one for which he searched.
‘Strange,’ he said, ‘I am sure I put it there.’
‘You may have dropped it, or torn it up by mistake,’ said Edgar.
‘Perhaps you remember the contents?’
‘The bulk of them,’ said his father. ‘The letter stated that the writer
had been on a cruise to the South Sea Islands, where he met a man
who had been saved from a wreck. He believes, from hints the man,
who was very reticent, let fall, that he was saved from the wreck of
the Distant Shore. When he returned to Sydney he met with Wal
Jessop, who was much interested in what he was told about this
man. Wal Jessop described Captain Manton, and my correspondent
says he firmly believes from this description it is Captain Manton who
was saved and is now in the South Seas. He did not tell Wal Jessop
this, because the man seemed to have a great desire to be left
alone, and had no wish to let people know he had been saved from
the wreck of the Distant Shore. It is a most extraordinary story, and
I wish I had the letter. I must have torn it up by mistake. It was
careless of me to do so.’
Edgar was amazed at what his father said, and replied:
‘I can hardly credit this story. How any man could live if washed out
to sea on such a night I do not know. If it is Captain Manton, surely
he would have made some sign before this. It cannot possibly be
Eva’s father, for I saw him standing on the deck as the ship struck,
and from the look on his face, and the way he waved farewell to me,
I knew he meant to go down with her.’
‘He may have been washed out to sea, and found a spar or
something to support him. I have a peculiar feeling that this man
who was saved from the wreck is Manton. I have had strange
dreams about him since I received the letter, and I am not a
dreamer as a rule, or a superstitious man. I knew Manton well; he
was a proud man, and very sensitive. If he be the man so strangely
saved, I think it is precisely what he would do—to hide himself away
in some lonely spot, in order to make people think him dead.’
‘But surely he would come forward and tell the story of the wreck,’
said Edgar. ‘No blame attaches to him; he did his utmost to save the
ship, and went down with her when he found he could not do so.
Then there is Eva. He would want to see his child again; surely he
would hear that she had been saved.’
‘He may not have heard. In such a lonely spot one hears very little
news from the outer world.’
‘Do you really place any faith in your mysterious correspondent’s
letter?’
‘I do, Edgar, and for this reason: I feel no man would have written
such a letter had he not been convinced of the truth of its contents.’
‘But why should he write to you?’ asked Edgar. ‘Wal Jessop probably
told him how you saved Eva from the wreck, and it would occur to
him that you might wish to know what he thought he had
discovered. He no doubt wrote to me, thinking I would tell you if I
thought it well to do so,’ said Robert Foster.
‘It may be as you surmise,’ said Edgar. ‘I shall never be easy in my
mind until I have seen the man who wrote the letter, and heard all
he has to tell.’
‘That would mean another trip to Australia,’ said his father with a
smile. ‘What would Muriel say to that?’
‘I do not think she would object to my going, for we are not to be
married, as you know, until she is twenty-one. Her mother will not
consent to part with her before that time. In any case I should not
have the journey for nothing, because I could bring Eva back with
me.’
‘So you could,’ said Robert Foster. ‘We should be put down as a
couple of foolish fellows if anyone knew what you went to Sydney
for.’
‘I shall tell no one, with the exception of Muriel,’ said Edgar. ‘She will
not think it foolish.’
‘I ought to tell you more,’ said Robert Foster. ‘There was a sketch in
the letter, and it bore a strange resemblance to Manton. I cannot
make out where the letter has got to.’
‘Was it a sketch made on the spot, or drawn from memory?’
‘Drawn in Sydney, I believe the writer said.’
‘Then it may have been drawn from Wal Jessop’s description,’ said
Edgar.
‘Possibly, but I hardly think so. It seemed to me to be a sketch just
as the man who drew it remembered to have seen him. I did not tell
you of this before, because I thought it might upset you during the
tour.’
‘I should have thought a good deal about it, no doubt,’ said Edgar;
‘and perhaps it was as well you did not tell me.’
Edgar pondered over what his father told him, and the more he
thought over it, the more impossible it seemed to him that anyone,
least of all Captain Manton, should have been saved from the wreck
of the Distant Shore.
The spirit of adventure, however, was still strong within him, and this
letter his father had received would serve as an excuse, if a poor
one, to revisit Australia. He communicated his intention to Muriel,
and when she heard the reason for his setting out again she did not
consider it so improbable as Edgar himself did.
So it was arranged that Edgar should again voyage to the Colonies,
and Ben Brody was glad of a comrade to return with him. Will
Brown, having obtained a situation in a large shipping office, decided
to remain in England, and Doris Foster was consoled by the thought
that if Edgar left again, she would still have a companion of her own
age to whom she was much attached.
CHAPTER XXVII.
THE CAPTAIN OR HIS GHOST.

In due course Edgar Foster arrived in Sydney again. He thought it


better to take Wal Jessop into his confidence, and related to him the
real reason of his return to Australia.
Wal Jessop remembered the circumstances, and said he did not
think Edgar would easily find the man.
‘He spoke of sailing for America,’ said Wal; ‘and as I have seen
nothing of him for some time, I think he must have gone away.’
‘I mean to have a cruise in the South Seas, at any rate,’ said Edgar.
‘I have never been there, and it will be interesting. I am sure to hear
something about this man from the natives and traders.’
Wal Jessop thought for a few moments, and then said:
‘I have a schooner that would suit your purpose, and I should not
mind making a voyage with you. It would be better than going
alone, and I have been in the South Seas several times.’
‘That would be splendid!’ said Edgar, overjoyed at the prospect of
having Wal Jessop with him.
Wal Jessop communicated his intention of accompanying Edgar to
his wife, and although she did not care for him to leave her again to
go on a cruise, she raised no objections when she heard what object
they had in view.
‘How strange it will be if you find Captain Manton there!’ she said.
‘Even if such a thing happened I am afraid he would not return with
you.’
‘We shall persuade him to do so,’ said Wal, ‘if we find him; but that is
more than we hope for. Still, more extraordinary things than this
have happened over shipwrecks, and truth is often stranger than
fiction.’
Wal Jessop’s schooner did not take much fitting out for the voyage,
for both he and Edgar were used to roughing it. A couple of good
men were engaged to go with them, upon whom Wal Jessop knew
he could rely.
They set sail early one morning, and were soon outside the heads,
going along at a fair rate of speed in their small craft.
‘She sails well,’ said Edgar.
‘Many a craft twice her size does not skim over the sea so fast,’ said
Wal.
Edgar thoroughly enjoyed being on board the schooner. It was vastly
different from the life on an ocean liner. They had on board a stock
of goods to trade with the natives, and hoped to make the trip
profitable. The wind and weather being in their favour, they sailed
merrily along, and there was every prospect of their making a fast
trip.
Wal Jessop suggested going to Fiji first of all.
‘It’s a jolly place,’ he said, ‘and will not be out of our way, and we are
not tied for time.’
‘It is a good thing your wife cannot hear you,’ said Edgar, laughing. ‘I
fancy I heard you say we should return as quickly as possible.’
‘So we shall,’ said Wal; ‘but we made no stipulation as to the course
we should take.’
They made sail for Levuka, the former capital of Fiji, Suva being the
present capital. Levuka is situated on a narrow strip of beach, from
which the backbone of Ovalau rises precipitately to a height of 2,500
feet, and falls in a similar manner on the other side.
Levuka, Edgar found, consisted of one main street about a mile in
length, which runs along the beach from old Government House to
the native village at the other end. The ground ascends rapidly on
leaving the beach, and the hills around are dotted with pretty villas.
The stores and hotels face the water, and here Edgar and Wal took
in a fresh stock of provisions for the schooner.
After leaving Levuka, they sailed along the coast and saw a number
of small native towns dotted about at varying intervals, usually
among a little grove of cocoa-nuts or bananas.
They landed near one of these native villages and obtained a supply
of yams and sweet potatoes, also bananas in any quantity. The
village was surrounded by filth and garbage of all sorts, and among
this highly-scented mess a number of scraggy pigs, thin hens, and
young children were rummaging. The stagnant water lying about
attracted swarms of mosquitoes and flies.
Edgar entered one of the houses and was almost choked with the
smoke, and was glad to get a breath of fresh air. The earthen floor
of the house he could just discern was covered with dry grass over
which were spread a few mats. The men seemed a lazy lot of
fellows, passing the bulk of their time in smoking. They went inland
for several miles, but found the country hilly and uninteresting.
They saw numerous inland villages nestling in the valley or perched
on the top of a hill. After leaving Fiji they sailed for the New
Hebrides, rather an inhospitable country, so Edgar understood. Wal
Jessop had, however, been to Tana before, and meant to steer for
that place.
‘What sort of a place is Tana?’ asked Edgar as they sat idly in the
schooner with the blue sky shining brilliantly overhead, and the blue
water of the ocean all around them.
‘It is a volcanic island,’ said Wal. ‘There are several of them in the
group, and on many of them the natives speak different languages.
It is a circular island, with a high mountain in the centre which we
ought to see before long. The mountain is constantly in eruption,
and answers the purpose of a lighthouse. It is covered with
vegetation almost to the top.’
‘I hope we shall not have an earthquake during our stay on the
island. I have experienced one already, during our exploration in the
cave of Enooma, and I should not care for the experience to be
repeated,’ said Edgar.
Next morning the island of Tana came in sight, and Edgar marvelled
at its beauty as seen from the schooner. In the centre of the island
rose the high mountain, as Wal Jessop had described it, and smoke
and fire were issuing from the top. They were not long in reaching a
landing-place, and on the beach they saw a number of native
canoes, some about fifteen feet long, and others from twenty-five to
nearly fifty feet in length.
When the natives saw the schooner let go her anchor, two canoes
put off and were quickly paddled alongside. The natives in them
were rather under the middle stature and the colour of old copper.
Their faces were painted a reddish colour, and looked oily and sticky.
Their hair was frizzy and of a light-brown colour, and was twisted
and curled into numerous tails, which were thrown back from the
forehead and hung down the back. It looked for all the world like a
wig made of whipcord, Edgar thought.
‘These fellows are Tanese,’ said Wal. ‘I must try and make them
understand a few questions.’
He spoke to one of the natives, who was taller than his companions,
and asked him to come on board the schooner. Without the least
hesitation the man did so. As he stood on deck, Edgar saw that he
was a well-made, athletic young fellow. The septum of his nose was
pierced, and through it was inserted a reed horizontally, but not so
as to project beyond either nostril. He had tortoiseshell earrings in
his ears, about half a dozen hanging down on each side, and the
weight had enlarged the aperture until a child’s hand might have
been passed through. He was not tattooed, but on his breast a rude
device of a fish had been either cut or burnt in, and on the upper
part of his arms was a leaf done in a similar way. He had no clothes
on except a matting bag round the loins. He had armlets on, and
also three large whale’s teeth on three strings hanging horizontally
on his breast.
‘He’s a chief,’ said Wal. ‘I can tell that by those teeth he has on his
breast.’
‘He is a formidable-looking savage,’ said Edgar. ‘I should not care to
have a hit with that club he carries.’
Wal Jessop motioned the chief to sit down, which he did, and was
presented with a necklace of bright-coloured beads which delighted
him immensely.
The other natives in the canoes were looking at the schooner with
eager eyes, evidently with the expectation of getting a few presents.
The chief, whose name was Meri, spoke a few words of English, and
as Wal Jessop knew a little of the Tana language, they managed to
understand each other.
Although Edgar could not make out what they were talking about,
he knew Wal Jessop was questioning him as to the white men who
visited the island.
‘Psan Aremama,’ said Meri.
‘There is a white man on the island,’ said Wal to Edgar. ‘We must go
ashore and try and meet him. Meri knows where he is to be found,
but he avoids the coast.’
‘Strange a white man should be here,’ said Edgar. ‘It may be the very
man we are in search of.’
‘If it turns out to be Manton, it will be stranger still,’ said Wal.
Meri agreed to take them ashore in his canoe, and to make room for
them ordered two of the men to jump out and swim back to land.
Wal Jessop asked if there were sharks about, for he saw the natives
were frightened, but dared not disobey the chief.
Meri laughed, showing his even teeth, and hinted that it would be
good sport to see a shark or two hunt the natives.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like