Processing an introduction to programming 1st Edition Nyhoff
Processing an introduction to programming 1st Edition Nyhoff
Processing an introduction to programming 1st Edition Nyhoff
Processing an introduction to programming 1st Edition Nyhoff
1. Processing an introduction to programming 1st
Edition Nyhoff download
https://textbookfull.com/product/processing-an-introduction-to-
programming-1st-edition-nyhoff/
Download full version ebook from https://textbookfull.com
2. We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!
An Introduction to C GUI Programming Simon Long
https://textbookfull.com/product/an-introduction-to-c-gui-
programming-simon-long/
Bite Size Python An Introduction to Python Programming
1st Edition April Speight
https://textbookfull.com/product/bite-size-python-an-
introduction-to-python-programming-1st-edition-april-speight/
An Introduction to Signal Processing for Non-Engineers
1st Edition Afshin Samani (Author)
https://textbookfull.com/product/an-introduction-to-signal-
processing-for-non-engineers-1st-edition-afshin-samani-author/
Python Programming An Introduction to Computer Science
John M. Zelle
https://textbookfull.com/product/python-programming-an-
introduction-to-computer-science-john-m-zelle/
3. Effective C An introduction to professional C
programming 1st Edition Robert C. Seacord
https://textbookfull.com/product/effective-c-an-introduction-to-
professional-c-programming-1st-edition-robert-c-seacord/
How to Design Programs An Introduction to Programming
and Computing Matthias Felleisen
https://textbookfull.com/product/how-to-design-programs-an-
introduction-to-programming-and-computing-matthias-felleisen/
Second Language Processing an Introduction First
Edition Jiang
https://textbookfull.com/product/second-language-processing-an-
introduction-first-edition-jiang/
Introduction to Programming in Java An
Interdisciplinary Approach 2nd Edition Robert Sedgewick
https://textbookfull.com/product/introduction-to-programming-in-
java-an-interdisciplinary-approach-2nd-edition-robert-sedgewick/
Python Programming An Introduction to Computer Science
3rd Edition John M. Zelle
https://textbookfull.com/product/python-programming-an-
introduction-to-computer-science-3rd-edition-john-m-zelle/
11. vii
Contents
Foreword, xv
Preface: Why We Wrote This Book and For Whom It Is Written, xvii
Acknowledgments, xxi
Introduction: Welcome to Computer Programming, xxiii
Chapter 1 ▪ Basic Drawing in Processing 1
Starting a New Program 1
Saving a Program 2
Retrieving a Program 3
Entering Code into the Text Editor 4
Basic Drawing with Graphical Elements 8
Setting the “Canvas” Size: A Closer Look at the size() Function 8
Drawing Points: The point() Function 10
Drawing Line Segments: The line() Function 11
Drawing Rectangles: The rect() Function 13
Drawing Ellipses: The ellipse() Function 17
Drawing Triangles: The triangle() Function 20
Drawing Quadrilaterals: The quad() Function 22
Drawing Arcs: The arc() Function 26
Summary 29
The Processing Reference 31
More about Graphical Elements 31
Stacking Order 32
Changing Line Thickness: The strokeWeight() Function 33
Working with Color: RGB 35
Resetting the Canvas: The background() Function 37
12. viii ◾ Contents
Changing the Fill Color: The fill() and noFill() Functions 38
Changing the Stroke Color: The stroke() and noStroke() Functions 41
Inline Comments 43
Grayscale 43
Transparency 45
Summary 46
Exercises 47
Chapter 2 ▪ Types, Expressions, and Variables 53
Values 53
Numeric Values 53
Integers: The int Type 54
Numbers with Decimal Points: The float Type 54
Arithmetic with int Values and float Values 54
int Arithmetic 55
Integer Division 56
Calculating the Remainder with the Modulo Operator: % 57
float Arithmetic 58
float Fractions 59
The Trouble with Fractions on Computers 60
Evaluating Expressions 63
Order of Operations 63
Using Parentheses 65
Variables 65
Predefined Variables: width and height 67
Benefits of Using Variables 72
Creating and Using Our Own Variables 73
Variable Names 74
Variable Types 75
Declaring a Variable 76
Assigning a Value to a Variable 77
Combining Declaration and Initialization 80
Reusing a Variable 80
Type Mismatches 83
Why Not Use Only the float Type? 87
Expressions in Assignment Statements 88
13. Contents
◾ ix
Using a Variable on the Right-Hand Side of an Assignment Statement 91
Being Careful with Integer Division 95
Reassigning a New Value to a Variable 98
Constants 106
Predefined Constants 106
Defining Our Own Constants 108
Nonnumeric Types 110
Individual Characters: The char Type 110
Multiple Characters: The String Type 114
String Concatenation 116
Summary 118
Exercises 119
Chapter 3 ▪ More about Using Processing’s Built-In Functions 125
More about Console Output: The print()and println() Functions 125
Displaying Multiple Items to the Console 126
Graphical Text in Processing 127
The text()Function 128
The textsize() Function 128
The textAlign()Function 129
Matching the Type of an Argument to the Type of a Parameter 130
Two Kinds of Functions 132
void Functions 132
Functions That Return a Value 134
Determining a Function’s Return Type Using Processing’s Reference 137
Example: Calculating a Hypotenuse with the sqrt()Function 138
The pow()Function 140
Calculating the Area of a Square Using the pow()Function 141
Calculating the Hypotenuse with the pow()Function 144
The random()Function 145
The round() Function 146
Using the round() Function 147
More Conversion Functions: int() and float() 147
int() and random() Example: Choosing a Random Integer to
Simulate Rolling a Die 148
int() and random() Example: Random Side Length for a Square 149
14. x ◾ Contents
Example: Randomly Choosing a Pixel Location for a Circle 152
Random Color 156
The float() Function 158
Using the float() Function: Dividing Two int Variables Accurately 159
Converting to Nonnumeric Types: The char() and str() Functions 162
The char() Function 162
The str() Function 163
Simulating an Analog Thermometer 164
Special Functions for Input and Output with Dialog Boxes 167
Input Using a Dialog Box: The showInputDialog()Function 168
Inputting an int or float() Value 170
Output Using a Dialog Box: The showMessageDialog()Function 172
Interactive Example: Drawing an Angle 174
Summary 177
Exercises 178
Chapter
4 ▪ Conditional Programming with if 187
Recipe Analogy 187
The Basic if Statement 188
Basic if Statement Example: Rolling a Die Game 189
Caution: No Semicolon at the End of the First Line of an if Statement 191
Checking Equality: int Values 192
Basic if Statement: A Graphical Example 193
The if–else Statement 196
Using the if-else Statement: Classifying Ages 199
Using the if-else Statement: A Graphical Example 200
The if-else-if-else Statement 202
Rock–Paper–Scissors Example: if-else-if-else 203
Using the if-else-if-else Statement: A Graphical Example 209
Using the if-else-if-else Statement: Updating the Thermometer
Example 211
Using the if-else-if-else Statement: Types of Angles 217
Logical Operations: AND ( ), OR (|
|) 220
Using Logical AND ( ) : Rolling Two Dice 220
Using Logical OR (|
|) : Rolling a Die 222
Logical OR (|
|) Example: Rolling Two Dice 223
15. Contents
◾ xi
Nested if Statements 225
Using Nested if Statements: Classifying Ages 226
boolean Variables 229
Using a boolean Variable to Store a Condition 230
The switch Statement 235
Using the switch Statement: Revisiting the Rock–Paper–Scissors Example 235
Combining switch Cases: Rolling a One or a Six 239
Another switch Statement Example: Days of the Month 240
Checking Equality: float Values 243
Checking Equality: String Objects 243
The equals() Method of a String Object 246
Summary 247
Exercises 248
Chapter 5 ▪ Repetition with a Loop: The while Statement 255
Repetition as Long as a Certain Condition Is True 255
Repetition with the while Statement 256
Using the while Statement: Rolling a Die Repeatedly 256
Avoiding Infinite Loops 262
Watch Out for the Extra Semicolon! 263
Using the while Statement: A Graphical Example 264
Using the while Statement: Gift Card Simulation 273
Using the while Statement: A Counting Loop to Draw Concentric Circles 279
Commenting/Uncommenting 284
Using the while Statement: An Interactive Guessing Game 284
The Logical NOT (!) Operator 291
Using Logical NOT (!) With a while Loop’s Stop Condition 291
Repeating With the do-while Statement 293
Summary 296
Exercises 296
Chapter 6 ▪ Creating Counting Loops Using the for Statement 301
Uses of a Counting Loop 301
Requirements of a Counting Loop 301
Creating a Counting Loop with a while Statement 302
Creating a Counting Loop with a for Statement 305
16. xii ◾ Contents
Tracing the Action of the for Statement 307
Caution: Only Two Semicolons! 310
Avoiding Infinite Loops 310
Incrementing and Decrementing the for Loop Counter Variable 311
Using Equals in the Loop Condition 313
Repeating Actions with a Counting Loop 314
Scope of the for Statement’s Counting Variable 316
Counting through a Sequence with a for Statement: Grayscale Example 318
Counting through a Sequence with a for Statement: Revisiting an Example 321
Performing Actions a Specified Number of Times with a for Statement:
Coin Flip Simulation Example 324
Performing Actions a Specified Number of Times with a for Statement:
Starry Night Example 329
Counting Through a Sequence with a for Statement: Calculating a Factorial 332
Nested for Loops 338
Nested for Statements and Pixels: A Graphical Example 341
Summary 346
Exercises 346
Chapter 7 ▪ Creating void Functions 355
void Functions 355
Active Mode: Introducing the setup() Function 356
A Closer Look at the setup() Function 358
Creating Our Own void Function 360
Graphical Example of a void Function 366
Reusing a Function 374
Function Parameters and Arguments 378
Example: Adding a Parameter to a Function 379
Supplying an Argument to a Function 381
Adding Multiple Parameters to a Function 385
Other Special void Functions in Processing 390
A Special void Function: The draw() Function 391
The draw() Function: A Graphical Example 394
Animating the Balloon with the draw() Function 396
Special void Functions in Processing Related to the Mouse and Keyboard 399
17. Contents
◾ xiii
Summary 401
Exercises 402
Chapter 8 ▪ Creating Functions That Return a Value 409
(Non-void) Functions 409
Creating Our Own Function That Returns a Value 411
Multiple Function Calls 418
Adding a Parameter to a Function That Returns a Value 420
Revisiting the Right Triangle Example 427
Multiple Functions in the Same Program 434
Another Example: Rounding to Decimal Places 441
Summary 447
Exercises 448
Chapter 9 ▪ Arrays 453
About Arrays 453
Declaring an Array 455
Initializing an Array with Specific Values 456
Displaying an Array: The printArray() Function 458
Accessing an Array Element 458
Storing a Value in an Array 459
Processing an Array 460
Choosing Loop Conditions Carefully When Processing an Array 464
The length Property of an Array 465
Processing an Array: Calculating the Average Temperature 472
Graphical Example: Graphing an Array 480
Declaring and Creating an Array with the new Operator 485
Yahtzee Example: Filling an Array with Random Numbers 488
Shorter Loop Counter Variable Names 492
Increment (++) and Decrement (--) Operators 493
Interactive Example: Inputting Names 494
Searching an Array: Linear Search 497
Summary 501
Exercises 502
18. xiv ◾ Contents
Chapter 10 ▪ Introduction to Objects 505
Understanding an Object 505
Defining a New Type of Object By Creating a New Class 506
Instantiating an Object 509
Setting Attributes 511
Using Methods 512
Defining a Constructor 513
Multiple Objects 518
Interacting with Objects 520
Arrays of Objects 527
Object-Oriented Programming (OOP) 529
Summary 529
Exercises 530
INDEX, 533
19. xv
Foreword
In the summer of 2008, I was invited to present at an NSF-sponsored CPATH workshop at
La Salle University in Philadelphia. The title of the workshop was Revitalizing Computer
Science Education through the Science of Digital Media. My first book on Processing had
been recently published, and my talk introduced the Processing language and environ-
ment. I also discussed my own journey from painter to coder. One workshop attendee
seemed especially animated during my talk, and his enthusiasm led to a very lively group
discussion. This was my first encounter with Jeff Nyhoff.
Jeff like me is a hybrid, with a background in the arts (theater) and computing. Clearly,
what excited Jeff during my talk was discovering another kindred spirit; at the time there
were far less of us in academia (at least out in the open). Jeff and I are both fascinated by
the connections we see between coding and arts practice; this intersection is now com-
monly referred to as “creative coding.” Rather than seeing two radically disparate dis-
ciplines—sometimes generalized as extreme opposite, bifurcated left and right brain
activities—we see a beautiful integration. But we also understand most (and probably far
saner) people won’t come to this conclusion on their own. Thus, we both work to spread the
creative coding gospel, which has led to our common mission, and the ultimate purpose of
this wonderful new book: radically change how computing is taught.
I’m not sure if the workshop was Jeff’s initial exposure to Processing, but he instantly
recognized its elegance and ultimate usefulness, especially for introductory computing
education—something that its originators, Ben Fry and Casey Reas, didn’t really consider
outside of the arts context. Jeff and I remained in email contact after the workshop, and
a few years later, at the annual computer science educators’ conference (SIGCSE), we met
again in person. It was there, wandering around the SIGCSE book publishers’ exhibit, that
I met Larry Nyhoff, Jeff’s father. Larry was warm, cordial, and humble, and at first I didn’t
realize Jeff and Larry’s professional connection beyond father and son. Through Jeff, Larry
knew of me and my work, and too seemed excited by the possibilities Processing offered for
the classroom. I left that encounter clueless that I had been speaking to a true computing
educator legend.
Learning more about Larry gave me much greater insight into how Jeff, the theater
major, became a computer science professor. Larry taught computer science for over 40
years at Calvin College and is the author or co-author of over 30 books, spanning many
facets of computer science, as well as related (and seemingly unrelated) disciplines. Larry’s
books teach numerous programming languages and the aggregate of his publishing efforts
20. xvi ◾ Foreword
literally represents the history of modern computing education. The Processing literature
has gotten a lot more respectable thanks to Larry’s participation.
Jeff and Larry are deeply committed educators who have been willing to bring a critical,
albeit loving, eye to their own discipline, especially around issues of programming peda-
gogy. I remember receiving many impassioned emails from Jeff discussing his excitement
about Processing and CS pedagogy, but also his frustration with the established CS com-
munity’s initial hesitancy adopting Processing and ultimately embracing change. It was
inspiring for me to find someone so committed to helping students, literally all students,
learn to code. This is why I was especially excited to learn Jeff and Larry were writing their
own book on Processing.
The Nyhoffs’ book arrives as Processing enters a very stable and mature form. This was
certainly not the case for me when I began my book, back in 2004 when Processing was
still a messy work in progress. Processing 3 is now a very stable, professional-grade code
library and programming environment that is perfectly suited for use within the CS class-
room and beyond. Yet, in spite of Processing’s success and growing mainstream aware-
ness, there are still very few Processing books designed specifically for the CS classroom.
Processing’s legacy is the arts and design community, and most of the existing Processing
literature supports this population. The book Creative Coding and Generative Art 2, of
which I am a co-author, was designed for the CS classroom, with a concentration on visual
and graphic examples. This approach works well for some populations, but not all. And
this is where Jeff and Larry’s book comes to the rescue.
The Nyhoffs’ new book directly targets the CS classroom in a way that no other
Processing book does. The other books, including my own, unabashedly depart from tra-
ditional text-based examples found in almost all other introductory programming texts.
In our defense, initiating change sometimes requires a small revolution. However, Jeff and
Larry present a much less reactionary approach, integrating many of the wonderful things
about Processing with traditional approaches that have worked well in CS pedagogy. Not
only is their approach sensible and efficient, it’s also likely to offer greater comfort to exist-
ing CS instructors (who perhaps don’t have degrees in theater or painting).
It is this effort of considerate integration—of the old tried and true and new and
improved—that I believe has the greatest chance of tipping the balance for Processing’s
use in the computing classroom.
Ira Greenberg
Dallas, Texas
21. xvii
Preface: Why We Wrote
This Book and For
Whom It Is Written
This book is based on our belief that Processing is an excellent language for beginners to
learn the fundamentals of computer programming.
What Is Processing?
Processing was originally developed in 2001 at the MIT Media Lab by two graduate stu-
dents, Ben Fry and Casey Reas, who wanted to make it simpler to use computer pro-
gramming to produce visual art. Fry and Reas have since been joined by a community
of developers who have continued to update and improve Processing. As an open-source
software project, Processing is free for anyone to download, and versions are available for
Windows, MacOS, and Linux computers.
Because Processing is based on Java, Processing is quite powerful. For example, if you
explore such websites as https://processing.org and https://www.openprocessing.org, you’ll
see a wide variety of works that have been created using Processing: drawings, interactive
art, scientific simulations, computer games, music videos, data visualizations, and much
more. Some of these creations are remarkably complex.
Because Processing is based on Java, it has many similarities to Java. However, Processing
is much easier to learn than Java. In fact, we believe that Processing might well be the
best language currently available for teaching the basics of computer programming to
beginners.
Why Not Java?
One of the most important features of Processing is that it enables us to begin the process
of learning to program by building our programs out of simple statements and functions.
Unlike strictly object-oriented languages such as Java, Processing does not require us to
start with the more complex concepts and structures of “objects.” This makes for what
we believe is a much gentler introduction to programming. At the same time, because
Processing is based on Java, we have the full capability to move on to object-oriented
22. xviii ◾ Preface: Why We Wrote This Book and For Whom It Is Written
programming whenever we are ready to do so. In fact, this book includes a basic introduc-
tion to objects.*
At the same time, because Processing is based on Java, it is usually very similar (and
often identical) to Java in terms of much of its syntax and many of its structures, at least
in regard to the topics typically covered in an introductory programming course. Thus,
we have found that students proceed very smoothly from programming in Processing in
a first course to programming in Java in a second course. In general, Processing’s syntax
and structures carry over readily to the learning of such programming languages as Java,
C++, C#, and JavaScript, should you wish to learn any of these programming languages
after learning Processing.
What about Python?
Python is becoming increasingly popular as an introductory programming language.
However, Python often uses syntax and structures that are somewhat untraditional in
comparison with other programming languages that a student might also wish to learn.
We have also found that the dynamic typing of variables in languages like Python is
actually easier for students to understand after they have learned the static typing of vari-
ables in a language like Processing.†
Why This Book?
There are a number of very good books about Processing that have already been written.
However, many of them seem to us to be geared first and foremost toward the creation
of visual art. Processing certainly provides powerful capabilities for doing this, yet the
sophistication of such impressive digital art sometimes comes at the cost of increased com-
plexity in the code, potentially confusing a beginning programmer.
In this book, we focus on using Processing as a language to teach the basics of pro-
gramming to beginners who may have any of a variety of reasons for wanting to learn to
program. Thus, we do not attempt to do a wide survey of Processing’s vast capabilities
for graphical and interactive works. Rather, we use its capabilities for graphics and inter-
activity in order to create examples that we hope you will find to be simple, illustrative,
interesting, and perhaps even fun. If your goal in learning to program is to create digital
art, we believe that the foundation this book provides is an excellent place for you to begin
and will prepare you well for other Processing books that are more oriented toward digital
art. However, if you are seeking to learn to program for reasons other than the creation of
digital art, rest assured that this book has also been written with you in mind.
It might seem surprising to some that a book about such a graphics-oriented program-
ming language as Processing includes many examples that use numbers or text as the
primary output. However, these are used for a variety of reasons. First, numerical and
textual examples are sometimes easier to understand than graphical ones. Second, most
* Chapter 10 introduces objects.
† Processing does have a Python mode, Processing.py, for those who would like to learn to program in Python through
Processing. There is also P5.js, a JavaScript “interpretation” of Processing.
23. Preface: Why We Wrote This Book and For Whom It Is Written
◾ xix
graphical programs in Processing have a numerical basis that is often easier to understand
in the form of text and numerical output. Third, some readers are likely to be learning to
program for the purpose of being able to process numerical information (e.g., if they are
interested in math, science, or business) and/or to process data that is likely to include tex-
tual information. Fourth, we hope that a combination of simple graphical examples with
simple examples that use numbers and/or text will appeal to a broader range of learners.
In our own experience, it is sometimes a visual example that first connects with a student,
but at other times, it is a numerical and/or textual example that a student finds to be more
illustrative. In still other cases, it might be a combination of these types of examples that
successfully connects with a student.
We have followed what might be said to be a fairly traditional sequence of topics, one that
wehavefoundtoworkwellforintroducingprogramming.Also,wehopethatsuchasequence
might seem comfortably familiar to instructors and to students who have undertaken some
computer programming before. We have tried to introduce the key computer science con-
cepts associated with introductory programming without going into such detail that risks
being overwhelming. Supplementary materials will be available to instructors looking to
introduce even more computer science concepts associated with the topics (e.g., in a “CS1”
course). Processing’s capabilities for animation and interactivity are not explored extensively
in this book and are not touched upon until Chapter 7. However, additional examples using
animation and interactivity are available for instructors who wish to provide more cover-
age of these features and introduce them earlier. In addition, several online chapters are
provided that introduce slightly more advanced topics in Processing, such as two-dimen-
sional arrays, manipulation of strings, and file input and output (processingnyhoff.com).
Additional exercises for most of the chapters are also available.
Throughout the writing of this text, one of our primary concerns has been the pace of
the material. Some might find it to be slower in comparison with most programming texts.
However, in our experience, it can be easy to forget just how gradual a process is required
for most beginners to learn to program. Our pace in this book is based on our experiences
in teaching programming to a wide variety of beginners in a classroom. No prior program-
ming experience is expected. We hope that you will find the pace of this book to be a good
match to the rate at which you learn as well. It is our hope that this text will be useful to
students and instructors in a first programming class, but we have tried to write this book
in such a way that it will also be useful to persons teaching themselves to program.
25. xxi
Acknowledgments
Many thanks to Randi Cohen at CRC Press/Taylor Francis Group for her support of this
book and her expert guidance throughout the writing process.
Thanks also to Todd Perry at CRC Press/Taylor Francis Group and Michelle van
Kampen and her colleagues at Deanta Publishing Services for their production work on the
editing, layout, and typesetting of this text and for their advice during our proofreading.
Thanks to Ira Greenberg for his Foreword and for his encouraging influence. It was one
of his demonstrations of Processing that first convinced us of the enormous instructional
potential of this programming language.
Thanks to the reviewers, who provided such helpful feedback in response to drafts of
this book.
Thanks to faculty colleagues at Trinity for their encouragement and to the many Trinity
students who have served as test subjects for most of the material in this book.
Thanks to our families and friends for supporting us in this venture.
Thanks to God for all blessings, including the opportunity to write this book.
27. xxiii
Introduction: Welcome to
Computer Programming
Congratulations on your decision to try computer programming!
Why Learn to Program?
It may be that programming a computer is something that you aren’t sure you are able to do
or even want to be able to do. If so, then we hope that this book changes your mind by provid-
ing you with a friendly, straightforward, and solid introduction to computer programming.
Being a computer “user” once meant writing programs for the computer. However,
the emergence of personal computers beginning in the late 1970s was accompanied by a
growth in the availability of “application” software, such as word processors and spread-
sheet programs. Such software is written for “end users,” who do not need to be computer
programmers. Thus, the concept of a computer user as a programmer gradually shifted to
that of someone who uses software written by others.
However, there are still some very good reasons for learning about computer program-
ming in the current era of computing.
• Learning computer programming teaches you about what software really is.
Computer software programs may seem complicated and mysterious. However, as
you gain experience with simpler examples of computer software, you will start to
understand the fundamental nature of computer software. This is important knowl-
edge, given that more and more areas of our lives are affected by computer software.
• Learning computer programming gives insight into what a programmer does.
Someday, you may find yourself working on a team that includes a computer pro-
grammer. Knowing something about what is involved in programming is likely to
help you communicate and collaborate better with programmers.
• Instead of changing to fit the software, you can design how the software works.
When we use software that other people have written, we are often forced to adapt
our ways of thinking and working to the way that the software has been designed. In
contrast, when you write your own software, you get to decide what the software does
and how it works.
28. xxiv ◾ Introduction: Welcome to Computer Programming
• You cannot always count on someone else to create your software. Computer
software is needed by so many people and in so many ways that there can never
be enough people with programming abilities to develop all the software that users
would like to have. Thus, knowing enough about computer programming to create
or customize software may help you to provide software that you or others need and
would not otherwise be available.
• Even a little knowledge of computer programming is better than none at all. Many
people have no experience at all with programming. Thus, having even a little knowl-
edge of computer programming puts you a step ahead in terms of understanding
computing.
• Computer programming might already be, or turn out to be, something that
you need to learn. Many areas of study and careers are enriched by a basic knowl-
edge of computer programming, and a growing number are starting to require it.
Traditionally, programming has paired well with math, science, and business. But in
the present era, interests and skills in arts and media also are excellent pairings with
computer programming. Today, computer programs are used to solve a very wide
range of problems and serve a wide variety of purposes in nearly every area of human
society.
• Computer programming is a creative activity. Computer programs are often used
to solve problems, but computer programming is also a creative activity. Thus, you
might find yourself writing a program as a means of expressing yourself or simply out
of an urge to create something new. More and more artists and designers are learning
to program, especially those who work in electronic media.
• Computer programming might turn out to be something that you are good at and
enjoy doing. You will never know this without giving programming a try!
These are just a few of the many good reasons for learning about computer
programming.
What Is Programming?
Consider a “program” that you might be given at a band, orchestra, or choir concert. This
program simply lists the order in which the musical numbers are performed. This notion
of putting things in a certain sequence is one of the fundamental concepts of computer
programming.
Another useful analogy is that of a recipe, where certain actions with various ingredi-
ents are performed in a certain order to achieve a certain result. A computer program is
much like a recipe, involving the performance of a specific sequence of actions using cer-
tain “ingredients” (items of information) for the purpose of producing certain desired
results. In computing, such a recipe is also known as an algorithm.
29. Introduction: Welcome to Computer Programming
◾ xxv
A Tour of Processing
We will give a more detailed introduction to Processing in the first chapter, but let’s start here
with a brief tour of Processing that will give you a little taste of what it’s like and where we’re
headed in this book. Do not worry if you do not understand all the details that are presented in
this tour; everything in this introduction will be explained more fully in the coming chapters.
Processing is an open-source project. It can be downloaded for free from
https://processing.org and is available for Windows, Mac, and Linux computers.*
When you open Processing, what you see is Processing’s integrated development envi-
ronment or IDE:
An IDE is simply a software environment in which you can develop and test programs.
Compared with most IDEs, the Processing IDE is much simpler to use. Officially, the
Processing IDE is known as the “Processing development environment” or PDE. Here in
the PDE, you can enter programs and have Processing execute them.
“Hello, World!” Example
It is traditional in computer programming to begin with a program that simply displays
the words “Hello, World!” Let’s create such a program in Processing.
In the Text Editor section of the Processing window,
* As of this writing, the latest official release is version 3.3.
31. discovered the crouching savages, they fled precipitately to their boat and
escaped, leaving one of their number, George Cassen, a prisoner. Him the
Indians compelled to show the direction taken by Smith, after which he was
put to death in a barbarous manner.
Smith's party was overtaken among the Chickahominy swamps or
slashes, as they are called in Virginia, Robinson and Emry were killed and
Smith himself captured, but only after a terrible resistance. He fought like a
lion at bay, tied one of the Indian guides to his left arm for a shield, killed
three Indians, wounded several others and would have escaped had he not
stepped backward into a deep quagmire.
He now surrendered to the Indian sachem Ope-chan-ca-nough, who
conducted him in triumph through the Indian villages on the Potomac and
the Rappahannock, thence to his own town, Pamunkey. At this place the
medicine men practiced incantations and ceremonies for the space of three
days, hoping to obtain some insight into the mysterious character and
designs of the captive in order to determine his fate. By this time Smith had
so overawed his captors that they feared to inflict the death penalty without
the concurrence of their great werowance, Powhatan. Accordingly he was
conveyed to We-ro-wo-co-mo-co, the favorite home of this chieftain of the
chiefs, on the York river, a few miles from the historic field of Yorktown.
Arriving at We-ro-wo-co-mo-co, Captain Smith was detained near the
town until preparations had been made to receive him in state. When
Powhatan and his train had time to array themselves in all their greatest
braveries the noted prisoner was admitted to the great chief's presence.
Powhatan looked every inch a king as he sat on a kind of throne in the
longhouse, covered with a robe of raccoon skin, and with a coronet of
immense gaily colored plumes on his head. His two favorite daughters sat
on right and left while files of warriors and women of rank, his favorite
wives or sisters, were ranged around the hall.
On Smith's entrance into the hall of state a great shout arose from those
present. At a signal a handsome Indian woman, perhaps a sister of the great
chief, whom Smith styles the Queen of Appamatuck, brought water in a
copper basin to wash the prisoner's hands, while her companion presented a
bunch of feathers with which to dry them.
32. Powhatan now proceeded to question Smith closely as to where he was
from, where he was going, what brought the whites to his country, what
were their intentions, what kind of a country they lived in and how many
warriors they had. No doubt the captain was equal to the occasion, but it is
quite probable that the grim old savage regarded him as a liar. Again
quoting Smith, A long consultation was held, but the conclusion was, two
great stones were brought before Powhatan, then as many savages as could,
layd hands on him, dragged him to them and thereon layd his head, in
position to be crushed with a war club. A stalwart warrior was appointed
executioner. The signal was given, the grim executioner raised his heavy
war club and another moment had decided the fate both of the illustrious
captive and his colony. But that uplifted bludgeon was not destined to fall
upon the head of Smith. Matoaka, or Pocahontas, the eldest daughter of
Powhatan, sprang from her seat, and rushing between the big warrior and
his intended victim, she clasped his head in her arms and laid her own
upon his to save him from death. She held on with the resolution of despair
until her father, yielding to her frantic appeals, lifted them up and ordered
Smith to be released. The Emperor was contented; he should live to make
him hatchets (like the one Newport had presented) and her beads and
copper trinkets.
Ridpath well says, There is no reason in the world for doubting the
truth of this affecting and romantic story, one of the most marvelous and
touching in the history of any nation.
Bancroft also records the incident as a historical fact and moralizes on
it by saying, The gentle feelings of humanity are the same in every race
and in every period of life; they bloom, though unconsciously, even in the
bosom of a young Indian maiden.
The truth of this beautiful story was never doubted until 1866, when
the eminent antiquarian, Dr. Charles Deane, of Cambridge, Massachusetts,
in reprinting Smith's first book, The True Relation of 1609, pointed out
that it contains no reference to this hair-breadth escape. Since then many
American historians and scholars have concluded that it never happened at
all, and in order to be consistent they have tried to prove that Smith was a
blustering braggadocio, which is the very last thing that could in truth be
33. said of him. The rescue of a captive doomed to death, by a woman, is not
such an unheard-of thing in Indian stories.
If the truth of this deliverance be denied, how then did Smith come
back to Jamestown loaded with presents when the other three men were
killed, George Cassen, in particular, in a most horrible manner? And how is
it, supposing Smith's account of it to be false, that Pocahontas afterward
frequently came to Jamestown with her attendants bringing baskets of corn
and was, next to Smith himself, the salvation of the colony? She was also
sent by her father to intercede with Smith for the release of prisoners. The
fact is, nobody doubted the story in Smith's life time and he had enemies
enough. Pocahontas never visited Jamestown after Smith went to England
in October, 1609, until she was kidnapped and taken there in April, 1613,
by the infamous Captain Argall, with the aid of Japazaws, the chief sachem
of the Patawomekes or Potomacs.
37. It is true there is no mention of Pocahontas saving the life of Smith in
the True Relation, but it must not be forgotten that it is confessed that the
editor came upon his copy at second or third hand; that is, we suppose that
it had been copied in MS. He also confesses to selecting what he thought
fit to be printed. Can any one doubt, says Eggleston, that the 'True
Relation' was carefully revised, not to say corrupted, in the interest of the
company and the colony? And, if so, what more natural than that the
hostility of so great a chief as Powhatan would be concealed? For the great
need of the colony was a fresh supply of colonists. Nothing would have so
much tended to check emigration to Virginia (especially women) as a belief
that the most powerful neighboring prince was at war with the settlement.
But Smith does mention the thrilling incident in his letter to Queen
Anne, on behalf of his protege, and rings the changes on it. Said he,
Pocahontas, the King's most dear and well-beloved daughter, being but a
child of twelve or thirteen years of age, whose compassionate, pitiful heart,
of desperate estate, gave me much cause to respect her. . . . For at the
minute of my execution she hazarded the beating out of her own brains to
save mine; and not only that, but so prevailed with her father that I was
safely conducted to Jamestown.
The amiable young princess, Pocahontas, became the first Christian
convert in Virginia, as well as the first bride, when she married John Rolfe,
in 1613. At her baptism she received the name Lady Rebecca, no doubt in
allusion to Rebekah, the wife of Isaac, who became the mother of two
distinct nations and two manner of people.
In 1616 she and her husband went to England. Here the Lady
Rebecca received great attentions at court and was entertained by the
Bishop of London. Pocahontas remained in England about a year; and
when, with her husband and son, she was about to return to Virginia, with
her father's counselor, Tomocomo, she was seized with smallpox at
Gravesend and died in June,1617, aged twenty-two.
It may assist the reader to remember the place by recalling that at
Gravesend her beautiful life came to an end and she found a grave under
the chancel of the parish church.
38. John Rolfe returned to Virginia and became a prominent official of the
colony. His son, Thomas Rolfe, was taken to London, where he was brought
up by an uncle. When he was a young man he came to Virginia, and, as
Lieutenant Rolfe, commanded Fort James, on the Chickahominy.
In 1644, when about twenty-six, he petitioned the Governor for
permission to visit his great uncle, Ope-chan-ca-nough, and his aunt,
Cleopatre, who still lived in the woods on the York river. He married a
young lady of England, became a gentleman of note and fortune in
Virginia, and some of the most prominent families of that State are
descended from him.
John Randolph, of Roanoke, was the best known of his descendants
and was proud of his Indian blood. His manner of walking and the peculiar
brightness of his eyes are said to have shown his origin, and he once said he
came of a race who never forgot a kindness or forgave an injury. Randolph
was sixth in descent from Pocahontas, through Jane Rolfe, her grand-
daughter. And, as John Esten Cook says, the blood of Powhatan mingled
with that of his old enemies. Dead for many years, and asleep in his
sepulcher at Orapax, the savage old Emperor still spoke in the voice of his
great descendant, the orator of Roanoke.
The crafty Powhatan, seeing how much superior the English weapons
were to his own, determined to possess some of them. Accordingly, after
sparing the life of Captain Smith, he told him that they were now friends
and that he would presently send him home, and when he arrived at
Jamestown he must send him two great guns and a grindstone. He also
promised to consider him his son and give him the country of
Capahowosick.
Smith was shortly afterward sent to Jamestown with twelve guides and
arrived safely after seven weeks' captivity. Here he treated his savage
guides with great hospitality and showed Rawhunt, their leader, two demi-
culverins (long cannon carrying a nine-pound shot) and a millstone to carry
to Powhatan. The Indians, however, found them somewhat too heavy. To
give them a wholesome fright, Smith caused a cannon to be loaded with
stone and fired among the boughs of trees filled with icicles. The effect may
easily be imagined.
39. Presents of various toys and trinkets were now given the Indians for
Powhatan and his family and they went away satisfied.
During the same winter Smith visited Powhatan in company with
Newport. Attended by a guard of thirty or forty men they sailed as far as
We-ro-wo-co-mo-co the first day. Here Newport's courage failed him. But
Smith, with twenty men, went on and visited the chief at his town.
Powhatan exerted himself to the utmost to give his adopted son a royal
entertainment. The warriors shouted for joy to see Smith; orations were
addressed to him and a plentiful feast provided to refresh him after his
journey. The great sachem received him, reclining upon his bed of mats, his
pillow of dressed skin lying beside him with its brilliant embroidery of
shells and beads, and his dress consisting chiefly of a handsome fur robe.
Along the sides of the house sat twenty comely females, each with her head
and shoulders painted red and a great chain of white beads about her neck.
Before these sat his chiefest men in like order, and more than fortie platters
of fine bread stood in two piles on each side of the door. Foure or five
hundred people made a guard behind them for our passage; and
Proclamation was made, none upon paine of death to presume to doe us any
wrong or discourtesie. With many pretty discourses to renew their old
acquaintance, this great king and our captain spent the time, till the ebbe left
our barge aground. Then renewing their feast with feates, dauncing and
singing, and such like mirth, we quartered that night with Powhatan.
The next day Captain Newport came ashore and was received with
savage pomp, Smith taking the part of interpreter. Newport presented
Powhatan with a boy named Thomas Salvage. In return the chief gave him a
servant of his named Namontack, and several days were spent in feasting,
dancing and trading, during which time the old sachem manifested so much
dignity and so much discretion as to create a high admiration of his talents
in the minds of his guests.
Newport had brought with him a variety of articles for barter, such as
he supposed would command a high price in corn. Not finding the lower
class of Indians profitable, as they dealt on a small scale and had but little
corn to spare, he was anxious to drive a bargain with Powhatan himself.
This, however, the haughty chief affected to decline and despise.
40. Captain Newport, said he, it is not agreeable to my greatness to
truck in this peddling manner for trifles. I am a great werowance and I
esteem you the same. Therefore lay me down all your commodities
together; what I like I will take and in return you shall have what I conceive
to be a fair value.
Newport fell into the trap. He did as requested, contrary to Smith's
advice. Powhatan selected the best of his goods and valued his corn so high
that Smith says it might as well have been purchased in old Spain. They did
not get four bushels, where they expected twenty hogsheads.
It was now Smith's turn to try his skill; and he made his experiment not
upon the sagacity of Powhatan but upon his simplicity. Picking up a string
of large brilliant blue beads he contrived to glance them as if by accident, so
that their glint attracted the eye of the chief, who at once became eager to
see them. Smith denied having them, then protested he could not sell them
as they were made of the same stuff as the sky and only to be worn by the
greatest kings on earth.
Powhatan immediately became half-mad to own such strange
jewels. It ended by Smith securing two or three hundred bushels of corn
for a pound or two of blue beads. Having loaded their barges, they floated
with the next tide. They also visited Ope-chan-ca-nough before their return
and fitted this chief with blue beads on the same terms.
On September 10, 1608, Smith was made President of the colony and
things had begun to run smoothly when the marplot Newport returned with
several wild schemes. He brought with him orders from King James for a
coronation of Powhatan as Emperor, together with elaborate presents for the
old chief. A more foolish thing was never perpetrated. Smith, with his usual
hard sense, protested against it. He well knew that it would tend to increase
the haughty chief's notions of his own importance and make it impossible to
maintain friendly relations with him. Finding his opposition in vain he
insisted on at least trying to get Powhatan to come to Jamestown for the
ceremony, and even offered to go himself and extend the invitation to the
chief.
41. Smith took with him four companions only and went across the woods
by land, about twelve miles, to We-ro-wo-co-mo-co. Powhatan was then
absent at a distance of twenty or thirty miles. Pocahontas immediately sent
for him and he arrived the following day. Smith now delivered his message
desiring him to visit his father Newport at Jamestown for the purpose of
receiving the newly arrived presents and also concerting a campaign in
common against the Monacans. But this proud representative in the
American forest of the divine right of kings haughtily replied, If your King
has sent me a present, I also am a King and this is my land; eight days I will
stay to receive them. Your father is to come to me, not I to him, nor yet to
your fort neither will I bite at such a bait; as for the Monacans I can revenge
my own injuries.
This is the lofty potentate, says a charming writer, whom Smith
could have tickled out of his senses with a glass bead and who would have
infinitely preferred a big shining copper kettle to the misplaced honor
intended to be thrust upon him, but the offer of which puffed him up
beyond the reach of negotiation.
After some further general conversation Smith returned with his
answer. If the mountain would not come to Mahomet, then Mahomet must
go to the mountain. The presents were sent by water around to We-ro-wo-
co-mo-co and the two captains with a guard of fifty men went by land.
Smith describes the ridiculous ceremony of the coronation, the last act of
which shows that the old sachem himself saw the size of the joke. The
presents were brought him, his basin and ewer, bed and furniture setup, his
scarlet cloak and apparel with much adoe put on him, being assured they
would not hurt him. But a foule trouble there was to make him kneel to
receive his crown; he not knowing the majesty, nor wearing of a crown, nor
bending of the knee, endured so many persuasions, examples and
instructions as tyred them all. At last by bearing hard on his shoulders, he a
little stooped, and three having the crown in their hands, put it on his head,
when by the warning of a pistoll the boats were prepared with such a volly
of shot, that the king started up in a horrible feare, till he saw all was well.
Then, remembering himself, to congratulate their kindness, he gave his old
shoes (moccasins) and his mantell (of raccoon skins) to Captain Newport.
The mountain labored and brought forth a mouse.
42. Little was heard of Powhatan for some time after this, except
occasionally through the medium of some of his tribes, who refused to trade
with the English in consequence of his orders to that effect. He had
evidently become jealous, but appearances were still kept up, and in
December, 1608, the Emperor (for he is now one of the crowned heads)
invited the captain to visit him. He wanted his assistance in building a
house, and if he would bring with him a grindstone, fifty swords, a few
muskets, a cock and hen, with a quantity of beads and copper, he might
depend upon getting a ship load of corn.
Smith accepted the invitation and set off with a pinnace and two barges
manned by forty-six volunteers. It was on this occasion that a severe storm
drove Smith and his men to seek shelter and spend Christmas with friendly
Indians, where they enjoyed the good cheer and hospitality mentioned
elsewhere in this narrative.
They reached We-ro-wo-co-mo-co January 12, quartered without much
ceremony at the first house they found, and sent to Powhatan for a supply of
provisions. The wily old chief furnished them with plenty of bread, venison
and turkeys, but pretended not to have sent for them at all. In reply Smith
asked if he had forgotten his own invitation thus suddenly, and then
produced the messengers who had carried it, and who happened to be near
at hand. Powhatan affected to regard the whole affair as a mere joke and
laughed heartily. Smith reproached him with deceit and hostility. The chief
replied by wordy evasions and seemed very indifferent about his new
house. He demanded guns and swords in exchange for corn, which Smith,
of course, refused. By this time the captain was provoked and gave the chief
to understand that necessity might force him to use disagreeable expedients
in relieving his own wants and the need of the colony. Powhatan listened to
this declaration with cool gravity and replied with corresponding frankness.
Said he, I will spare you what I can and that within two days. But, Captain
Smith, I have some doubts as to your object in this visit. I am informed that
you wish to conquer more than to trade, and at all events you know my
people must be afraid to come near you with their corn so long as you go
armed and with such a retinue. Lay aside your weapons then. Here they are
needless. We are all friends, all Powhatans. The information here alluded
43. to was probably gained from the two Dutchmen who had deserted the
colony and gone among the Indians.
A great contest of ingenuity now ensued between the Englishman and
the savage, the latter endeavoring to temporize only for the purpose of
putting Smith and his men off their guard. He especially insisted on the
propriety of laying aside their arms.
Captain Smith, he continued, I am old and I know well the
difference between peace and war. I wish to live quietly with you and I wish
the same for my successors. Now, rumors which reach me on all hands
make me uneasy. What do you expect to gain by destroying us who provide
you with food? And what can you get by war if we escape you and hide our
provisions in the woods? We are unarmed, too, you see. Do you believe me
such a fool as not to prefer eating good meat, sleeping quietly with my
wives and children, laughing and making merry with you, having copper
and hatchets and anything else—as your friend—to flying from you as your
enemy, lying cold in the woods, eating acorns and roots, and being so
hunted by you meanwhile that if but a twig break, my men will cry out,
'There comes Captain Smith.' Let us be friends, then. Do not invade us with
such an armed force. Lay aside these arms.
But Smith was proof against this eloquence, which, it will be
conceded, was of a high order. Believing the chief's purpose was to disarm
the English and then massacre them, he ordered the ice broken and the
pinnace brought nearer shore. More men were then landed preparatory to an
attack.
The white man and the Indian were well matched in general
intelligence, insight into character and craftiness. No diplomacy inferior to
that of the Indian Emperor could have so long retained the upper hand of
Smith. No leader of less courage and resources than John Smith could so
long have maintained a starving colony in the hostile dominions of the great
Powhatan.
While waiting until the re-enforcements could land. Smith tried to
keep Powhatan engaged in a lengthy conversation. But the Indian outwitted
him. Leaving three of his handsomest and most entertaining wives to
44. occupy Smith's attention, Powhatan slipped through the rear of his bark
dwelling and escaped, while his warriors surrounded the house. When
Smith discovered the danger he rushed boldly out. Flourishing his sword
and firing his pistol at the nearest savage he escaped to the river, where his
men had just landed.
The English had already traded a copper kettle to Powhatan for eighty
bushels of corn. This was now delivered, and with loaded muskets they
forced the Indians to fill the boat.
By the time this was done night had come on, but the loaded vessel
could not be moved until high tide. Smith and his men must remain ashore
until morning. Powhatan and his warriors plotted to attack them while at
their supper. Once again Pocahontas saved Smith. Slipping into the camp
she hurriedly warned him of his danger and revealed the whole plot. The
captain offered her handsome presents and rewards, but with tears in her
eyes she refused them all, saying it would cost her her life to be seen to
have them.
48. Presently ten lusty warriors came bearing a hot supper for the English
and urging them to eat. But Smith compelled the waiters first to taste their
own food as an assurance against poison. He then sent them back to tell
Powhatan the English were ready for him.
No one was permitted to sleep that night, but all were ordered to be
ready to fight any moment, as large numbers of Indians could be seen
lurking around. Their vigilance saved them, and with the high tide of the
morning the homeward trip was commenced.
Such benefits resulted from the marriage of Rolfe and Pocahontas that
Governor Dale piously ascribed it to the divine approval resting on the
conversion of the heathen, and reflecting that another daughter of Powhatan
would form an additional pledge of peace, sent Ralph Hamer and the
interpreter, Thomas Savage, to Powhatan to procure a second daughter for
himself.
They found the aged chief at Matchcat, further up the river than We-ro-
wo-co-mo-co, and after a pipe of tobacco had been passed around Powhatan
inquired anxiously about his daughter's welfare, her marriage, his
unknown son, and how they liked, lived and loved together. Hamer
answered that they lived civilly and lovingly together, and that his
daughter was so well content that she would not change her life to return
and live with him, whereat he laughed heartily and said he was very glad of
it.
Powhatan now asked the particular cause of Mr. Hamer's visit. On
being told it was private, the Emperor ordered the room cleared of all
except the inevitable pair of queens, who sat on either side of the monarch.
Hamer began by saying that he was the bearer of a number of presents from
Governor Dale, consisting of coffee, beads, combs, fish hooks and knives,
and a promise of the much-talked-of grindstone whenever Powhatan would
send for it. He then added that the Governor, hearing of the fame of the
Emperor's youngest daughter, was desirous of making her his nearest
companion and wife. He conceived there could not be a finer bond of
49. union between the two people than such a connection; and, besides,
Pocahontas was exceedingly anxious for her sister's companionship at
Jamestown. He hoped that Powhatan would at least suffer her to visit the
colony when he should return.
Powhatan more than once came very near interrupting the delivery of
this message. But he controlled himself, and when Hamer had finished, the
Emperor gracefully acknowledged the compliment, but protested that his
daughter had been three days married to a certain young chief. To this the
brazen Hamer replied that this was nothing; that the groom would readily
relinquish her for the ample presents which Governor Dale would make,
and further that a prince of his greatness might easily exert his authority to
reclaim his daughter on some pretext. To this base proposition the old
sachem made an answer of which the nobility and purity might have put to
shame the unscrupulous Hamer. He confessed that he loved his daughter as
his life and though he had many children he delighted in her most of all. He
could not live without seeing her every day and that would be impossible if
she went among the colonists, for he had resolved upon no account to put
himself in their power or to visit them. He desired no other pledge of
friendship than the one already existing in the marriage of his Pocahontas,
unless she should die, in which case he would give up another child. He
concluded with the following pathetic eloquence: I hold it not a brotherly
part for your King to endeavor to bereave me of my two darling children at
once. Give him to understand that if he had no pledge at all, he need not
distrust any injury from me or my people. There has already been too much
of blood and war; too many of my people and of his have already fallen in
our strife, and by my occasion there shall never be any more. I, who have
power to perform it, have said it; no, not though I should have just occasion
offered, for I am now grown old and would gladly end my few remaining
days in peace and quiet. Even if the English should offer me injury, I would
not resent it. My country is large enough and I would remove myself further
from you. I hope this will give satisfaction to my brother, he can not have
my daughter. If he is not satisfied, I will move three days' journey from him
and never see Englishmen more.
His speech was ended. The barbarian's hall of state was silent. The
council fire unreplenished had burned low during the interview and the
50. great crackling logs lay reduced to a dull heap of embers—fit symbol of the
aged chieftain who had just spoken.
As Mason well says, Call him a savage, but remember that his shining
love for his daughter only throws into darker shadow the infamous
proposition of the civilized Englishman to tear away the three days' bride
from the arms of her Indian lover and give her to a man who had already a
wife in England. Call him a barbarian, but forget not that when his enemies
hungered he gave them food. When his people were robbed, whipped and
imprisoned by the invaders of his country, he had only retaliated and had
never failed to buy the peace to which he was entitled without money and
without price. Call him a heathen, but do not deny that when he said that, if
the English should do him an injury, he would not resent it but only move
further from them, he more nearly followed the rule of the Master, of whom
he was ignorant, than did the faithless, pilfering adventurers at the fort, who
rolled their eyes heavenward and called themselves Christians.
No candid person can read the history of this famous Indian with an
attentive consideration of the circumstances under which he was placed
without forming a high estimate of his character as a warrior, statesman and
a patriot. His deficiencies were those of education and not of genius. His
faults were those of the people whom he governed and of the period in
which he lived. His great talents, on the other hand, were his own and these
are acknowledged even by those historians who still regard him with
prejudice.
Smith calls him a prince of excellent sense and parts, and a great
master of all the savage arts of government and policy.
He died in 1618, just one year after the untimely death of Pocahontas,
full of years and satiated with fightings, and the delights of savage life.
He is a prominent character in the early history of our country and well
does he deserve it. In his prime he was as ambitious as Julius Cæsar and not
less successful, considering his surroundings. He and Pocahontas were the
real F. F. V.'s, for, beyond controversy, they were of the First Families of
Virginia.
52. CHAPTER III
MASSASOIT.
THE FRIEND OF THE PURITANS.
Welcome, Englishmen! A terrific peal of thunder from a cloudless
sky would not have astonished the Plymouth Fathers as did these startling
words. It was March 16, 1621, a remarkably pleasant day, and they had
assembled in town meeting to plan and discuss ways and means for the best
interests of the colony. So engrossed were they with the matter under
consideration they did not notice the approach of a solitary Indian as he
stalked boldly through the street of this village until he advanced towards
the astonished group, and with hand outstretched in a friendly gesture and
with perfectly intelligible English addressed them with the words,
Welcome, Englishmen! The astonished settlers started to their feet and
grasped their ever ready weapons. But reassured by his friendly gestures
and hearty repetition of the familiar English phrase in which only kindness
lurked, the settlers cordially returned his greeting and reciprocated his
welcome, which is the only one the Pilgrims ever received.
He who would have friends must show himself friendly. This their
dusky guest had done and it paved the way for a pleasant interview, which
resulted in mutual good. Knowing that the way to the heart lies through the
stomach, they at once gave their visitor strong water, biscuit, butter, cheese
and some pudding, with a piece of mallard.
The heart of the savage was gained: the taciturnity characteristic of his
race gave way and he imparted valuable information, much of it pertaining
to things they had long desired to know. They ascertained that his name was
Samoset, that he was a subordinate chief of the Wampanoag tribe, and his
hunting-grounds were near the island of Monhegan, which is at the mouth
of Penobscot Bay. With a strong wind it was but a day's sail eastward, but it
required five days to make the journey by land. This was a noted fishing
53. place and he had learned something of the English language from crews of
fishing vessels which frequented his coast. He told them the country in their
vicinity was called Pawtuxet; that four years previous a terrible pestilence
had swept off the tribes that inhabited the district, so that none remained to
claim the soil.
He also informed them that a powerful sachem named Massasoit was
their nearest neighbor. He lived about Montaup (afterward corrupted by the
English into Mount Hope), and was chief of the Wampanoag tribe as well as
head sachem of the Pokanoket confederacy of thirty tribes. Massasoit, he
said, was disposed to be friendly. But another tribe, called the Nausets, were
greatly incensed against the English, and with just cause. Samoset was able
to define this cause, which also served to explain the fierce attack the
Pilgrims received from the savages in their memorable First Encounter.
It seems that a captain by the name of Hunt who had been left in
charge of a vessel by Captain John Smith, while exploring the coast of New
England in 1614, had exasperated the Indians beyond endurance. Captain
Smith thus records this infamous crime in his Generale Historie of New
England. He (Hunt) betraied foure and twentie of these poore salvages
aboord his ship, and most dishonestly and inhumanely for their kind usage
of me and all our men, carried them with him to Maligo, and there for a
little private gaine sold those silly salvages for Rials of eight; but this vilde
act kept him ever after from any more emploiement to these parts.
Samoset had heard from his red brothers all about this kidnapping, as
well as the attack on the Pilgrims in revenge for it.
The sequel of Hunt's outrageous crime is quite interesting. He sold his
victims, as we have seen, at Malaga, for eighty pounds each, but some of
them, including an Indian by the name of Squanto, were ransomed and
liberated by the monks of that island.
Squanto now went first to Cornhill, England, afterward to London.
Here he acquired some knowledge of the English language and obtained the
friendship and sympathy of Mr. John Slaney, a merchant of that city, who
protected him and determined to send the poor exile back to his native land.
54. About this time (1619) Sir F. Gorges was preparing to send a ship to
New England under the command of Captain Thomas Dermer, and it was
arranged for Squanto to embark on board this ship. When I arrived, says
Dermer in his letter to Purchas, at my savage's native country, finding all
dead (because of the pestilence), I traveled along a day's journey to a place
called Nummastaquyt, where, finding inhabitants, I dispatched a messenger
a day's journey further west, to Pacanokit, which bordereth on the sea;
whence came to see me two kings, attended with a guard of fifty armed
men, who being well satisfied with that my savage and I discoursed unto
them (being desirous of novelty) gave me content in whatsoever I
demanded. Here I redeemed a Frenchman and afterwards another at
Masstachusitt, who three years since escaped shipwreck at the northeast of
Cape Cod.
One of these two kings, as the sachems were frequently entitled by
the early writers, must have been Massasoit, the other was probably his
brother, Quadepinah.
The good Captain Dermer was faithful to his trust and delivered the
poor exile Squanto to his native land, but not to his own people at
Plymouth, as they had been swept off by the pestilence in his absence. He,
however, became a loyal subject of Massasoit. He was introduced to the
English settlers at Plymouth by Samoset on his third visit. Squanto was
disposed to return good for evil, and forgetting the outrage of the knave
who had kidnapped him and remembering only the great kindness which he
had received from his benefactor, Mr. Slaney, and from the people generally
in London, in generous requital now attached himself cordially to the
Pilgrims and became their firm friend. His residence in England, as we have
stated, had rendered him quite familiar with the English language, and he
proved invaluable, not only as an interpreter, but also in instructing them
respecting fishing, woodcraft, planting corn and other modes of obtaining
support in the wilderness.
Squanto brought the welcome intelligence that his sovereign chief, the
great Massasoit, had heard of the arrival of the Pilgrims and was
approaching to pay them a friendly visit, attended by a retinue of sixty
warriors. An hour later Massasoit and his warriors, accompanied by his
55. 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!
textbookfull.com