Invent Your Own Computer Games With Python 2nd Edition Al Sweigart all chapter instant download
Invent Your Own Computer Games With Python 2nd Edition Al Sweigart all chapter instant download
com
https://ebookname.com/product/invent-your-own-computer-
games-with-python-2nd-edition-al-sweigart/
OR CLICK BUTTON
DOWLOAD EBOOK
https://ebookname.com/product/automate-the-boring-stuff-with-python-
practical-programming-for-total-beginners-2nd-edition-al-sweigart/
ebookname.com
https://ebookname.com/product/beginning-python-games-development-2nd-
edition-with-pygame-harrison-kinsley/
ebookname.com
Fix Your Own Computer For Seniors For Dummies 1st Edition
Corey Sandler
https://ebookname.com/product/fix-your-own-computer-for-seniors-for-
dummies-1st-edition-corey-sandler/
ebookname.com
https://ebookname.com/product/best-easy-day-hikes-glacier-and-
waterton-lakes-national-parks-3rd-ed-edition-molvar/
ebookname.com
Soccer 3rd Edition Joseph A Luxbacher
https://ebookname.com/product/soccer-3rd-edition-joseph-a-luxbacher/
ebookname.com
https://ebookname.com/product/financial-management-text-problems-and-
cases-6th-edition-m-y-khan/
ebookname.com
https://ebookname.com/product/anxiety-disorders-theory-research-and-
clinical-perspectives-1st-edition-roberto-lewis-fernandez/
ebookname.com
https://ebookname.com/product/cabals-and-satires-mozart-s-comic-
operas-in-vienna-1st-edition-ian-woodfield/
ebookname.com
2nd Edition
Al Sweigart
Copyright © 2008, 2009, 2010 by Albert Sweigart
Some Rights Reserved. "Invent Your Own Computer Games with Python" ("Invent
with Python") is licensed under a Creative Commons Attribution-Noncommercial-
Share Alike 3.0 United States License.
Attribution — You must attribute the work in the manner specified by the
author or licensor (but not in any way that suggests that they endorse you or your
use of the work). (Visibly include the title and author's name in any excerpts of this
work.)
Noncommercial — You may not use this work for commercial purposes.
Share Alike — If you alter, transform, or build upon this work, you may
distribute the resulting work only under the same or similar license to this one.
Your fair use and other rights are in no way affected by the above. There is a
human-readable summary of the Legal Code (the full license), located here:
http://creativecommons.org/licenses/by-nc-sa/3.0/us/legalcode
Book Version 13
ISBN 978-0-9821060-1-3
2nd Edition
A Note to Parents and Fellow
Programmers
Thank your for reading this book. My motivation for writing this book comes from a gap
I saw in today's literature for kids interested in learning to program. I started programming
when I was 9 years old in the BASIC language with a book similar to this one. During the
course of writing this, I've realized how a modern language like Python has made
programming far easier and versatile for a new generation of programmers. Python has a
gentle learning curve while still being a serious language that is used by programmers
professionally.
The current crop of programming books for kids that I've seen fell into two categories.
First, books that did not teach programming so much as "game creation software" or a
dumbed-down languages to make programming "easy" (to the point that it is no longer
programming). Or second, they taught programming like a mathematics textbook: all
principles and concepts with little application given to the reader. This book takes a
different approach: show the source code for games right up front and explain
programming principles from the examples.
I have also made this book available under the Creative Commons license, which allows
you to make copies and distribute this book (or excerpts) with my full permission, as long
as attribution to me is left intact and it is used for noncommercial purposes. (See the
copyright page.) I want to make this book a gift to a world that has given me so much.
Thank you again for reading this book, and feel free to email me any questions or
comments.
Al Sweigart
[email protected]
The full text of this book is available in HTML or PDF format at:
http://inventwithpython.com
Dinosaur Comics reproduced with permission Thanks Ryan!
Complete beginners who wants to teach themselves computer programming, even if they have no previous
experience programming.
Kids and teenagers who want to learn computer programming by creating games. Kids as young as 9 or 10
years old should be able to follow along.
Adults and teachers who wish to teach others programming.
Anyone, young or old, who wants to learn how to program by learning a professional programming
language.
Table of Contents
Source Code Listing
hello.py 21
guess.py 30
jokes.py 51
dragon.py 58
buggy.py 83
coinFlips.py 87
hangman.py 103
tictactoe.py 150
truefalsefizz.py 172
bagels.py 184
sonar.py 213
cipher.py 244
reversi.py 261
aisim1.py 292
aisim2.py 294
aisim3.py 299
pygameHelloWorld.py 309
animation.py 324
collisionDetection.py 338
pygameInput.py 348
spritesAndSounds.py 360
dodger.py 371
1 Installing Python 1
Downloading and Installing Python 2
Starting Python 4
How to Use This Book 4
The Featured Programs 5
Line Numbers and Spaces 5
Summary 7
2 The Interactive Shell 8
Some Simple Math Stuff 8
Evaluating Expressions 11
Storing Values in Variables 12
Using More Than One Variable 15
Summary 16
3 Strings, and Your First Program 18
Strings 18
String Concatenation 19
Writing Programs in IDLE's File Editor 20
Hello World! 20
How the "Hello World" Program Works 23
Summary 26
4 Guess the Number 28
The "Guess the Number" Game 28
Sample Run of "Guess the Number" 29
Guess the Number's Source Code 29
The import Statement 31
The random.randint() Function 32
Passing Arguments to Functions 34
Blocks 36
The Boolean Data Type 37
Comparison Operators 37
Conditions 38
Experiment with Booleans, Comparison Operators, and Conditions 38
Looping with While Statements 41
The Player Guesses 41
if Statements 44
Leaving Loops Early with the break Statement 45
Check if the Player Won 46
Summary: What Exactly is Programming? 47
A Web Page for Program Tracing 48
5 Jokes 50
Make the Most of print() 50
Sample Run of Jokes 50
Joke's Source Code 51
Escape Characters 52
Quotes and Double Quotes 53
The end Keyword Argument 54
Summary 55
6 Dragon Realm 56
Introducing Functions 56
Sample Run of Dragon Realm 57
Dragon Realm's Source Code 57
def Statements 60
Boolean Operators 61
Return Values 65
Variable Scope 65
Parameters 68
Where to Put Function Definitions 70
Displaying the Game Results 71
The Colon : 73
Where the Program Really Begins 73
Designing the Program 75
Summary 76
7 Using the Debugger 77
Bugs! 77
Starting the Debugger 78
Stepping 80
The Go and Quit Buttons 81
Stepping Over and Stepping Out 81
Find the Bug 83
Break Points 86
Summary 88
8 Flow Charts 89
How to Play "Hangman" 89
Sample Run of "Hangman" 89
ASCII Art 91
Designing a Program with a Flowchart 92
Creating the Flow Chart 93
Summary: The Importance of Planning Out the Game 100
9 Hangman 102
Hangman's Source Code 103
Multi-line Strings 107
Constant Variables 108
Lists 108
Changing the Values of List Items with Index Assignment 110
List Concatenation 110
The in Operator 111
Removing Items from Lists with del Statements 112
Lists of Lists 113
Methods 114
The reverse() and append() List Methods 115
The Difference Between Methods and Functions 116
The split() Function 116
The range() and list() Functions 120
for Loops 121
elif ("Else If") Statements 127
Review of the Functions We Defined 131
Making New Changes to the Hangman Program 132
Dictionaries 139
Sets of Words for Hangman 142
The random.choice() Function 143
Multiple Assignment 145
Summary 147
10 Tic Tac Toe 148
Sample Run of Tic Tac Toe 149
Source Code of Tic Tac Toe 150
Designing the Program 154
Game AI 156
List References 162
Short-Circuit Evaluation 170
The None Value 175
Summary: Creating Game-Playing Artificial Intelligences 182
11 Bagels 183
Sample Run 184
Bagel's Source Code 184
Designing the Program 186
The random.shuffle() Function 188
Augmented Assignment Operators 190
The sort() List Method 192
The join() String Method 192
String Interpolation 194
Summary: Getting Good at Bagels 198
12 Cartesian Coordinates 200
Grids and Cartesian Coordinates 201
Negative Numbers 202
Math Tricks 204
Absolute Values and the abs() Function 206
Coordinate System of a Computer Monitor 207
Summary: Using this Math in Games 208
13 Sonar Treasure Hunt 209
Sample Run 210
Sonar's Source Code 213
Designing the Program 218
The remove() List Method 229
Summary: Review of our Sonar Game 238
14 Caesar Cipher 239
About Cryptography 239
The Caesar Cipher 240
ASCII, and Using Numbers for Letters 241
The chr() and ord() Functions 242
Sample Run of Caesar Cipher 243
Caesar Cipher's Source Code 244
The isalpha() String Method 247
The isupper() and islower() String Methods 248
Brute Force 251
Summary: Reviewing Our Caesar Cipher Program 253
15 Reversi 256
How to Play Reversi 255
Sample Run 257
Reversi's Source Code 260
The bool() Function 276
Summary: Reviewing the Reversi Game 290
16 AI Simulation 291
"Computer vs. Computer" Games 291
AISim1.py Source Code 292
AISim2.py Source Code 294
Percentages 296
The round() Function 297
Comparing Different AI Algorithms 299
AISim3.py Source Code 299
Learning New Things by Running Simulation Experiments 305
17 Graphics and Animation 306
Installing Pygame 307
Hello World in Pygame 308
Hello World's Source Code 308
Importing the Pygame Module 311
Variables Store References to Objects 313
Colors in Pygame 313
Fonts, and the pygame.font.SysFont() Function 315
Attributes 316
Constructor Functions and the type() function. 317
The pygame.PixelArray Data Type 321
Events and the Game Loop 322
Animation 324
The Animation Program's Source Code 324
Some Small Modifications 335
Summary: Pygame Programming 335
18 Collision Detection and Input 337
The Collision Detection Program's Source Code 337
The Collision Detection Function 341
The pygame.time.Clock Object and tick() Method 344
The Keyboard Input Program's Source Code 348
The colliderect() Method 356
Summary: Collision Detection and Pygame Input 356
19 Sound and Images 358
Image and Sound Files 360
Sprites and Sounds Program 360
The Sprites and Sounds Program's Source Code 360
Setting Up the Window and the Data Structure 364
The pygame.transform.scale() Function 364
Summary: Games with Graphics and Sounds 368
20 Dodger 369
Review of the Basic Pygame Data Types 370
Dodger's Source Code 371
Implementing the Cheat Codes 392
Modifying the Dodger Game 397
Summary: Creating Your Own Games 397
Appendix A
Differences Between Python 2 and 3 399
Appendix B
Statements, Functions, and Methods Reference 403
Appendix C
Running Python Programs without Python Installed 404
Appendix D
Common Error Messages in Python 407
Glossary 411
About the Author 421
Topics Covered In This Chapter:
Hello! This is a book that will teach you how to program by showing you how to create
computer games. Once you learn how the games in this book work, you'll be able to create
your own games. All you'll need is a computer, some software called the Python
Interpreter, and this book. The software you'll need is free and you can download it from
the Internet.
When I was a kid, I found a book like this that taught me how to write my first programs
and games. It was fun and easy. Now as an adult, I still have fun programming computers,
and I get paid for it. But even if you don't become a computer programmer when you grow
up, programming is a useful and fun skill to have.
Computers are very useful machines. The good news is that learning to program a
computer is easy. If you can read this book, you can program a computer. A computer
program is just a bunch of instructions run by a computer, just like a storybook is just a
whole bunch of sentences read by the reader.
These instructions are like the turn-by-turn instructions you might get for walking to a
friend's house. (Turn left at the light, walk two blocks, keep walking until you find the first
blue house on the right.) The computer follows each instruction that you give it in the order
that you give it. Video games are themselves nothing but computer programs. (And very
1
fun computer programs!)
In this book, any words you need to know will look like this. For example, the word
"program" is defined in the previous paragraph.
In order to tell a computer what you want it to do, you write a program in a language that
the computer understands. The programming language this book teaches is named Python.
There are many different programming languages including BASIC, Java, Python, Pascal,
Haskell, and C++ (pronounced, "c plus plus").
When I was a kid most people learned to program in BASIC as their first language. But
new programming languages have been invented since then, including Python. Python is
even easier to learn than BASIC and it's a serious programming language used by
professional computer programmers. Many adults use Python in their work (and when
programming just for fun).
The first few games we'll create together in this book will probably seem simple
compared to the games you've played on the Xbox, Playstation, or Wii. They don't have
fancy graphics or music but that's because they're meant to teach you the basics. They're
purposely simple so that we can focus on learning to program. Games don't have to be
complicated to be fun. Hangman, Tic Tac Toe, and making secret codes are simple to
program but are also fun.
We'll also learn how to make the computer solve some math problems in the Python
shell. (Don't worry if you don't know a lot of mathematics. If you know how to add and
multiply, you know enough math to do programming. Programming is more about problem
solving in general than it is about solving math problems.)
Because we'll be writing our games in the Python language, we need to download Python
first, from the official website of the Python programming language,
http://www.python.org
I'm going to give you instructions for installing Python on Microsoft Windows, not
because that's my favorite operating system but because chances are that's the operating
system that your computer is running. You might want the help of someone else to
download and install the Python software.
When you get to python.org, you should see a list of links on the left (About, News,
Documentation, Download, and so on.) Click on the Download link to go to the download
2
1 - Installing Python
Some chapters also show the complete source code of the game, but remember: you don't
have to enter every line of code right now. Instead, you can read the chapter first to
understand what each line of code does and then try entering it later.
You can also download the source code file from this book's website. Go to the URL
http://inventwithpython.com/source and follow the instructions to download the source
code file.
You do not need to type the "9." on the left side, or the space that immediately follows it.
Just type it like this:
Those numbers are only used so that this book can refer to specific lines in the code.
They are not a part of the actual program.
Aside from the line numbers, be sure to enter the code exactly as it appears. Notice that
some of the lines don't begin at the leftmost edge of the page, but are indented by four or
eight spaces. Be sure to put in the correct number of spaces at the start of each line. (Since
each character in IDLE is the same width, you can count the number of spaces by counting
the number of characters above or below the line you're looking at.)
For example, you can see that the second line is indented by four spaces because the four
characters ("whil") on the line above are over the indented space. The third line is
indented by another four spaces (the four characters, "if n" are above the third line's
indented space):
5
while guesses < 10:
if number == 42:
print('Hello')
Some lines of code are too long to fit on one line on the page, and the text of the code
will wrap around to the next line. When you type these lines into the file editor, enter the
code all on one line without pressing Enter.
You can tell when a new line starts by looking at the line numbers on the left side of the
code. For example, the code below has only two lines of code, even though the first line
wraps around:
Some of the games in this book are a little long. Although it is very helpful to learn
Python by typing out the source code for these games, you may accidentally make typos
that cause your game programs to crash. It may not be obvious where the typo is.
You can copy and paste the text of your source code to the online diff tool on the book's
website. The diff tool will show any differences between the source code in the book and
the source code you've typed. This is an easy way of finding any typos in your program.
Copying and pasting text is a very useful computer skill, especially for computer
programming. There is a video tutorial on copying and pasting at this book's website at
http://inventwithpython.com/videos/.
Summary
This chapter has helped you get started with the Python software by showing you the
python.org website where you can download it for free. After installing and starting the
Python IDLE software, we will be ready to learn programming starting in the next chapter.
7
Topics Covered In This Chapter:
Before we start writing computer games, we should learn some basic programming
concepts first. These concepts are values, operators, expressions, and variables. We won't
start programming in this chapter, but knowing these concepts and the names of things will
make learning to program much easier. This is because most programming is built on only
a few simple concepts combined together to make advanced programs.
8
2 - The Interactive Shell
This is like how a cat is a type of pet, but not all pets are cats. Someone could have a pet
dog or a pet lizard. An expression is made up of values (such as integers like 8 and 6)
connected by an operator (such as the * multiplication sign). A single value by itself is also
considered an expression.
In the next chapter, we will learn about working with text in expressions. Python isn't
limited to just numbers. It's more than just a fancy calculator!
Evaluating Expressions
When a computer solves the expression 10 + 5 and gets the value 15, we say it has
evaluated the expression. Evaluating an expression reduces the expression to a single
value, just like solving a math problem reduces the problem to a single number: the answer.
The expressions 10 + 5 and 10 + 3 + 2 have the same value, because they both
evaluate to 15. Even single values are considered expressions: The expression 15 evaluates
to the value 15.
However, if you just type 5 + into the interactive shell, you will get an error message.
>>> 5 +
SyntaxError: invalid syntax
This may not seem important, but a lot of computer programming is not just telling the
computer what to do, but also knowing exactly how to tell the computer to do it.
Expressions can also contain other expressions. For example, in the expression 2 + 5
+ 8, the 2 + 5 part is its own expression. Python evaluates 2 + 5 to 7, so the original
expression becomes 7 + 8. Python then evaluates this expression to 15.
Think of an expression as being a stack of pancakes. If you put two stacks of pancakes
together, you still have a stack of pancakes. And a large stack of pancakes can be made up
of smaller stacks of pancakes that were put together. Expressions can be combined together
to form larger expressions in the same way. But no matter how big an expression is it also
evaluates to a single answer, just like 2 + 5 + 8 evaluates to 15.
11
Other documents randomly have
different content
The Project Gutenberg eBook of Henry James
at Work
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Language: English
II
III
The method adopted for full-length novels was very different. With a
clear run of 100,000 words or more before him, Henry James always
cherished the delusive expectation of being able to fit his theme
quite easily between the covers of a volume. It was not until he was
more than half way through that the problem of space began to be
embarrassing. At the beginning he had no questions of compression
to attend to, and he "broke ground," as he said, by talking to himself
day by day about the characters and construction until the persons
and their actions were vividly present to his inward eye. This
soliloquy was of course recorded on the typewriter. He had from far
back tended to dramatize all the material that life gave him, and he
more and more prefigured his novels as staged performances,
arranged in acts and scenes, with the characters making their
observed entrances and exits. These scenes he worked out until he
felt himself so thoroughly possessed of the action that he could
begin on the dictation of the book itself—a process which has been
incorrectly described by one critic as re-dictation from a rough draft.
It was nothing of the kind. Owners of the volumes containing The
Ivory Tower or The Sense of the Past have only to turn to the Notes
printed at the end to see that the scenario dictated in advance
contains practically none of the phrases used in the final work. The
two sets of Notes are a different and a much more interesting
literary record than a mere draft. They are the framework set up for
imagination to clothe with the spun web of life. But they are not
bare framework. They are elaborate and abundant. They are the
kind of exercise described in The Death of the Lion as "a great
gossiping eloquent letter—the overflow into talk of an artist's
amorous design." But the design was thus mapped out with the
clear understanding that at a later stage and at closer quarters the
subject might grow away from the plan. "In the intimacy of
composition pre-noted proportions and arrangements do most
uncommonly insist on making themselves different by shifts and
variations, always improving, which impose themselves as one goes
and keep the door open always to something more right and more
related. It is subject to that constant possibility, all the while, that
one does pre-note and tentatively sketch."[1]
The preliminary sketch was seldom consulted after the novel began
to take permanent shape, but the same method of "talking out" was
resorted to at difficult points of the narrative as it progressed, always
for the sake of testing in advance the values of the persons involved
in a given situation, so that their creator should ensure their right
action both for the development of the drama and the truth of their
relations to each other. The knowledge of all the conscious motives
and concealments of his creatures, gained by unwearied observation
of their attitudes behind the scenes, enabled Henry James to exhibit
them with a final confidence that dispensed with explanations.
Among certain stumbling blocks in the path of the perfect
comprehension of his readers is their uneasy doubt of the sincerity
of the conversational encounters recorded. Most novelists provide
some clue to help their readers to distinguish truth from falsehood,
and in the theatre, although husbands and wives may be deceived
by lies, the audience is usually privy to the plot. But a study of the
Notes to The Ivory Tower will make it clear that between the people
created by Henry James lying is as frequent as among mortals and
not any easier to detect.
For the volumes of memories, A Small Boy and Others, Notes of a
Son and Brother, and the uncompleted Middle Years, no preliminary
work was needed. A straight dive into the past brought to the
surface treasure after treasure, a wealth of material which became
embarrassing. The earlier book was begun in 1911, after Henry
James had returned from a year in the United States, where he had
been called by his brother's fatal illness. He had come back, after
many seasons of country solitude, to his former love of the friendly
London winter, and for the first few months after his return from
America he lodged near the Reform Club and came to the old house
in Chelsea where I was living and where he had taken a room for his
work. It was a quiet room, long and narrow and rather dark—he
used to speak of it as "my Chelsea cellar." There he settled down to
write what, as he outlined it to me, was to be a set of notes to his
brother William's early letters, prefaced by a brief account of the
family into which they were both born. But an entire volume of
memories was finished before bringing William to an age for writing
letters, and A Small Boy came to a rather abrupt end as a result of
the writer's sudden decision that a break must be made at once if
the flood of remembrance was not to drown his pious intention.
It was extraordinarily easy for him to recover the past; he had
always been sensitive to impressions and his mind was stored with
records of exposure. All he had to do was to render his sense of
those records as adequately as he could. Each morning, after
reading over the pages written the day before, he would settle down
in a chair for an hour or so of conscious effort. Then, lifted on a
rising tide of inspiration, he would get up and pace up and down the
room, sounding out the periods in tones of resonant assurance. At
such times he was beyond reach of irrelevant sounds or sights.
Hosts of cats—a tribe he usually routed with shouts of execration—
might wail outside the window, phalanxes of motor-cars bearing
dreaded visitors might hoot at the door. He heard nothing of them.
The only thing that could arrest his progress was the escape of the
word he wanted to use. When that had vanished he broke off the
rhythmic pacing and made his way to a chimney-piece or book-case
tall enough to support his elbows while he rested his head in his
hands and audibly pursued the fugitive.
[1]The Ivory Tower (Collini, 1917), p. 341.
IV
But the legitimate business of revision was, for Henry James, neither
substitution nor re-arrangement. It was the demonstration of values
implicit in the earlier work, the retrieval of neglected opportunities
for adequate "renderings. It was," as he explained in his final
preface, "all sensibly, as if the clear matter being still there, even as
a shining expanse of snow spread over a plain, my exploring tread,
for application to it, had quite unlearned the old pace and found
itself naturally falling into another, which might sometimes more or
less agree with the original tracks, but might most often, or very
nearly, break the surface at other places. What was thus
predominantly interesting to note, at all events, was the high
spontaneity of these deviations and differences, which become thus
things not of choice but of immediate and perfect necessity:
necessity to the end of dealing with the quantities in question at all."
On every page the act of re-reading became automatically one with
the act of re-writing, and the revised parts are just "those rigid
conditions of re-perusal, registered; so many close notes, as who
should say, on the particular vision of the matter itself that
experience had at last made the only possible one." These are words
written with the clear confidence of the artist who, in complete
possession of his "faculties," had no need to bother himself with
doubts as to his ability to write better at the end of a lifetime of hard
work and varied experience than at the beginning. He knew he could
write better. His readers have not always agreed with his own view.
They have denounced the multiplication of qualifying clauses, the
imposition of a system of punctuation which, although rigid and
orderly, occasionally fails to act as a guide to immediate
comprehension of the writer's intention, and the increasing passion
for adverbial interpositions. "Adjectives are the sugar of literature
and adverbs the salt," was Henry James's reply to a criticism which
once came to his ears.
It must be admitted that the case for the revised version relies on
other merits than simplicity or elegance to make its claim good. It is
not so smooth, nor so easy, nor, on the whole, so pretty as the older
form. But it is nearly always richer and more alive. Abstractions give
place to sharp definite images, loose vague phrases to close-locked
significances. We can find a fair example of this in The Madonna of
the Future, a tale first published in 1879. In the original version one
of the sentences runs: "His professions, somehow, were all half
professions, and his allusions to his work and circumstances left
something dimly ambiguous in the background." In the New York
Edition this has become: "His professions were practically somehow,
all masks and screens, and his personal allusions as to his
ambiguous background mere wavings of the dim lantern." In some
passages it would be hard to deny a gain of beauty as well as of
significance. There is, for instance, a sentence in the earlier account
of Newman's silent renunciation of his meditated revenge, in the
Cathedral of Notre Dame: "He sat a long time; he heard far-away
bells chiming off, at long intervals, to the rest of the world." In the
definitive edition of The American the passage has become: "He sat
a long time; he heard far-away bells chiming off into space, at long
intervals, the big bronze syllables of the Word."
A paragraph from Four Meetings, a tale worked over with extreme
care, will give a fair idea of the general effect of the revision. It
records a moment of the final Meeting, when the helplessly
indignant narrator is watching poor Caroline ministering to the vulgar
French cocotte who has imposed herself on the hospitality of the
innocent little New Englander.
"At this moment," runs the passage of 1879, "Caroline Spencer came
out of the house bearing a coffee pot on a little tray. I noticed that
on her way from the door to the table she gave me a single quick
vaguely appealing glance. I wondered what it signified; I felt that it
signified a sort of half-frightened longing to know what, as a man of
the world who had been in France, I thought of the Countess. It
made me extremely uncomfortable. I could not tell her that the
Countess was very possibly the runaway wife of a little hairdresser. I
tried, suddenly, on the contrary, to show a high consideration for
her."
The "particular vision" registered on re-perusal reveals states of
mind much more definite than these wonderings and longings and
vague appeals.
"Our hostess moreover at this moment came out of the house,
bearing a coffee-pot and three cups on a neat little tray. I took from
her eyes, as she approached us, a brief but intense appeal—the
mute expression, as I felt, conveyed in the hardest little look she had
yet addressed me, of her longing to know what as a man of the
world in general and of the French world in particular, I thought of
these allied forces now so encamped on the stricken field of her life.
I could only 'act,' however, as they said at North Verona, quite
impenetrably—only make no answering sign. I couldn't intimate,
much less could I frankly utter, my inward sense of the Countess's
probable past, with its measure of her virtue, value and
accomplishments, and of the limits of consideration to which she
could properly pretend. I couldn't give my friend a hint of how I
myself personally 'saw' her interesting pensioner—whether as the
runaway wife of a too-jealous hairdresser or of a too-morose pastry-
cook, say; whether as a very small bourgeoise, in fine, who had
vitiated her case beyond patching up, or even some character of the
nomadic sort, less edifying still. I couldn't let in, by the jog of a
shutter, as it were, a hard informing ray and then, washing my
hands of the business, turn my back for ever. I could on the contrary
but save the situation, my own at least, for the moment, by pulling
myself together with a master hand and appearing to ignore
everything but that the dreadful person between us was a 'grande
dame.'"
Anyone genuinely interested in "the how and the whence and the
why these intenser lights of experience come into being and insist
on shining," will find it a profitable exercise to read and compare the
old and the new versions of any of the novels or tales first published
during the 'seventies or 'eighties. Such a reader will be qualified to
decide for himself between the opinion of a bold young critic that "all
the works have been subjected to a revision which in several cases,
notably Daisy Miller and Four Meetings, amounts to their ruin," and
their writer's confidence that "I shouldn't have breathed upon the
old catastrophes and accidents, the old wounds and mutilations and
disfigurements wholly in vain. . . . I have prayed that the finer air of
the better form may sufficiently seem to hang about them and gild
them over—at least for readers, however few, at all curious of
questions of air and form."
VI
VII
Many men whose prime business is the art of writing find rest and
refreshment in other occupations. They marry, or they keep dogs,
they play golf or bridge, they study Sanskrit or collect postage
stamps. Except for a period of ownership of a dachshund, Henry
James did none of these things. He lived a life consecrated to the
service of a jealous, insatiable, and supremely rewarding goddess,
and all his activities had essential reference to that service. He had a
great belief in the virtues of air and exercise, and he was expert at
making a walk of two or three miles last for as many hours by his
habit of punctuating movement with frequent and prolonged halts
for meditation or conversation. He liked the exhilaration of driving in
a motor-car, which gave him, he said, "a sense of spiritual
adventure." He liked a communicative companion. Indeed the
cultivation of friendships may be said to have been his sole
recreation. To the very end of his life he was quick to recognize
every chance of forming a friendly relation, swift to act on his
recognition, and beautifully ready to protect and nourish the warm
life of engendered affection. His letters, especially those written in
his later years, are more than anything else great generous gestures
of remembrance, gathering up and embracing his correspondents
much as his talk would gather up his hearers and sweep them along
on a rising flood of eloquence.
But that fine capacity for forming and maintaining a "relation"
worked, inevitably, within definite limits. He was obliged to create
impassable barriers between himself and the rest of mankind before
he could stretch out his eager hands over safe walls to beckon and
to bless. He loved his friends, but he was condemned by the law of
his being to keep clear of any really entangling net of human
affection and exaction. His contacts had to be subordinate, or indeed
ancillary, to the vocation he had followed with a single passion from
the time when, as a small boy, he obtained a report from his tutor as
showing no great aptitude for anything but a felicitous rendering of
La Fontaine's fables into English. Nothing could be allowed to
interfere for long with the labour from which Henry James never
rested, unless perhaps during sleep. When his "morning stint of
inventive work" was over, he went forth to the renewed assault of
the impressions that were always lying in wait for him. He was
perpetually and mercilessly exposed, incessantly occupied with the
task of assimilating his experience, freeing the pure workable metal
from the base, remoulding it into new beauty with the aid of every
device of his craft. He used his friends not, as some incompletely
inspired artists do, as in themselves the material of his art, but as
the sources of his material. He took everything they could give and
he gave it back in his books. With this constant preoccupation, it
was natural that the people least interesting to him were the
comparatively dumb. To be "inarticulate" was for him the cardinal
social sin. It amounted to a wilful withholding of treasures of alien
experience. And if he could extract no satisfaction from
contemplating the keepers of golden silence, he could gain little
more from intercourse with the numerous persons he dismissed from
his attention as "simple organisms." These he held to be mere waste
of any writer's time, and it was characteristic that his constant
appreciation of the works of Mrs. Wharton was baffled by the
popularity of Ethan Frome, because he considered that the gifted
author had spent her labour on creatures too easily comprehensible
to be worth her pains. He greatly preferred The Reef, where, as he
said, "she deals with persons really fine and complicated."
We might arrive at the same conclusion from a study of the prefaces
to the New York Edition. More often than not, the initial idea for a
tale came to Henry James through the medium of other people's
talk. From a welter of anecdote he could unerringly pick out the
living nucleus for a reconstructed and balanced work of art. His
instinct for selection was admirable, and he could afford to let it
range freely among a profusion of proffered subjects, secure that it
would alight on the most promising. But he liked to have the
subjects presented with a little artful discrimination, even in the first
instance. He was dependent on conversation, but it must be
educated and up to a point intelligent conversation. There is an early
letter written from Italy in 1874, in which he complains of having
hardly spoken to an Italian creature in nearly a year's sojourn, "save
washerwomen and waiters. This, you'll say, is my own stupidity," he
continues, "but granting this gladly, it proves that even a creature
addicted as much to sentimentalizing as I am over the whole mise
en scène of Italian life, doesn't find an easy initiation into what lies
behind it. Sometimes I am overwhelmed with the pitifulness of this
absurd want of reciprocity between Italy itself and all my rhapsodies
about it." Other wanderers might have found more of Italy in
washerwomen and waiters, here guaranteed to be the true native
article, than in all the nobility of Rome or the Anglo-Americans of
Venice, but that was not Henry James's way. For him neither pearls
nor diamonds fell from the lips of waiters and washerwomen, and
princesses never walked in his world disguised as goosegirls.
Friendships are maintained by the communication of speech and
letters. Henry James was a voluminous letter-writer and exhaustively
communicative in his talk upon every subject but one, his own work,
which was his own real life. It was not because he was indifferent to
what people thought of his books that he evaded discussion about
them. He was always touched and pleased by any evidence that he
had been intelligently read, but he never went a step out of his way
to seek this assurance. He found it safest to assume that nobody
read him, and he liked his friends none the worse for their
incapacity. Meanwhile, the volumes of his published works—visible,
palpable, readable proof of that unceasing travail of the creative
spirit which was always labouring behind the barrier of his silence—
piled themselves up year after year, to be dropped on to the tables
of booksellers and pushed on to the shelves of libraries, to be
bought and cherished by the faithful, ignored by the multitude, and
treated as a test of mental endurance by the kind of person who
organized the Browning Society. Fortunately for literature, Henry
James did not lend himself to exploitation by any Jacobean Society.
Instead of inventing riddles for prize students, he scattered about his
pages a number of pregnant passages containing all the clues that
are needed for keeping up with him. It was his theory that if readers
didn't keep up with him—as they admittedly didn't always—the fault
was entirely in their failure of attention. There are revelations in his
books, just as he declared them to be in the works of Neil Paraday.
"Extract the opinion, disengage the answer—these are the real acts
of homage."
VIII
IX
Henry James came to England to admire. But his early reverence for
the men and women of an island with so fine and ancient a historic
tone as Great Britain soon faded. He had forgotten, in the first
passion of acquaintance, that the English are born afresh in every
generation and are about as new as young Americans, differing from
them chiefly in having other forms of domestic and ecclesiastical
architecture and smoother lawns to take for granted. He looked at
old stone castles and Tudor brickwork, at great hanging eaves and
immemorial gardens, and then he looked at the heirs of this heritage
and listened intently for their speech. This was disappointing, partly
because they spoke so little. "I rarely remember," he wrote when he
had lived through several London months, "to have heard on English
lips any other intellectual verdict (no matter under what provocation)
than this broad synthesis 'so immensely clever.' What exasperates
you is not that they can't say more but that they wouldn't if they
could."
How different was this inarticulate world from the fine civilization of
Boston, from the cultivated circle that gathered round Charles Eliot
Norton at Shady Hill. To that circle he appealed for sympathy,
complaining that he was "sinking into dull British acceptance and
conformity. . . . I am losing my standard—my charming little
standard that I used to think so high; my standard of wit, of grace,
of good manners, of vivacity, of urbanity, of intelligence, of what
makes an easy and natural style of intercourse! And this in
consequence of having dined out during the past winter 107 times!"
Great men, or at the least men with great names, swam into his ken
and he condemned them. Ruskin was "weakness pure and simple."
In Paris he found that he could "easily—more than easily—see all
round Flaubert intellectually." A happy Sunday evening at Madame
Viardot's provoked a curious reflection on the capacity of celebrated
Europeans to behave absurdly and the incapacity of celebrated
Americans to indulge in similar antics. "It was both strange and
sweet to see poor Turgenev acting charades of the most extravagant
description, dressed out in old shawls, and masks, going on all fours,
etc. The charades are their usual Sunday evening occupation and
the good faith with which Turgenev, at his age and with his glories,
can go into them is a striking example of the truth of that
spontaneity which Europeans have and we have not. Fancy
Longfellow, Lowell, or Charles Norton doing the like and every
Sunday evening!"
Whether or not all celebrated Americans behave with invariable
decorum, the astonished spectator of Turgenev's performance had
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.
ebookname.com