Instant Access to (Ebook) Animated Program Design: Intermediate Program Design Using Video Game Development by Marco T. Morazán ISBN 9783031043161, 3031043162 ebook Full Chapters
Instant Access to (Ebook) Animated Program Design: Intermediate Program Design Using Video Game Development by Marco T. Morazán ISBN 9783031043161, 3031043162 ebook Full Chapters
com
https://ebooknice.com/product/animated-program-design-
intermediate-program-design-using-video-game-
development-46255158
OR CLICK HERE
DOWLOAD EBOOK
https://ebooknice.com/product/video-game-design-51645070
ebooknice.com
https://ebooknice.com/product/gpu-parallel-program-development-using-
cuda-6864970
ebooknice.com
https://ebooknice.com/product/fundamentals-of-structured-program-
design-33127216
ebooknice.com
(Ebook) 66 Strategies to Program Design by Stephane
Cazeault ISBN 9781534684621, 153468462X
https://ebooknice.com/product/66-strategies-to-program-design-23696630
ebooknice.com
ebooknice.com
https://ebooknice.com/product/c-programming-program-design-including-
data-structures-7350326
ebooknice.com
https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-2444624
ebooknice.com
Texts in Computer Science
Series Editors
David Gries, Department of Computer Science, Cornell University, Ithaca, NY, USA
Orit Hazzan , Faculty of Education in Technology and Science, Technion—Israel
Institute of Technology, Haifa, Israel
Titles in this series now included in the Thomson Reuters Book Citation Index!
‘Texts in Computer Science’ (TCS) delivers high-quality instructional content
for undergraduates and graduates in all areas of computing and information science,
with a strong emphasis on core foundational and theoretical material but inclusive
of some prominent applications-related content. TCS books should be reasonably
self-contained and aim to provide students with modern and clear accounts of top-
ics ranging across the computing curriculum. As a result, the books are ideal for
semester courses or for individual self-study in cases where people need to expand
their knowledge. All texts are authored by established experts in their fields, re-
viewed internally and by the series editors, and provide numerous examples, prob-
lems, and other pedagogical tools; many contain fully worked solutions.
The TCS series is comprised of high-quality, self-contained books that have
broad and comprehensive coverage and are generally in hardback format and some-
times contain color. For undergraduate textbooks that are likely to be more brief and
modular in their approach, require only black and white, and are under 275 pages,
Springer offers the flexibly designed Undergraduate Topics in Computer Science
series, to which we refer potential authors.
Marco T. Morazán
Animated
Program Design
Intermediate Program Design
Using Video Game Development
Marco T. Morazán
Department of Computer Science
Seton Hall University
South Orange, NJ, USA
© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland
AG 2022
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether
the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse
of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and
transmission or information storage and retrieval, electronic adaptation, computer software, or by similar
or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication
does not imply, even in the absence of a specific statement, that such names are exempt from the relevant
protective laws and regulations and therefore free for general use.
The publisher, the authors, and the editors are safe to assume that the advice and information in this book
are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or
the editors give a warranty, expressed or implied, with respect to the material contained herein or for any
errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
This Springer imprint is published by the registered company Springer Nature Switzerland AG
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
To my students for educating me on how
to teach problem solving and program
design.
Marco
Preface
Everybody engages in problem solving, and this book is about the science
of problem solving. It aims to teach its readers a new way of thinking about
designing solutions to problems that takes them beyond trial-and-error think-
ing. Trial and error is, indeed, a fundamental problem-solving technique but
must be tightly coupled with design to be effectively used. Trials or exper-
iments must be thought out and planned. What does this mean? It means
that problem solvers must engage in careful and thorough consideration of
the different options they have to solve a problem. Problem-solving tech-
niques must be used appropriately, and different solutions to a problem must
be evaluated to choose the best one. The evaluation of a solution is done
both mathematically and empirically. That is, theory and practice play a
pivotal role in problem solving. Rest assured that the problem-solving and
programming techniques you learn may be used to solve problems using any
programming language.
This textbook continues the journey started in Animated Problem Solv-
ing and completes a year-long (two semesters) curriculum for first-year stu-
dents. Readers of this book are likely to be familiar with writing expressions,
defining data, divide and conquer, iterative design, designing functions using
structural recursion, abstraction and abstract functions, and even distributed
programming. Indeed, you are likely to already be very powerful problem
solvers and programmers. Now it is time to become even more powerful pro-
grammers. How is this achieved? This book aids this quest by exploring with
you new types of recursion, by introducing you to the use of randomness,
by taking the first steps into experimental Computer Science and algorithm
analysis, by taking a peek into Artificial Intelligence, and by presenting a dis-
ciplined approach to the use of mutation—also known as assignment which
is routinely abused and misused every day giving rise to the majority of
programming bugs today.
At the heart of this exploration is the design recipe—the steps to go from a
problem statement to a working and tested solution. The new design recipes
studied in this textbook are less prescriptive than those used for solutions
vii
viii Preface
based on structural recursion. In this regard, they are akin to the design
recipe for distributed programming found in Animated Problem Solving. One
of the most attractive features of structural recursion is that it suggests how
to divide and conquer a problem. For example, structural recursion suggests
that solving a problem for a nonleaf binary tree is done by solving the same
problem for the left and/or right subtrees. In contrast, heap sorting, an ef-
ficient sorting algorithm studied in this textbook, creates a new binary tree
to solve the problem. In essence, there is no prescriptive design recipe for
divide and conquer when structural recursion is not used. In such cases, a
problem solver must rely on insights gained from problem analysis to per-
form divide and conquer. An interesting and powerful consequence is that
a solution to a problem using structural recursion may be refined/improved
based on insights gained to use other forms of recursion.
You may already have butterflies in your stomach anticipating a wealth
of knowledge from the pages of this book. If that is the case, then you are
on your way. Enthusiasm for knowledge and understanding is essential for a
problem solver. Problem solving, however, can and ought to also be fun. To
this end, this book promises to design and implement a video game using
modern Artificial Intelligence techniques with you. To achieve this, however,
there is a great deal about problem solving and programming you must learn.
The game is developed using iterative refinement. That is, as your problem
solving and programming knowledge grows, improved versions of the game
are developed. Buckle up for fascinating and fun journey to expand your
mind!
The book is divided into four parts. Part I presents introductory material.
It starts by reviewing the basic steps of a design recipe. It does so using
a problem solved using structural recursion on a list. It then proceeds to
review code refactoring—the restructuring of a function without changing its
external behavior. Refactoring is a common technique used to refine programs
when a better or more elegant way is found to solve a problem. For example, a
problem involving a list may be solved using structural recursion and explicit
use of first and rest. The solution may be refactored to eliminate low-
level functions like first and rest by using a match expression. In turn,
this solution may be refactored to eliminate recursive calls by using abstract
functions like map and filter. Part I then moves to review abstract running
time. In addition, this part introduces the N-Puzzle problem—the video game
developed throughout the book—and introduces the use of randomness in
problem solving.
Part II explores a new type of recursion called generative recursion. In-
stead of exploiting the structure of the data to make recursive calls, this
Preface ix
type of recursion creates new instances of the data to make recursive calls.
The study of generative recursion navigates the reader through examples
involving fractal image generation, efficient sorting, and efficient searching
techniques such as binary, depth-first, and breadth-first search. This part
concludes presenting two refinements to the N-Puzzle game using generative
recursion and the problems that they have including the loss of knowledge.
Throughout, complexity analysis and empirical experimentation are used to
evaluate solutions.
Part III explores a new type of recursion called accumulative (or accumula-
tor) recursion. Accumulative recursion introduces one or more accumulators
to a function designed using structural or generative recursion. Accumulators
are used to solve the loss of knowledge problem or to make programs more ef-
ficient. Examples used include finding a path in a graph, improving insertion
sorting, and list-folding operations. The study of list-folding operations leads
to new abstract functions with an accumulator: foldl and foldr. The ex-
pertise developed using accumulative recursion is used to refine the N-Puzzle
game to perform a heuristic search using the A∗ algorithm—an algorithm
used in Artificial Intelligence. Part III ends with a chapter introducing an
important and powerful program transformation called continuation-passing
style. Continuation-passing style allows programmers and compilers to opti-
mize programs. Throughout, complexity analysis and empirical experimen-
tation are used to evaluate solutions.
Part IV explores mutation. Mutation (or changing the value of a state
variable) allows different parts of a program that do not call each other to
share values. Interestingly enough, most textbooks on programming that use
mutation fail to mention this. Abstracting over state variables leads to inter-
faces and object-oriented programming. The use of mutation, however, comes
at a heavy price: the loss of referential transparency. That is, (f x) is not
always equal to (f x). This means programmers must be disciplined about
the order in which mutations are done because knowing that a program works
is suddenly much harder. To aid you in properly sequencing mutations, this
part of the book teaches you about Hoare Logic and program correctness.
In addition, it introduces vectors, vector processing, and in-place operations.
Part IV ends by presenting a solution to the chicken or egg paradox in pro-
gramming. Throughout, complexity analysis and empirical experimentation
are used to evaluate solutions.
2 Acknowledgments
This book is the product of over 10 years of work at Seton Hall University
building on the shoulders of giants in Computer Science and on the shoulders
of Seton Hall undergraduate CS1 and CS2 students. A heartfelt thank you is
offered to all the students that throughout the years helped me understand
x Preface
what works and does not work when teaching program design. Many of the
giants in Computer Science that have informed my teaching efforts are mem-
bers of the PLT research group, especially those responsible for developing the
student programming languages used in this textbook and for penning How to
Design Programs—an inspiration for Animated Problem Solving and for An-
imated Programming. It is impossible not to explicitly express my heart-felt
appreciation for Matthias Felleisen from Northeastern University and Shri-
ram Krishnamurthi from Brown University for having my back, for debating
with me, and for encouraging the work done at Seton Hall University—all of
which led to this textbook.
There are many other professional colleagues that deserve credit for inspir-
ing the lessons found in this textbook. Chief among them is Doug Troeger,
my Ph.D. advisor, from City College of New York (CCNY). Together, we
taught CCNY undergraduates about program correctness. Some of the ma-
terial in Part IV of this textbook is inspired by those efforts. A great deal of
the material in this textbook is based on my Computer Science Education
peer-reviewed publications. I was mostly blessed with thoughtful and con-
scientious reviewers that offered honest feedback on the good and the bad,
but that always made an effort to provide thought-provoking comments and
suggestions for future work. Collectively, they have also influenced the lessons
in this book. I am deeply appreciative to the venues that have published my
articles such as the Trends in Functional Programming in Education Work-
shop, the Journal of Functional Programming , and the Trends in Functional
Programming Symposium.
Finally, there is a gifted group of individuals that have been or still are in-
valuable in making the courses taught using the material in this textbook suc-
cessful: my undergraduate research/teaching assistants. They have been re-
sponsible for making sure I explain the material clearly and for helping answer
student questions using their own perspective on the material. This group in-
cludes: Shamil Dzhatdoyev, Josie Des Rosiers, Nicholas Olson, Nicholas Nel-
son, Lindsey Reams, Craig Pelling, Barbara Mucha, Joshua Schappel, Sachin
Mahashabde, Rositsa Abrasheva, Isabella Felix, Sena Karsavran, and Julia
"Ohio" Wilkins. Their feedback and the feedback they collected from enrolled
students have influenced every topic presented. In closing, my appreciation
goes out to Seton Hall University and its Department of Computer Science
for supporting the development of the work presented in this textbook.
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1 The Parts of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
2 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
xi
xii Contents
3 Randomness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
15 ISL+’s random Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
16 N-Puzzle Version 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
17 Generating Random Passwords . . . . . . . . . . . . . . . . . . . . . . . . 54
18 Distributed Fortune Teller Game . . . . . . . . . . . . . . . . . . . . . . . 58
18.1 Design Recipe for Distributed Computing . . . . . . . . 58
18.2 The Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
18.3 Data Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
18.4 Communication Protocol . . . . . . . . . . . . . . . . . . . . . . . 64
18.5 Marshaling and Unmarshaling Functions . . . . . . . . . 67
18.6 The Player Component . . . . . . . . . . . . . . . . . . . . . . . . 67
18.7 The Server Component . . . . . . . . . . . . . . . . . . . . . . . . 72
19 What Have We Learned in This Chapter? . . . . . . . . . . . . . . . 76
5 Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
24 Insertion Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
25 Quick Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
25.1 Problem Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
25.2 Sample Expressions and Differences . . . . . . . . . . . . . 107
25.3 Signature, Statements, and Function Header . . . . . . 109
25.4 Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
25.5 Function Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
25.6 Termination Argument . . . . . . . . . . . . . . . . . . . . . . . . 111
25.7 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
25.8 Complexity Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 111
26 Merge Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
26.1 Problem Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
26.2 The merge-sorting Function . . . . . . . . . . . . . . . . . . 115
26.3 The merge-sort-helper Function . . . . . . . . . . . . . . 117
26.4 The merge-neighs Function . . . . . . . . . . . . . . . . . . . 121
26.5 The merge Function . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Contents xiii
6 Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
28 Linear Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
28.1 Problem Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
28.2 Sample Expressions and Differences . . . . . . . . . . . . . 132
28.3 Signature, Purpose, and Function Header . . . . . . . . 134
28.4 Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
28.5 Function Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
28.6 Performance and Complexity . . . . . . . . . . . . . . . . . . . 135
29 Binary Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
29.1 The binary-search Function . . . . . . . . . . . . . . . . . . 137
29.2 The bin-search Function . . . . . . . . . . . . . . . . . . . . . . 140
29.3 Termination Argument . . . . . . . . . . . . . . . . . . . . . . . . 144
29.4 Performance and Complexity . . . . . . . . . . . . . . . . . . . 144
30 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
31 Depth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
31.1 Problem Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
31.2 Sample Expressions and Differences . . . . . . . . . . . . . 152
31.3 Signature, Purpose, and Function Header . . . . . . . . 152
31.4 Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
31.5 The Function Body . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
31.6 The node-dfs-contains? Function . . . . . . . . . . . . . 153
31.7 Signature, Purpose, and Function Definition . . . . . . 155
31.8 Performance and Complexity . . . . . . . . . . . . . . . . . . . 156
32 Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
32.1 Problem Analysis for ton-bfs-contains? . . . . . . . . 157
32.2 Sample Expressions and Differences for
ton-bfs-contains? . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
32.3 Tests for ton-bfs-contains? . . . . . . . . . . . . . . . . . . 161
32.4 Function Definition for ton-bfs-contains? . . . . . . 161
32.5 Problem Analysis for bfs-helper . . . . . . . . . . . . . . . 162
32.6 Sample Expressions and Differences
for bfs-helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
32.7 Tests for bfs-helper . . . . . . . . . . . . . . . . . . . . . . . . . . 163
32.8 Signature, Statements, and Function Definition for
bfs-helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
32.9 Performance and Complexity . . . . . . . . . . . . . . . . . . . 165
33 What Have We Learned in This Chapter? . . . . . . . . . . . . . . . 167
xiv Contents
9 Accumulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
43 Running Totals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
43.1 Problem Analysis for lon-running-totals . . . . . . 204
43.2 Sample Expressions and Differences for
lon-running-totals . . . . . . . . . . . . . . . . . . . . . . . . . . 205
43.3 Signature, Function Definition, and Tests for
lon-running-totals . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Contents xv
11 Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
53 List-Folding Operations from the Left . . . . . . . . . . . . . . . . . . . 274
53.1 Summing a List of Numbers . . . . . . . . . . . . . . . . . . . . 274
53.2 Reversing a List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
54 List-Folding Operations from the Right . . . . . . . . . . . . . . . . . 285
54.1 Computing String Lengths from a List of Strings . . 287
54.2 Summing a List of Numbers Revisited . . . . . . . . . . . 292
55 Functional Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
56 Abstraction over Left to Right Accumulating Folding
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
56.1 The Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
56.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
57 Abstraction Over Right to Left Accumulating Folding
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
58 What Have We Learned in This Chapter? . . . . . . . . . . . . . . . 301
Part IV Mutation
16 Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
87 Vector Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
88 Vector Processing Using Structural Recursion . . . . . . . . . . . . 422
88.1 The Dot Product of Two Vectors of Numbers . . . . . 423
88.2 Merging Two Sorted Vectors . . . . . . . . . . . . . . . . . . . . 427
89 Vector Processing Using Generative Recursion: Revisiting
the Sieve of Eratosthenes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
89.1 Problem Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
89.2 Signature, Statements, and Function Header . . . . . . 443
89.3 Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
89.4 Loop Invariant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
89.5 Function’s Local Definitions . . . . . . . . . . . . . . . . . . . . 446
89.6 The local-expression’s Body . . . . . . . . . . . . . . . . . . . 448
89.7 Post-Loop Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
89.8 Auxiliary Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
89.9 Termination Argument and Running Tests . . . . . . . 452
89.10 Complexity and Performance . . . . . . . . . . . . . . . . . . . 452
90 What Have We Learned in This Chapter? . . . . . . . . . . . . . . . 453
Part V Epilogue
This textbook continues the study of problem solving and program design
that began in Animated Problem Solving that exposes its readers to typed-
based programming, structural recursion, abstraction, and distributed pro-
gramming. In this textbook we move beyond structural recursion to other
forms of recursion that require insights into a problem beyond what may be
suggested by the structure of the data. We shall start, however, with a review
of the concepts needed to successfully navigate this textbook.
The basic concepts you need to be familiar with are:
• Variables
• Functions
• Design recipe
• Abstract functions (generic programming)
• Abstract running time
Variables are used to store values. A variable may be declared as a parameter
to a function or locally using a local-expression. Functions are abstractions
over similar expressions used to compute a value. Each difference among
similar expressions is captured as a function parameter. The function body
is created by choosing one of the similar expressions and substituting each
difference with the parameter that represents it. Abstraction over the types
processed by similar functions gives rise to abstract functions and generic
programming. An abstract function, therefore, may process different types of
input. For example, map and filter may be used to process a list of numbers,
a list of aliens, or a list of criminal records. Finally, abstract running time is
a measure of the number operations executed in relation to the size of the
input. It allows us to compare the efficiency of programs regardless of the
computer hardware used.
Let us review the basic concepts by developing a couple of programs. First,
we review the fundamental design recipe steps for function development. We
then illustrate the design process by developing functions to compute the
area of a triangle and to double the elements in a list of numbers.
© The Author(s), under exclusive license to Springer Nature Switzerland AG 2022 3
M. T. Morazán, Animated Program Design, Texts in Computer Science,
https://doi.org/10.1007/978-3-031-04317-8_1
4 1 The Science of Problem Solving
To design and implement a function we follow the steps of the design recipe.
A design recipe is a series of steps that take a problem solver from a prob-
lem statement to a working solution. Each step has a specific outcome that
helps others understand how a problem is solved. Remember that one of the
primary tasks of a programmer is to communicate how a problem is solved.
As you may know there are many design recipes that vary according to the
type of data that needs to be processed. Figure 1 displays a general design
recipe for functions (not specialized for any specific datatype). It contains
eight steps that may be described as follows:
Step 1 Define the types of values processed and describe how the needed
value is computed.
Step 2 Write sample expressions for computing a needed value.
Step 3 Identify the differences among the sample expressions and choose
descriptive variable names for them.
Step 4 Write the function’s signature and purpose statement.
Step 5 Write the function header using the variable names chosen in Step
3.
Step 6 Write tests illustrating the function’s expected behavior.
Step 7 Write the function’s body by substituting the differences in any
sample expression with the names chosen in Step 3.
Step 8 Run the tests and debug your design if errors or failed tests arise.
To begin consider the problem of finding the area of a triangle when the
lengths of each side are known. Figure 2 displays two triangles with known
lengths. How is the area of a triangle with known lengths computed? Heron’s
formula tells us that the area of a triangle is given by the square root of the
product of the sum of the sides divided by 2, the difference of the sum of the
sides divided by 2 and the first side, the difference of the sum of the sides
4 Computing the Area of a Triangle 5
√ √
5 4 10 10
2
3 (b) Triangle 2
(a) Triangle 1
divided by 2 and the second side, and the difference of the sum of the sides
divided by 2 and the third side.1 Let’s design and implement a function to
compute the length of a triangle following the steps of the design recipe.
For Step 1 we can observe that three positive numbers are needed as
input—one for the length of each side of a triangle. A positive number may
be defined as follows:
;; A positive number, number>0, is a number greater than 0.
Our design idea is to compute a triangle’s area using Heron’s formula. To
simplify the formulation we define the semi-perimeter, sp, of a triangle as
the sum of its lengths (s1, s2, and s3) divide by 2:
s1 + s2 + s3
sp = 2
Using sp we may formulate the area of a triangle as:
A(s1,s2,s3) = sp*(sp-s1)*(sp-s2)*(s-s3)
To satisfy Step 2 we write sample expressions to compute the areas for the
triangles displayed in Fig. 2. Following our design idea from Step 1, a local-
expression is used to define a variable for the semi-perimeter of the triangle
and, therefore, avoiding having to write the same expression repeatedly. The
sample expressions are:
;; Sample expressions for the area of a triangle
(define AREA-T1 (local [(define SP (/ (+ 3 4 5) 2))]
(sqrt (* SP (- SP 3) (- SP 4) (- SP 5)))))
1
Heron of Alexandria was a Greek mathematician and engineer that lived in Roman
Egypt c. 10–70 AD.
6 1 The Science of Problem Solving
4.1 Exercises
The first thing to note is that a list of numbers is data of arbitrary size. To
us, as problem solvers, this means that a recursive data definition is needed.
Recall that a recursive data definition must have at least two variants: one
nonrecursive and one recursive. It may, of course, have more than one of
either. We define a list of numbers as follows:
;; A list of numbers, lon, is either:
;; 1. empty
;; 2. (cons number lon)
For every data definition define sample instances. These must include at least
one instance for each variant. We may define sample lon instances as follows:
;; Sample lon
(define ELON '())
(define LON1 '(2 3 4 5))
(define LON2 '(8 -2 0))
We use a data definition to develop a template for functions that process
a lon. The template captures how the structure of a lon is exploited to solve
problems. Observe that there are two lon variants. This means that any func-
tion that processes a lon must distinguish between the variants using a con-
ditional expression. Further observe that the second variant, the nonempty
lon, contains a self-reference. This means that the rest of a nonempty lon
ought to be processed recursively. These observations allow to develop the
following template for functions on a lon:
#| Template for functions on a lon
;; lon . . . → . . .
;; Purpose:
(define (f-on-lon a-lon . . .)
(if (empty? a-lon)
...
. . .(first a-lon). . .(f-on-lon (rest a-lon))))
The sample expressions use concrete values to illustrate how the answer for
the lon varieties is computed. Following our design idea we may define sample
expressions as follows:
;; Sample expressions for lon-double
(define DOUBLE-ELON '())
(define DOUBLE-LON1 (cons (* 2 (first LON1))
(lon-double (rest LON1))))
(define DOUBLE-LON2 (cons (* 2 (first LON2))
(lon-double (rest LON2))))
Observe that we are faithful to the design idea. If the empty lon is doubled,
the answer is the empty list. Otherwise, a new list is created using the value
of doubling the first element and the value of doubling the rest of the list.
10 1 The Science of Problem Solving
The differences among sample expressions are done by variant. For the empty
lon there are no differences because the answer is always the empty list. For
the nonempty we observe there is only one difference: the lon processed.
This analysis informs us that our function only needs the lon to process
as input. Put differently, the function only needs one parameter of type lon.
A descriptive name for this variable is a-lon.
We have determined that the only parameter must be a lon. It is not difficult
to see that the returned value is also a lon. Given that a single input value
is needed the function header only requires a single parameter. Finally, it is
highly advisable to pick a descriptive function name. Do not forget that a
primary goal of programming is to communicate how a problem is solved. De-
scriptive function names help readers of our code to understand each function.
We shall use the descriptive function name lon-double for our function.
The above analysis allows us to write the following signature, purpose
statement, and function header:
;; lon → lon
;; Purpose: Double the numbers in the given list of numbers
(define (lon-double a-lon)
The tests must cover all variants of the data being processed. Whenever
possible start by writing tests using sample computations. These use lon
sample instances and the values of sample expressions. We write the following
tests using sample computations:
;; Tests using sample computations
(check-expect (lon-double ELON) DOUBLE-ELON)
(check-expect (lon-double LON1) DOUBLE-LON1)
(check-expect (lon-double LON2) DOUBLE-LON2)
The test using sample values, on the other hand, is not based on the sample
expressions. Instead, concrete values are used to illustrate that the function
works. We may write the following tests using sample values:
5 Doubling a List of Numbers 11
2
The sample expression for DOUBLE-LON2 works equally well.
12 1 The Science of Problem Solving
;; Sample lon
(define ELON ())
(define LON1 (2 3 4 5))
(define LON2 (8 -2 0))
;; lon → lon
;; Purpose: Double the numbers in the given list of numbers
(define (lon-double a-lon)
(if (empty? a-lon)
()
(cons (* 2 (first a-lon)) (lon-double (rest a-lon)))))
5.8 Exercises
5 Design and implement a function to return the posn furthest away from
the origin in a given list of posn.
6 Design and implement a function to add all the whole numbers in the
interval [a..b], where a and b are whole numbers.
6 Code Refactoring
signature and purpose remain unchanged. You may run the tests and they
will all pass. Most code readers familiar with abstract functions would argue
that this solution is more elegant and easier to understand. This means that
this solution is superior because it better communicates how the problem is
solved.
Alternatively, lon-double may be refactored to eliminate the use of list
selectors by introducing local variables for the components of a list. This
may be achieved using a match-expression. Recall that a match-expression
dispatches on the type of the data processed. To process a list of numbers two
stanzas are needed: one for each lon variant. The stanza for the nonempty
lon allows us to introduce local variables for its components. We can refactor
lon-double as follows:
;; lon → lon
;; Purpose: Double the numbers in the given list of numbers
(define (lon-double a-lon)
(match a-lon
['() '()]
[(cons frst rst) (cons (* 2 frst) (lon-double rst))]))
Observe that low-level selectors like first and rest are not utilized. Instead
two local variables, frst and rst, are declared for the first element and the
rest of the elements of a nonempty list. Unlike the refactored version using
map, in this version of the function the use of structural recursion is explicit.
A local variable for the elements of a list may also be introduced by refac-
toring lon-double to use a for-loop. The use of for-loops allows us to
declare variables for sequences of values. The for-loop iterates through the
sequences to compute a result. For lon-double there is only one sequence of
values of interest: the elements of the given lon. As before, the elements of
the sequence must be doubled to create the solution list. We can also refactor
lon-double as follows:
;; lon → lon
;; Purpose: Double the numbers in the given list of numbers
(define (lon-double a-lon)
(for/list ([a-num a-lon]) (* 2 a-num)))
The local variable a-num is used to capture each element of the sequence
defined by the elements of a-lon. The loop, for/list, creates a list of the
results obtained from evaluating the loop’s body, (* 2 a-num), as the se-
quence is traversed.
7 Abstract Running Time 15
6.1 Exercises
Abstract running time relates a function’s input size with the number of
abstract steps needed to solve the problem. We say abstract steps because we
do not count the actual number of computer operations performed. Instead,
we count the number of general steps taken like the number of function calls
or the number of comparisons made. Naturally, you are probably wondering
why we do not count the actual number of computer operations performed.
This is perfectly good question and it is important to understand the answer.
The short answer is that we need a way to compare a program’s expected
performance independent of the computer used to run the program.
Consider, for example, running lon-double from Fig. 4 on a computer
made in 1997 and on a computer made in 2021. It is unlikely to surprise you
that it runs faster on the computer from 2021. Did the program magically
become faster? Clearly, that is not the case. The program runs faster be-
cause the hardware used to execute it is faster. The algorithm implemented
by the program remains unchanged when using a different computer. How
16 1 The Science of Problem Solving
List length n n2
0 0 0
1 1 1
2 2 4
3 3 9
4 4 16
5 5 25
.. .. ..
. . .
1,000,000 1,000,000 1,000,000,000,000
This means that the only thing that varies from one row to another in Table 1
is the length of the list. If we let the length of the list be denoted by n, then
the number of function calls is n+1.
If the number of abstract operations is n+1, then the number of computer
operations is k*(n+1) (or k*n + k), where k is the number of computer
operations needed to perform an abstract operation. This means that the
number of computer operations is proportional to the number of abstract
operations. We say that k is the constant of proportionality. Any increase in
the number of computer operations performed is solely due to a change in
n. Therefore, we ignore the constants when describing the abstract running
time of a program. A program’s abstract running time or complexity is usually
written using Big O notation. For example, the complexity of lon-double is
O(n). Observe that the constant of proportionality is ignored.
If a program is O(n) we say that it is linear. That means that if the size
of the input is doubled, then we expect the number of abstract operations
performed to be doubled. If a program is O(n2 ) and the size of the input is
double, we expect the number of abstract operations to be quadrupled. Why?
It is worth noting that programs may have an exponential running time. For
example, a program might be O(2n ). If a program has exponential complex-
ity, it is unlikely to be useful other than for very small inputs. Consider,
for example, a list-processing function that is O(2n ). For a relatively small
list with only 30 elements, the expected number of computer operations is
proportional to over a billion operations. If the size of the list is doubled to
60, the number of computer operations is proportional to over a quintillion
operations. A computer that is capable of executing two billion (computer)
operations per second would roughly take over 160 thousand hours (i.e., over
18 years) to process a list with 60 elements. You can easily see why programs
that have an exponential abstract running time are not practical.
Finally, the function for the abstract running time may have more than
one component that depends on the size of the input. For example, such a
function might be f(n) = 3n2 + 4n + 10. What is the complexity of such a
program? We might be tempted to say that it is O(n2 + n) (remember that
we ignore the constants). Observe, however, the values for n and n2 displayed
18 1 The Science of Problem Solving
in Table 2. It is clear that n2 grows faster than n. For small values of n we can
say that there is not much difference between the values of n and n2 . As n
grows, however, it is clear that the value of n2 is much larger. This means that
the number of operations is proportional to n2 and not to n. Therefore, we
say that the complexity is O(n2 ). In general, the complexity of the program
is the fastest growing component of its abstract running time function.
7.1 Exercises
The sole purpose of the run function is to start the game by evaluating
a big-bang expression. We encapsulate the big-bang expression inside a
function to provide an easy way for the player to run the game. In other
words, the function’s purpose is to run the game and does not solve a problem.
Therefore, this function shall be the only one that is not tested.
We must decide how to represent the game’s world. Think carefully about
what changes as the game advances. Clearly, the board changes as the player
or the program swaps the empty tile space with a neighboring tile. Is there
anything else that changes? Let’s see. This game only has a board of tiles.
Therefore, there is nothing else that may change, meaning that the game’s
world is the value of the board.
How can the value of the board be represented? The board contains nine
positions that we shall number 0–8. The top row from left to right contains
board positions 0–2. The middle row from left to right contains board posi-
tions 3–5. The bottom row from left to right contains board positions 6–8.
9 The world and the run Function 23
This suggests the following board position data definition, sample values, and
template for functions of a board position:
;; A board position, bpos, is an integer in [0..8]
;; Sample bpos
(define TRCRNR 0) ;; top right corner
(define CENTER 4) ;; center position
(define MLEFTC 5) ;; middle left column
#|
;; bpos ... → ...
;; Purpose:
(define (f-on-bpos a-bpos ...)
(cond [(= a-bpos 0) ...]
[(= a-bpos 1) ...]
[(= a-bpos 2) ...]
[(= a-bpos 3) ...]
[(= a-bpos 4) ...]
[(= a-bpos 5) ...]
[(= a-bpos 6) ...]
[(= a-bpos 7) ...]
[else ...]))
us to the following data definition, sample values, and template for functions
on a tile value:
;; A tile value, tval, is an integer in [0..8]
;; Sample tval
(define BLNK 0)
(define FOUR 4)
(define FIVE 5)
#|
;; tval ... → ...
;; Purpose:
(define (f-on-tval a-tval ...)
(cond [(= a-tval 0) ...]
[(= a-tval 1) ...]
[(= a-tval 2) ...]
[(= a-tval 3) ...]
[(= a-tval 4) ...]
[(= a-tval 5) ...]
[(= a-tval 6) ...]
[(= a-tval 7) ...]
[else ...]))
Based on the previous definitions, we can now define a world as nine board
positions, each containing a tile value. This suggests the following world struc-
ture, sample worlds, and template for functions on a world:
;; A world is a structure:
;; (make-world tval tval tval tval tval tval tval tval tval)
;; Sample worlds
(define WIN (make-world 1 2 3
4 5 6
7 8 0))
#|
;; world ... → ...
;; Purpose:
(define (f-on-world a-world ...)
(... (f-on-tval (world-t0))
(f-on-tval (world-t1))
(f-on-tval (world-t2))
(f-on-tval (world-t3))
(f-on-tval (world-t4))
(f-on-tval (world-t5))
(f-on-tval (world-t6))
(f-on-tval (world-t7))
(f-on-tval (world-t8)) ...))
The name of the fields may be interpreted as tile value at board position n. For
example, t0 is the tile value at board position 0. Observe that the definition
template contains expressions that suggest calling functions to process a tile
value.
We can now turn our attention to designing the function to run the game.
This function shall take as input a name, represented as a symbol or a string,
to be placed on the game’s window frame and returns a world (i.e., the value
when the game ends). We need to decide what handlers are needed by the
big-bang expression. Clearly, a handler is needed to draw the world and to
detect when the game is over. In addition, we shall define a function to draw
the final world when the puzzle is solved. The only decision left for us to
make is how the player shall interact with the game. There are two choices.
We may design the game to allow the player to use either the keyboard or the
mouse to swap the empty tile space with one of its neighbors. We arbitrarily
choose to have the player interact with the game using the keyboard. This
means that we need a keystroke-processing function. This analysis leads to
the following run function:
;; A name is either a symbol or a string
;; name → world
;; Purpose: Run the 8-puzzle game
(define (run a-name)
(big-bang
A-WRLD
(on-draw draw-world)
(on-key process-key)
(stop-when game-over? draw-last-world)
(name a-name)))
We need to design and implement four functions and any auxiliary functions
these four main functions need. The big-bang expression is where we start
the top-down design process. The following sections fully outline the design
and implementation of each handler. Remember that run must be the last
function in your file.
10 Useful Constants
Before proceeding with the design of the handlers, it is useful to outline useful
constants. We know that a scene to draw the world in is needed. The scene
must fit three tile images across and three tile images down for a total of
nine tiles. Therefore, it makes sense to define the width and the height of the
scene in terms of a tile’s width and height.
10 Useful Constants 27
A tile’s image has a width and a length. In addition, a tile’s image has
a background color. The text on a tile has a font size and a color. We are
free to choose these characteristics to our liking. If each tile image is made a
square, then only a length is needed to define it. These observations lead to
the following constants:
(define TILE-LEN 100)
(check-expect (make-tile-img 8) )
(check-expect (make-tile-img 5) )
code. What does this suggest? It suggests abstracting over the expressions to
define a function to create tile images. Observe, however, that the expression
used for T0 is different from those used for T1 and T2. We would like to create
a function to create all tile images, but currently we are unable to abstract
over all the expressions. At this point if you are thinking about refactoring
the expressions, you are on the right track.
We can use a conditional expression to distinguish when to create the
empty tile space image and when to create a nonempty tile image. This
design idea yields the following definitions for tile image constants:
Discovering Diverse Content Through
Random Scribd Documents
C H A P T E R X I V.
THE LIVING BARRICADE.
In one way, it was unfortunate that Pizen Jane had released old
Nomad at that time. A road agent who had heard the cry of the dog
owl from the hut, and wondered about it, came over to investigate,
and appeared so suddenly and inopportunely that he discovered
what Pizen Jane had done. With a yell of astonishment and wrath,
he hurled the woman aside and leaped on the old trapper.
Under ordinary conditions, Nomad might have engaged this
desperado successfully; but now his arms and legs were benumbed,
and his whole body was sore and stiff, from the long congestion of
blood caused by the bonds that had been on him.
Nevertheless, though surprised, and taken at such a disadvantage,
the old trapper put up a stiff fight. He slashed a wide gash in the
outlaw’s face with the knife Pizen Jane had given him; and then,
tripping the outlaw, he rolled with him over and over on the floor,
clawing and striking with all his might.
Pizen Jane flew to the aid of Nomad, and set upon the road agent.
How the singular combat would have ended, if there had been no
interference, cannot be stated.
There was interference. Other outlaws, drawn by the noise, ran to
the hut; and in a very little while both old Nomad and Pizen Jane
were overpowered and their weapons taken from them.
Snaky Pete came to the hut, drawn by the yells of his men, and
learned what had happened. His rage passed all bounds. He drew a
revolver, and for an instant it seemed that he meant to shoot both
old Nomad and Pizen Jane. Then another thought came to him.
“Tie ’em, and keep ’em tied,” he said; “and send Pool Clayton
here. I want to see him bad.”
That sounded ominous.
Pool Clayton was called, and came forward with fear and
trembling. He had told his mother not long before that he was
willing to leave the outlaws, and glad to do it, if she would
accompany him. He had been expecting that she would do that
soon. It was delayed, he thought, by the difficulty of getting out of
the camp.
The young man had been given a good deal of time for serious
reflection. His dreams of what a road agent’s life was like had not
come true; and, besides, he had been aroused to a realization of the
enormity of the offense itself. In addition, his heart had been
touched by his mother.
But perhaps the strongest of the forces that had moved him was a
recollection of Snaky Pete’s commands to him to shoot old Nomad.
That, with his present fear of personal danger in the battle with the
troopers that seemed imminent, had made him want to get out of
the camp without delay.
It seemed to him that his talks with his mother, and even his
thoughts and desires to get away, had become known to Snaky Pete,
when the latter sent for him, commanding him sharply to appear at
once.
On arriving at the hut, he saw Nomad and Pizen Jane bound and
prisoners. A startling fear that he was to be commanded to shoot
not only Nomad but his mother came to terrify him.
“Tie him!” Snaky Pete roared.
The road agents threw themselves upon the fear-stricken youth,
quickly subdued him, and bound him. Then Snaky Pete took
occasion to explain to his men just what he meant to do.
“Buffalo Bill thinks mighty well, seems to me, of them three
people,” he said, pointing to the three prisoners. “It’s my opinion
that Pool and his mother got in here on purpose to betray the band,
and lead enemies to it. In my jedgment, they’d have done
something to-night, by way of weakenin’ the barricades, mebbe, that
would have got us all killed er captured.”
The murmurs of the desperadoes rose unpleasantly as they
listened to these accusations.
“I been watchin’ Pool ever sence he refused to shoot that old
duffer there when I ordered him to. That’s one p’int in the proof that
he is ole Nomad’s friend and Cody’s friend; and that woman I know
to be the pizenest rattlesnake in many ways that ever crawled on the
earth.
“Jes’ the same, I ain’t goin’ to shoot ’em—not now! I want ’em put
up in front of the barricades, where the troopers can see ’em; and
then, if the soldiers want to shoot into the barricades, let ’em do it.”
It was a long speech, and its utterance cost him effort and pain;
yet he felt savagely gratified by it. He had determined on the death
of Pizen Jane, and of Pool Clayton and Nick Nomad.
If the troopers, in trying to take the barricades, killed the three,
well and good; for a time he hoped their position there would hold
the soldiers back. If the prisoners were not thus slain, he would
have them shot as enemies after the coming fight was over. He still
had confidence in his men and in the strength of his position, and
was feverishly vengeful and defiant.
Pool Clayton wilted and cried out for mercy when he was dragged
by the road agents out to one of the barricades, and was lifted over
it and tied to the logs of which it was composed. His mother was
tied by his side. They were on the outside of the barricade, and
looked up the dark pass, where they half expected to see soon the
flaming of the carbines of troopers.
Placed thus, where the rain of lead could not miss them, it
seemed to Pool Clayton that his end was at hand. He cried out in
bitterness and anguish of spirit, reproaching himself for the evil
course which had led to this horrible fate.
“Pool,” said Pizen Jane, touched by his moaning outcries, “there
aire things that aire a heap worse’n to die this way; and one of the
things that aire worse is bein’ a successful road agent. Fer that is a
thing that would shore destroy you, body and soul.”
“Oh, don’t talk that way!” he wailed. “Don’t talk that way! We
must escape! We must get away!”
He threw himself to and fro in his agonies.
One of the outlaws came climbing over the barricade.
“See here,” he said, “if you don’t stop that yelpin’, I’ve got orders
to gag ye. Now, will you stop?”
Pool Clayton stopped, but lay shivering against the logs, white-
faced and wild-eyed, overcome by terror.
At the other barricade Nick Nomad had been tied in the same way.
But Nomad was showing no cowardly spirit. He believed in Buffalo
Bill’s ability to accomplish even wonders, and he therefore had hope.
C H A P T E R X V.
THE GALLANT TROOPERS.
The shot which Buffalo Bill and the troopers heard, and which was
followed by their advance, was fired by Pizen Jane.
Perhaps because she was a woman the cords that bound her
wrists and held her to the barricade were not knotted as securely
and tightly as those that bound her son. Men were desperate and
low indeed when they do not, consciously or unconsciously, retain
some consideration for a woman.
Pizen Jane had discovered, after a time, that she could work her
wrists about in the cords. She had said nothing of her discovery, for
outlaws were near her, behind the barricade; and out in front paced
a sentry.
But she had begun to strain and tug at the cords, finding by and
by that they gave a little.
This added to her desire to get out of them, and to that task she
bent her endeavors.
Yet a long time went by before she again felt the cords slip and
give under her manipulation.
After she was able to draw out one hand she stood for some time
in silence, considering what she could do. Apparently, she could do
nothing, because of the men near by.
She did not dare to speak of what she had done to Pool, lest she
should be overheard.
After that, as she had waited, hoping for something that would
create a diversion of which she could take advantage, the slow-
moving time had seemed interminable.
But Pizen Jane was possessed of monumental patience.
She had waited, minute by minute and hour by hour, hoping that
something would turn in her favor.
At intervals she had strained at the cords which still held one
wrist, and at last freed it. Her feet were still tied at the ankles, and
her body was still bound to the barricade.
She grew desperate when she saw the gray dawn breaking, and
knew that day was near, when inevitably what she had done would
be discovered.
She began to strain at the cords on her ankles; and at length, in
her desperation, she stooped over, determined to untie them with
her hands.
The sentinel out in front saw her do this.
“Hello!” he said. “What ye doin’?”
She stood erect by the barricade, her hands behind her back once
more, her lips firmly compressed, and did not answer him.
Long before, Pool Clayton had become little better than a shaking
jelly bag, through excess of fright. He hardly knew what the man
said, and he had not discovered what his courageous mother was
doing.
The man walked up to the barricade, and, stooping over, looked
Pizen Jane in the face.
“Hello!” he repeated. “What you doin’?”
Then her hands flew out, and, catching the knife from his belt, she
drove it into his shoulder, inflicting a wound that tumbled him back,
gasping and half paralyzed.
Before the outlaws on the other side of the barricade knew just
what had occurred, Pizen Jane had cut the cords that held her, had
stricken loose those that bound Pool Clayton, and was climbing over
the barricade, the knife and the sentry’s revolver in her hands.
“Git out o’ my way!” she snarled, striking at one of the men who
sought to oppose her progress.
He fell back out of the way of the knife. Then she sprang down,
and in another instant she was running toward the huts.
One of the outlaws pitched up a rifle and was on the point of
shooting her.
“Don’t do it!” a companion warned, and he knocked the muzzle of
the gun aside. “The boss would raise Old Ned wi’ ye, if ye should.”
Though they feared to shoot, a couple of them followed her; but
when they reached the huts, though they had followed close at her
heels, they could not find her.
One of them poked his head into the hut where Snaky Pete was
lying, supposedly asleep.
“Hello!” he called, in a low voice. “That woman has got away, and
is in the camp here some’eres.”
Snaky Pete came to his feet, and rushed to the door.
“Where is she?” he cried, his wounded lip cutting him like a knife
as he said it.
“Here!” was the startling answer.
Pizen Jane seemed to rise out of the ground before him. She
threw up the revolver, and fired full at him. It was the revolver shot
that the scout and the troopers heard.
As its report rang out, Snaky Pete Sanborn, the outlaw and
desperado, pitched forward on his face, falling dead in the door of
the hut.
Pizen Jane had kept her vow.
The charge of the troopers came right on top of this, turning the
attention of the outlaws to the task of repulsing the invaders. The
fight that followed was sharp and hot, but it was short.
Finding that the troopers were within the camp itself, the
desperadoes stationed at the barricades deserted them, climbing
them and running for safety out through the pass.
Those within the camp, who had been trapped there, fought with
a courage and desperation worthy of a better cause. They slew
some of the troopers, and several of their own number fell.
The others tried to get out of the camp, but, being surrounded,
they threw down their weapons and surrendered.
The shrill voice of Pizen Jane was heard once, as she took part in
the fight against the outlaws; and once the scout beheld her, with
smoking pistol, confronting one of the outlaws. When the fight had
ended she was found lying dead close by the hut where she had
killed her infamous and recreant husband.
Nomad was, of course, released from his unpleasant predicament.
He received orders to remain a few hours longer at the camp, in
order to observe whether any of the deserters returned with
reënforcements—in which case he was to ride at once to Fort
Thompson. If none returned, he could rejoin Buffalo Bill and the
troopers at the fort, within the next three days.
Pool Clayton seemed genuinely grieved over the death of his
mother, and shed bitter tears when he beheld her dead body. He
was not held for the crime of being a member of the road-agent
band, but was permitted to depart from that section of the country.
That a genuine reformation in his character was effected the scout
believed, for afterward he had word of him, at a time when Pool was
residing in a mining town called Crystal Spring, where he had
secured honorable employment and seemed determined to live an
honest life.
CHAPTER XVII.
P U R S U E D B Y B L A C K F E E T.
“Whoa, Nebby, consarn ye! Don’t lose yer head, now, er mighty
quick you won’t have no head to lose.”
Old Nick Nomad, the trapper and famous border scout, twisted
around in his saddle, jerking at his horse’s bridle, and stared back
along the way he had come after leaving the outlaw stronghold.
Nomad was a small, dried-up specimen of a man, dressed in
border costume of ancient fashion, even to the beaver-skin cap. He
held in his right hand a long rifle. His old horse, ungainly as himself,
yet possessed of as many surprising qualities, stepped about, in
spite of the jerking rein, and showed every indication of nervousness
and fright.
“You’re skittisher’n a two-year-old, and ain’t got any more sense,
when you smells Injuns,” Nick grumbled. “Stand still, now; they’re
comin’ erlong, I know, but they ain’t nigh enough ter bite ye!”
Old Nebuchadnezzar had made a rapid run since the Blackfeet
were sighted, more than two miles back. The homely, shaggy-haired
beast had been too fleet for the Blackfeet ponies. His sides were
heaving now, and sweat trickled down his legs, dripping to the
ground. Yet he was ready to go on; and so much did he fear Indians
that he would have run until he fell, if Nomad had but given him rein
and urged him a little.
Nomad was trying to determine whether the Blackfeet were
coming on, following his trail, or whether they had left the trail and
were trying to cut him off at some narrow pass. They were more
familiar with this part of the country than he was, and he knew in
that they possessed a decided advantage.
After a time of quiet, the Blackfeet had once more become
troublesome, under Crazy Snake, whose hatred of the whites had
flared forth with sudden fury.
Nomad had, for two days, returned to the old life he loved best of
all—trapping by the headwaters of the mountain streams, leading a
carefree existence in the open and under the blue sky.
Then, on the last day—the day on which he was to arrive at the
fort—trouble and peril had descended on him when he had least
expected it.
His traps were stolen or destroyed, his little hut was broken open
and robbed, and then Paul Davis, his old-time border partner, who
had encountered him in the neighborhood of the outlaws’
stronghold, was slain, while returning one afternoon to the hut from
a hunt.
Nomad found Davis’ body in the trail that led down from the
higher mountains, and on Davis’ breast a bloody arrow, slashed
there with a scalping knife.
The scalp had been torn from Davis’ head, thus proving that the
work had been done by Blackfeet, while the bloody arrow showed
that this was another “vengeance” blow struck by the chief, Crazy
Snake.
Old Nomad was not fool enough to linger there longer. He buried
the body of his old friend, protecting it from wolves by a heap of
stones placed on the grave. Then he cached his pelts, picked his few
belongings, mounted old Nebuchadnezzar, and set his face toward
Fort Thompson.
But he was not to escape so easily.
He had not gone far when he discovered that Blackfeet were
dogging his trail, for the apparent purpose of surprising him in camp,
or while he slept. He was sure these Blackfeet were led by Crazy
Snake, who had marked him for another victim.
As Nomad sat staring along the backward way, a herd of elk came
in sight, swinging down the trail he had been following. He instantly
guided Nebuchadnezzar out of the trail, and let the elk go plunging
by, for they seemed to be frightened, and were running at high
speed.
“Good enough!” the old man grunted. “I think I kin puzzle them
red devils a bit now.”
Sure that wherever the Blackfeet were they did not now see him,
Nomad dismounted, and, removing a blanket he carried in a roll
behind his saddle, he tore it into strips and wrapped them round the
hoofs of his horse, so that he would leave no trail.
A trailless route would make it troublesome for even the keen-
eyed Blackfeet to follow him.
Descending the mountain now by a zigzag path, and making,
besides, several changes in his course, Nomad succeeded in
reaching lower ground. Here he mounted Nebuchadnezzar again,
and rode off in a new direction; but several times changed his
course, in his efforts to baffle the Blackfeet.
While he was thus riding on, he was astonished by hearing his
name spoken. He reined in and faced about, staring in surprise.
“By ther great jumpin’ jack rabbits, ef that ain’t ther queerest
ever!” he grunted. “Somebody callin’ ter me hyer, at a p’int whar
thar ain’t nobody!”
A pebble came rolling down the side of the hill, the suddenness
with which it bounced out at him making him jump. He saw that it
had come from a clump of aspens on the hillside not far away.
His ancient rifle swung around with a quick motion, and the
muzzle was elevated toward the aspens.
“Hi, there! Don’t shoot,” a voice called. “Like Davy Crockett’s coon,
I’ll come down.”
Then a hand appeared, pushing some leaves aside, and, following
this hand, came the body of a man.
Nomad gasped his amazement when he saw the clothing and face
of this man. Before him stood Buffalo Bill.
Though Nomad’s astonishment was deep, he did not forget the
peril in which he was placed at that time.
“Stand whar ye aire, Buffler!” he called. “The pizen reds aire
rompin’ round, and aire after my ha’r. Ole Crazy Snake is reachin’ fer
me with his fangs.”
He guided his horse up to the aspens where the scout stood; the
scout asking questions, which he did not then answer.
“Buffler, I’m gladder ter see ye than ef I’d found a gold mine! Got
yer hoss hyar?”
“Yes; just back here in ther trees.”
“Then, fer Heaven’s sake, muffle him, and git out with me, ’fore
ther reds finds this spot,” the old trapper urged. “I’m huntin’ fer a
hole ter hide in, till Crazy Snake and his Blackfeet villyuns leave this
kentry; and it’ll be healthy fer you ter do ther same quick’s ye kin.”
Buffalo Bill did not know until then that Crazy Snake had actually
taken to the warpath, though he had known there were rumors of
war trouble, and that a number of whites had been murdered. He
shook hands with old Nomad, and asked him some more questions.
This time Nomad answered:
“I’ve give ’em a good start, and balled ’em some, Buffler, but they
ain’t easy ter fool.”
“I know that, Nomad,” the scout answered; “but I think we can
fool them.”
He retreated to where his horse was tied to an aspen; and then,
taking a blanket from his roll, he made mufflers like those used by
Nomad. He looked anxiously at the trail his horse had made in
coming to this little grove—some of the hoofmarks deeply scored the
soil. But there was no help for that now.
In a few minutes he joined Nomad, mounted, and asked:
“Were you making for the cañon down there?”
“Anywhar, Buffler, ter fool ther Blackfeet. If yer knows this kentry
some I’ll let you p’int ther way, fer bur durned ef I’m any too well
acquainted with it.”
Buffalo Bill took the lead.
As the two men rode along, they discussed the pursuit of the
Blackfeet, and each learned the story of the other.
“I came here from the fort on a scouting trip,” said Buffalo Bill,
“because the Blackfeet have killed some men and have been
threatening trouble. Since I arrived, a miner was murdered and
scalped on the Baldface trail, and a sheep-herder was treated the
same way over in Los Cerillos Valley. Both were slain by Blackfeet;
yet I didn’t know whether it was simply some single Blackfoot
murderer, or was the work of Blackfeet bands of rovers. I rode out
here to-day, hoping to find out something more about it.”
“And now y’ve found, Buffler! The red devils aire risin’, and they’re
killin’ and scalpin’. Ole Crazy Snake’s bloody arrer will be on the
breasts of a good many dead men, ef ther thing continners, I’m
tellin’ ye. I thought it war time fer me ter cut sticks, and so I did. I’m
glad I met ye, Buffler.”
The scout recounted many of the things that had happened during
the past three days, especially the departure of young Clayton, and
Nomad told of his trapping experiences.
“I cached what furs I’d got tergether,” he said, “when I was ready
to slide out o’ the hills. If ther Blackfeet don’t find ’em, I’ll git ’em
some time. Ther thing jes’ now is ter take keer o’ my scalp, which is
a good deal more important than a beaver skin, handsome as a
beaver skin looks.”
He pushed back his cap and scratched at his head, as if it itched in
anticipation of a scalping knife.
They sought lower ground as they talked, and they talked in low
tones.
“Nomad, it’s providential that I met you,” the scout told his old
friend.
“I dunno about it, Buffler,” said Nomad, with a grin. “If I’d gone
straight ahead ’thout tryin’ to break my trail, ole Crazy Snake’s band
would have follered me hot-footed. And so they wouldn’t never had
a chance ter see you hyar an’ put you in danger. Now they may; fer
they’ll pick up thet trail o’ mine, if mortual man kin do it.”
With the scout in the lead, they entered the cañon.
On the rocks just by the water they removed the mufflers from the
hoofs of the horses. The animals were then ridden into the water,
the rocky bank there holding no trail; and down the stream they
rode, keeping in the water. They went on in this way nearly a mile,
and then began to follow up a tributary stream.
As the scout rode along, his keen eyes searching either shore, he
saw a grove of trees. There were a number of these groves in the
lower part of the cañon, whose floor was of soil in places, rather
than rock.
“If we can get under cover of those trees without making any
tracks doing it, we can probably lie safe there,” he remarked, while
Nomad looked at the grove.
“Ole Nebby, hyar, kin do ’most anything, Buffler, but he ain’t learnt
to fly yit. And, without flyin’, I don’t see how you’re goin’ ter git inter
the midst of them trees and leave no sign. Fer thar’s soil hyar, and
not rock.”
“But the grass, you’ll notice, come right down to the water,” said
the scout, “and is a thick, firm turf.”
“Go ahead, Buffler; I’m follerin’ ye. Mebbe we kin make it by
mufflering ther hoofs of ther hosses. But we can’t muffler ’em very
well hyar in ther water, and when we rides out of ther stream with
their hoofs bare they’re shore goin’ ter make some tracks.”
Buffalo Bill rode toward the shore.
When close to the grass, but still in the water, he rose to his
horse’s back. Standing in the saddle, with the remaining blanket
from his roll held in his hands, he threw the blanket so that it fell on
the grass at the water’s edge. It fell, folded, as he had wanted it to;
and, with a quick jump, he leaped to it from the saddle. By this
clever plan, he kept his boots from cutting into the turf and soil.
“You’ve got a blanket, in addition to the scraps you cut the other
one into,” he said. “Throw me your blanket.”
Nomad threw the blanket to him, and the scout spread it out
beside the one on which he was standing.
He kept his feet off the ground, while he arranged both blankets
in the form of a carpet, which touched the very rim of the water.
Then he spoke to his well-trained horse, and the obedient animal
walked from the water out upon the carpet of blankets. There the
scout put on the animal’s hoofs the mufflers, and then commanded
it to walk on, ordering it to stop when it had gone far enough.
“Now, Nomad,” he called, “ride old Nebby out upon this carpet,
and when we’ve put the mufflers on him I think the trick will be
nearly done.”
Nick Nomad complied, dismounting beside his horse on the
blankets. The mufflers were put upon the hoofs of Nebuchadnezzar.
Then the old man rode him on.
Buffalo Bill called his horse back to him, climbed into the saddle,
stooped from the saddle, and picked the blankets from the ground,
and called the trapper’s attention to the apparent success of the
ruse.
The blankets and the muffled hoofs had prevented the showing of
a single hoofmark by the margin of the stream. More than that, they
had absorbed the water which ran from the legs of the horses,
sucking it up as a sponge would, and holding it; so that not even
water remained on the grass there to draw the attention of any
eagle-eyed Blackfoot.
The scout and the trapper now rode their muffled horses into the
thick grove, where they were completely hidden from view of any
one passing along the cañon stream, or on either of its banks.
“Buffler,” said Nomad, filled with delight at the cleverness of his
old pard, “ef I’d had head enough I might have thought o’ thet
myself; but I didn’t. But I allow thet it’s ther cutest trick I ever saw
played ter try ter fool Injuns. Whar’d yer learn it?”
“I thought of it myself just now. I don’t know that any one ever
tried it before. And that’s what makes it valuable. If we used some
trick that is familiar the Blackfeet would probably be expecting it,
and so would not be fooled by it. They’ll not be expecting this trick, I
hope.”
CHAPTER XVIII.
THE BLACKFOOT TRAILERS.
Under cover of the screening trees, Buffalo Bill and old Nomad
watched the cañon and stream, while they talked of the threatened
Blackfoot war, and of their individual experiences since they had last
been together.
“It warn’t Blackfeet we war up ag’inst last time together, Buffler,
but road agents. Pool Clayton was with us then, you recomember?
D’yer think he’ll be in this hyar neighborhood soon?”
“I’m not expecting him this time.”
Buffalo Bill told his old mountain pard, however, that Pawnee Bill,
the famous dead shot, was to have joined him in the town below,
but had missed him there, and would no doubt follow.
“It’s just possible,” he had stated, “that he went round by way of
the Ferguson Trail, and, if so, he may have gained these hills in
advance of my coming; yet I think he is behind me.”
As the two friends talked thus, Buffalo Bill laid his hand with a
quick, firm motion on Nomad’s arm. Reaching out with the other
hand, he took his horse by the nose.
“Hist!” came from his lips.
Nomad understood, glanced at the stream, and patted the nose of
old Nebuchadnezzar to keep him still.
A Blackfoot warrior had come in sight on the other side of the little
cañon river. He was naked, save for a breechclout, and his copper-
colored body was smeared and striped with paint. He carried a long
rifle, and a knife, and hatchet. In his raven hair eagle feathers
fluttered, proclaiming him not only a warrior, but, with the abundant
paint, announcing that he was on the warpath.
He had come downstream, and he was scanning the river and its
shores, and the cañon walls, together with the wider expanses
where the little groves of trees were. But most he gave his attention
to the banks of the stream at the water’s edge.
It was plain to the experienced bordermen that if he had not
tracked the white men to the cañon and the river, he at least
suspected they had gone there, and he was looking for the point
where they had emerged. His presence was proof that other
Blackfeet were near, and no doubt a strong war party. They had
chased old Nomad, and were ready for scalps and plunder.
The concealed friends and their horses stood motionless, as the
Indian stepped with light feet along the farther shore of the little
river.
He was a magnificent specimen of the American Indian; lithe, as
well as muscular, his body straight as an arrow, his limbs sinewy, yet
so gracefully and evenly developed that they would have done as
models for a sculptor or a painter. Buffalo Bill looked at the Blackfoot
with admiration, regarding him at the moment merely as a fine
specimen of Indian manhood, forgetting in that momentary
enthusiasm what his appearance there meant, and what was
denoted by the paint and the floating feathers.
The Indian stared hard at the trees which concealed the scout and
the trapper. He neither saw nor heard anything there. On the ground
between the river and the grove there was not so much as an
indentation in the soil to suggest that horses had passed that way.
“Whoa, Nebby, consarn ye!” Nomad whispered to his horse; for
Nebby’s ears were pricked up and his big eyes were staring. Indians
frightened him, for which Nomad was responsible, for he had taught
the old horse to fear them.
“Nebby is better’n any watchdog,” was Nomad’s boast. “No Injun
kin come nigh him without him makin’ a hullabaloo.”
This tendency to make a “hullabaloo” when he saw an Indian had
its disadvantages at times, as at present; yet the whispered
adjurations of old Nomad, and the touch of his hand, kept the horse
quiet as the Blackfoot passed along. As for the scout’s horse, though
it had not Nebby’s peculiar tendency, there was, nevertheless,
danger that it would make a noise of some kind, hence the scout
kept his hand on its nose.
After staring hard at the grove, and scanning the soil by the
stream, the Blackfoot went on, and soon he was lost to sight in a
bend of the cañon.
“A close shave!” said the scout.
“And a healthy one fer thet red nigger, Buffler,” said Nomad
meaningly. “I’d hate fer him to ’a’ smelt us out hyar, fer then I’d had
to shot him. And that would ’a’ made a tarnal noise, too.”
“Yes; we’d have been in for a fight.”
“Thar’s more of ’em about, Buffler.”
“They may be a good deal scattered, though; so we may see only
this fellow.”
“I’m hopin’ it, Buffler.”
They saw another, in a very few seconds, on their side of the
stream. He was armed and painted like the one who had just
disappeared, but he was not so tall and handsome. His body was
shorter and thicker, his arms longer, his sheer physical strength
greater. He could not have run like the one who had just gone on,
but in a rough-and-tumble fight he would have been an enemy more
to be feared.
He not only looked at the grove where the white men were hidden
with their horses, but he walked a few yards toward it, looking
carefully at the ground.
Once or twice he stooped down and inspected the grass; and the
scout and trapper thought then he had seen some faint indentations
in the soil, and guessed of the trick that had been played. But the
redskin retraced his way to the river, and went on, searching its
shores.
“Phew, Buffler! I thought it war fight, shore thing, then!”
“I, too.”
“I reckon we’re safe hyar, unless they come back and take a
notion to look behind these trees. If they does it, thar will be dead
Injuns, and fun immediately afterward.”
The Blackfeet did not return. An hour passed, and then another,
and nothing was seen or heard; but Cody and Nomad could not be
sure that sharp eyes were not watching the cañon from some cliff or
cañon precipice; hence they remained concealed in the grove,
keeping the horses as quiet as possible, and talking only in low
tones.
Not until darkness came did they venture to leave their secure
retreat. Even then they moved with the utmost caution, leading the
horses instead of riding them, and progressing so slowly that hours
elapsed before they came out into the open country below. There
the land lay broad and free before them, and the stars pointed the
way.
Yet they did not ride toward the town. Instead, they turned back
into the hills; for the discovery that the Blackfeet had taken the
warpath under Crazy Snake made the scout fearful for the safety of
a family he knew, who lived just under the shadows of the big hills.
CHAPTER XIX.
THE TRAGEDY OF THE CABIN.
The home of John Forest was a simple and unpretentious one, but
it was lighted by the beauty of a girl whom he loved as his own life,
his daughter Lena.
Forest was lured by that witch of the world—gold. He believed he
had found gold at the foot of Big Tom Mountain, gold in quantities to
pay not only for working the mine he soon opened there, but
enough to make him rich. He had a brother who had found good ore
in a region not many miles away, and his brother’s success
encouraged him to “stick it out” even to the bitter end.
The country was forbidding, and the Blackfeet were not far away;
yet Forest established his home under the shadow of the mountain,
installed in it his daughter as his housekeeper, and set to work.
Like many mines, there was far more promise in the Lady Bird, as
he called it, than there was performance. He took out barely enough
gold to give him a living and supply him with tools and blasting
powder. Daily he kept hoping to strike the “mother lode,” or a seam
of gold, or, perhaps, a pocket of nuggets.
He paid little heed to the Blackfeet.
As for callers or visitors, he had a few; one of them being young
Bruce Clayton, who had fallen in love with the beautiful face of the
miner’s daughter, and who came there as frequently as his new “job”
permitted.
Down in the town of Crystal Spring, some miles away, on one of
her infrequent visits, Lena Forest learned of the trouble brewing with
the Blackfeet, and its cause.
It was a singular story, as she regarded it.
Some white miners had established themselves near Crazy Snake’s
village; which, to the Indian mind, was bad of itself; and then one of
the miners, falling ill of measles, and not knowing what it was, the
disease had been communicated to the Blackfeet.
Treated by Indian medicine men, whose sole idea of medication
was to rattle tomtoms and howl themselves hoarse in efforts to drive
away malignant spirits, the Blackfeet died like flies. One of the
victims of this scourge of the measles was Crazy Snake’s only son.
Believing that the white men had sent this curse on the Blackfeet
for the purpose of destroying them, that they might secure the
Indian lands for mining purposes, Crazy Snake and some of his
warriors attacked the miners’ camp, and slew all in it, including the
man who was ill of measles, but who was at the time convalescing.
Not content with this summary vengeance, Crazy Snake was now
threatening the white people everywhere.
The mark of his visitation was an arrow of blood scored with a
knife on the breast of each victim.
This was the startling story Lena Forest brought home to her
father.
“The Blackfeet will not trouble us here,” said Forest. “I don’t think
they know we’re here, anyway; for not one has come near us all the
time we’ve been here. But if trouble seems threatening, we’ll cut out
in time to escape it.”
The truth is, that though Forest feared more than he would say,
he believed he was at the moment on the verge of opening up that
wonderful seam of gold, and the golden lure chained him there.
Every day, even every hour, he was sure that the next stroke or two
of the pick, or the next few scrapes of his shovel, would reveal the
gleam of the shining metal for which he had worked so hard!
No, he could not go just yet, even though Blackfeet threatened.
Besides, none had been seen near the house, nor in the hills near it.
Really, he tried to persuade himself, there was no danger.
Lena Forest, uneasy, went to the town again, to gain further news
of the threatened Blackfoot trouble.
She learned that the danger was really alarming, and that two
noted scouts had been sent for, and had arrived—Buffalo Bill and
Pawnee Bill. Her father knew these scouts, and Buffalo Bill was his
personal friend. She tried to see them, but found only Pawnee Bill,
Cody having departed for the hills.
Pawnee Bill advised her that it was foolish for her and her father
to remain in their exposed home at that time, and assured her he
would call on her father and tell him so.
The girl returned home, determined more than ever to induce her
father to go at once to the town, or to some point of greater
security.
When she rode along the path, approaching her home in the
gathering twilight, she saw before the door a form lying in a limp
heap, a sight that stilled her heartbeats and caused her to reel in her
saddle with faintness. Nevertheless, she rode up to it, and, leaping
down by it, discovered her father, dead. He had been killed and
scalped; and on his breast, where the blue flannel shirt had been
torn open, was that dreadful sight, the arrow of blood drawn with a
scalping knife.
The girl swooned at sight of it, and fell as if dead beside the dead
body.
How long she remained there unconscious she did not know. The
stars were in the sky and the wind from the mountain was cold
when she aroused and came back to a realization of the terrible
thing that had befallen her father and herself.
She threw herself on the inanimate form, and wept as if her eyes
were oceans. By and by she struggled to her feet.
Her first thought was of flight, for personal safety, and for help for
her father, whose body needed to be protected from wolves and
other wild beasts. But she discovered that she had not strength to
go anywhere; and this, with thoughts of what might happen during
her absence, held her to the dreadful spot.
She crept at length to the cabin, where she procured a candle.
With it she returned to her father’s body. Lighting the candle, she
put it upright on the ground beside him, knowing that wolves and
other wild animals fear such a light. Having done that, she returned
to the cabin, this time thinking of finding her horse, which had
strayed away, and of riding to the town with the news.
But she swooned again as she crossed the threshold, and fell to
the floor, where she lay a long while. This time when she recovered
she crawled to the bed, and laid herself down on it. She slept, then;
though how or why she did was afterward a puzzle to her.
The sun was shining in through the open door when a voice, the
voice of a man, aroused her.
She got up, wild-eyed, her dress disheveled, her face tear-stained.
The man was Pawnee Bill, whom she had seen and talked with in
the town. He had ridden out, as he had promised, leaving the town
long before dawn, and he had seen in the trail the dead body of
John Forest, mute witness of the vengeance of Crazy Snake, the
Blackfoot. The famous scout soon saw that the girl was on the verge
of a collapse from hysteria and overwrought nerves. She screamed
when she beheld him, ran toward him with outstretched hands, and
in wild phrases began to tell him of what had occurred.
“My dear girl,” he said, “you do not need to tell me, for I have
seen. But let me urge you to try to control yourself. I shall escort
you back to the town, and then——”
“But my father!” she wailed hysterically.
“All that can be done for him now will be done, let me assure you.”
The kind-hearted scout was really at a loss what to say and do in
this dire emergency, but he induced her to lie down again on the
bed; and then he went outside, thinking to get a spade and bury the
body of John Forest.
As he did so, he beheld two men coming along the trail. He
stared, then recognized them, and ran toward them, calling their
names.
They were Buffalo Bill and old Nick Nomad.
It was the family of John Forest that Buffalo Bill had been anxious
to warn against the dangers of the Blackfeet.
CHAPTER XX.
AN AMAZING DISAPPEARANCE.
Lena Forest came out of the cabin when she heard Pawnee Bill
talking with the scouts and the trapper. She recognized the scout, for
once he had called on her father, and she ran toward him.
“Oh, if you had but been here sooner!” she wailed.
Buffalo Bill dismounted, and Nomad did the same.
“Yes, we came too late,” said the scout sadly. “I have been talking
with Major Lillie, and we think you should be sent at once to the
town. Major Lillie will go with you, while my old friend, Nomad, and I
will pick up the trail of the Blackfeet murderers of your father. That’s
all that can be done now, except to give your father decent burial,
which we will do at once.”
He took the girl by the hand, and his kind words caused her tears
to flow afresh.
“Now, if you will go back into the house and lie down again for a
while it will be better for you,” he urged. “There is absolutely nothing
you can do, and you need as much rest as you can get before you
start on your trip. We will find your horse; and, if you like, Nomad
will go in and prepare something for you to eat, or make some
coffee for you.”
“I couldn’t eat a mouthful,” she said.
“But you will go into the house?” he urged.
She understood, turned about with slow feet, and disappeared
within.
Pawnee Bill found the miner’s spade and pick, and brought them
out for the purpose of digging a grave, which work he and the scout
at once began, while old Nomad set forth on Nebuchadnezzar for
the purpose of finding and capturing the girl’s runaway horse.
Buffalo Bill and his friend worked rapidly, and soon had a grave
hollowed out. Buffalo Bill then went to the house to get blankets in
which to wrap the body for burial.
When he entered the cabin, he was astonished not to find the girl
there. However, he thought she had but stepped out, and he went to
the door to look around. When he failed to see her, he called to her.
To his repeated calls there was no answer.
He stepped out of the house, and walked around it.
Nowhere was the girl to be seen.
There was a rear door, which was unlocked, but was not open,
and a rear window, but the window had not been disturbed.
Cody began to search the ground quickly with his keen eyes. He
saw a moccasin track by the rear door, yet he was not sure but it
had been made at the time the master of the house had been killed.
The house had been entered then, and some things had been taken,
so the girl had declared. That more had not been taken was a
marvel to the experienced scout.
“Gordon, come here!” he called from the corner of the house.
Pawnee Bill dropped the spade he was wielding and came running.
“The girl is gone,” said the scout. “I found her absent from the
house, and I fail to see her anywhere.” He looked at Pawnee Bill
earnestly. “Was her mind so affected, do you think, that she would
slip out of this back door and into the hills, there?” he asked. “If not
——”
“What?” said Pawnee Bill.
Buffalo Bill pointed to the moccasin track.
“That is suggestive, if it is new; but it’s hard to tell when it was
made. The girl is gone. You heard me call to her, and she has not
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.
ebooknice.com