1. Trang chủ
  2. » Công Nghệ Thông Tin

Best of Ruby Quiz potx

285 700 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 285
Dung lượng 1,77 MB

Nội dung

[...]... language is Ruby We think Ruby is better than Emerald You can choose any interface you like, as long as a user can interact with the end result You can play around with a CGI-based solution at the Ruby Quiz site.5 You can find the two Mad Libs files I’m using on the Ruby Quiz site as well.6 5 http://rubyquiz.com/cgi-bin/madlib.cgi 6 http://rubyquiz.com/madlibs/Lunch_Hungers.madlib and http://rubyquiz.com/madlibs/Gift_Giving.madlib... a new subtree of type INDI (“individual”) The ID for this individual is @I1@ • 1 NAME Jamis Gordon /Buck/ This starts a NAME subtree with a value of Jamis Gordon /Buck/ • 2 SURN Buck This is a subelement of the NAME subtree, of type SURN (“surname”) • 2 GIVN Jamis Gordon Same as SURN but specifies the given name of the individual • 1 SEX M Creates a new sub-element of the INDI element, of type SEX (i.e.,... increase readability 8 http://www.rubyquiz.com/royal.ged Report erratum 10 Q UIZ 4 A NIMAL Q UIZ Quiz Answer on page 81 4 Animal Quiz Posed by Jim Weirich Here’s an animal quiz program to try as a Ruby Quiz It works like this: The program starts by telling the user to think of an animal It then begins asking a series of yes/no questions about that animal: Does it swim? Does it have hair? And so on Eventually,... the entire Ruby Quiz community The second side of my support base is the most fantastic bunch of family and friends a guy could have They truly make me believe I can do anything Without them I would be merely mortal Finally, but most important, I must thank Dana, my true inspiration You believed long before I did, and as always, you were right Here is the proof Report erratum 4 Part I The Quizzes Q... grammar and spelling Any other changes will be called out in the margin of the code listings as they occur Who Really Made All of This So many people contributed to this book, I can hardly take credit for writing it I will call out contributions of problems and code as they come up, but that’s such a small part of the story Ruby Quiz simply wouldn’t exist if it wasn’t for all the wonderful contributors... can’t be equally smooth This Ruby Quiz is to start a module called HighLine (for high-level, lineoriented interface) Ideally this module would eventually cover many aspects of terminal interaction, but for this quiz we’ll focus just on getting input What I really think we need here is to take a page out of the OptionParser book.12 Here are some general ideas: 12 At http://www .ruby- doc.org/stdlib/libdoc/optparse/rdoc/index.html... 11 S OKOBAN Quiz Answer on page 134 11 Sokoban Ruby isn’t the only good thing to come out of Japan The computer game Sokoban, invented by Hiroyuki Imabayashi, was introduced by Thinking Rabbit in 1982 This game of logic puzzles was an instant success It won awards and spawned sequels Over the years, Sokoban has been ported to a huge number of platforms Fan support remains strong, and many of those fans... erratum 12 Q UIZ 5 S CRABBLE S TEMS Quiz Answer on page 89 5 Scrabble Stems Posed by Martin DeMello In Scrabble9 parlance, a bingo is a play where one gets rid of all seven letters A bingo stem is a set of six letters that combine with another letter of the alphabet to make a seven-letter word Some six-letter stems have more possible combinations than others For instance, one of the more prolific stems, SATIRE,... () Quiz Answer on page 93 6 Regexp.build() This quiz is to build a library that adds a class method called build( ) to Regexp and that should accept a variable number of arguments, which can include Integers and Ranges of Integers Have build( ) return a Regexp object that will match only Integers in the set of passed arguments Here are some examples of possible usage: lucky = Regexp.build(3, 7) "7"... snippet of GEDCOM given previously would become the following: Jamis Gordon /Buck/ Buck Jamis Gordon M Sample Input There is a large GEDCOM file online8 containing the lineage of various European royalty This particular file makes generous use of whitespace to increase readability 8 http://www.rubyquiz.com/royal.ged . at the Ruby Quiz site. 5 You can find the two Mad Libs files I’m using on the Ruby Quiz site as well. 6 5 http://rubyquiz.com/cgi-bin/madlib.cgi 6 http://rubyquiz.com/madlibs/Lunch_Hungers.madlib. readability. 8 http://www.rubyquiz.com/royal.ged Report erratum QUIZ 4. ANIMAL QUIZ 11 Quiz 4 Answer on page 81 Animal Quiz Posed by Jim Weirich Here’s an animal quiz progr am to try as a Ruby Quiz. It works

Ngày đăng: 06/03/2014, 10:20