Practical Ruby Projects (eBook)
328 Seiten
Apress (Verlag)
978-1-4302-0471-8 (ISBN)
Revitalized by Ruby on Rails, the Ruby language continues to grow in popularity. Books like this are necessary to fill the demand. Here is a classic of its kind; required reading for Ruby programmers who have already mastered the basics and want to learn higher level techniques. Practical Ruby Projects presents nine diverse projects that will teach new and innovative techniques in a learn-by-example fashion. They include a turn-based adventure game and a generative music creator. While there are many other Ruby titles, none of them take this unique project-based approach to teaching.
Topher Cyll is a software engineer and writer living in Cambridge, Massachusetts. He received his bachelor's degree in computer science from Williams College and works for a small Boston-area startup. In reverse alphabetical order, he finds programming languages, music, free software, education, bioengineering, and beer terribly exciting. Topher loves Ruby not only for the language itself, but also the light-hearted and intellectually curious community that surrounds it.
This book is titled Practical Ruby Projects. And let me start by saying that the projects are practical. But they might not be quite what you're used to. Flip through the book. You won't find any references to enterprise deployment. Not a word about business logic. In fact, hard as it is to believe, there's no web programming! But if you exclude those things, what's left? Why, everything else, of course! Each chapter in this book turns Ruby loose on a new interesting problem or project. They range from creative endeavors to investigative simulations to the exploration of computer programming languages themselves. Ruby is a programming language, but it's also a tool to create, understand, and entertain. This book is all about Ruby. Why Ruby? Since this book was written with the assumption that you have a basic knowledge of Ruby, odds are you already know about Ruby's strengths. The Language You know that Ruby's blocks are a joy to use. You know how Ruby's programmer-oriented core API can make programming feel effortless. Despite what the popular press so- times says, Ruby isn't the final word in programming languages. But Ruby holds a unique position in the current landscape.
Topher Cyll is a software engineer and writer living in Cambridge, Massachusetts. He received his bachelor's degree in computer science from Williams College and works for a small Boston-area startup. In reverse alphabetical order, he finds programming languages, music, free software, education, bioengineering, and beer terribly exciting. Topher loves Ruby not only for the language itself, but also the light-hearted and intellectually curious community that surrounds it.
Contents at a Glance 5
Contents 6
About the Author 13
About the Technical Reviewer 14
Acknowledgments 15
Introduction 16
Why Ruby? 16
Why This Book? 17
Getting Set Up 18
Source Code in This Book 19
Your Projects 20
Making Music with Ruby 21
MIDI: Giving Yourself a Vocabulary 21
Talking C and Making Noise 23
Building a Metronome 36
Composing 43
Saving Your Music 50
Live Coding 53
Summary 63
Animating Ruby 64
Scalable Vector Graphics 64
The Animator 68
Drawing Many Cubes 80
Your First Animation 91
Putting the Animations Together 96
Spicing It Up 99
Summary 104
Pocket Change: Simulating Coin Systems with Ruby 105
Going Shopping 105
How to Make Change 107
Dynamic Programming 111
The Customer 112
The ChangeSimulator 122
So How Heavy Are Your Pockets? 123
Replacing a Coin 123
Adding a Coin 124
Optimal Coins 125
Wizard Money 128
In the Literature 129
Summary 130
Turn-Based Strategy in Ruby 131
A Strategy 131
An Implementation 133
Building the World Around Us 133
Meeting Your Heroes 141
Making Choices 145
Taking Action 148
The Players 151
The Artificial Intelligence Doesn’t Seem So Intelligent 154
Writing a Command- Line Player 155
The Game 156
Putting It All Together 162
Summary 164
RubyCocoa 165
The Very Basics 165
Building a Turn- Based Strategy Game 170
Selecting Units from the Map 192
Using Image Tiles 196
Packaging It Up 204
Summary 207
Genetic Algorithms in Ruby 208
Simulating Evolution 209
Thinking About Encodings 214
Using Mutation 219
Making Change . . . Again! 222
Adding Further Improvements 227
Summary 232
Implementing Lisp in Ruby 233
Learning Lisp 234
Choosing Your Lisp Data Types 234
Building Cons Cells 234
Saving Values in the Environment 236
Understanding eval and apply 240
Making It Look Like Lisp 245
Choosing Your Primitive Functions 246
Creating an Interpreter Object 248
But What About Special Forms? 250
Implementing Macros 257
It Just Ain’t Lisp Without eval 260
Adding Lexical Macros 261
Interoperating with Ruby 263
Summary 266
Parsing in Ruby 271
Parsing with Ruby 272
Parsing S- Expressions 275
Parsing List Comprehensions 288
Summary 300
Index 302
Erscheint lt. Verlag | 11.3.2008 |
---|---|
Zusatzinfo | 328 p. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Mathematik / Informatik ► Informatik ► Web / Internet |
Schlagworte | Animation • Development • language • programming • Ruby On Rails • Simulation • techniques • Web Programming |
ISBN-10 | 1-4302-0471-0 / 1430204710 |
ISBN-13 | 978-1-4302-0471-8 / 9781430204718 |
Haben Sie eine Frage zum Produkt? |
![PDF](/img/icon_pdf_big.jpg)
Größe: 2,2 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich