1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * robotfindskitten: A Zen simulation
12 * Copyright (C) 1997,2000 Leonard Richardson
13 * leonardr@segfault.org
14 * http://www.crummy.com/devel/
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or EXISTANCE OF KITTEN. See the GNU General
24 * Public License for more details.
26 * http://www.gnu.org/copyleft/gpl.html
28 * Ported to Rockbox 2007 by Jonas Häggqvist
32 #include "lib/pluginlib_actions.h"
33 #include "lib/display_text.h"
35 /* This macros must always be included. Should be placed at the top by
36 convention, although the actual position doesn't matter */
39 /*Be sure to change MESSAGES when you change the array, or bad things
42 /*Also, take note that robotfindskitten.c and configure.in
43 currently have the version number hardcoded into them, and they
44 should reflect MESSAGES. */
46 /* Watch out for fenceposts.*/
47 #define MESSAGES (sizeof messages / sizeof (char*))
49 static char* messages
[] =
51 "\"I pity the fool who mistakes me for kitten!\", sez Mr. T.",
52 "That's just an old tin can.",
53 "It's an altar to the horse god.",
54 "A box of dancing mechanical pencils. They dance! They sing!",
55 "It's an old Duke Ellington record.",
56 "A box of fumigation pellets.",
57 "A digital clock. It's stuck at 2:17 PM.",
58 "That's just a charred human corpse.",
59 "I don't know what that is, but it's not kitten.",
60 "An empty shopping bag. Paper or plastic?",
61 "Could it be... a big ugly bowling trophy?",
62 "A coat hanger hovers in thin air. Odd.",
63 "Not kitten, just a packet of Kool-Aid(tm).",
64 "A shameless plug for Rockbox: http://www.rockbox.org",
65 "A freshly-baked pumpkin pie.",
66 "A lone, forgotten comma, sits here, sobbing.",
67 "ONE HUNDRED THOUSAND CARPET FIBERS!!!!!",
68 "It's Richard Nixon's nose!",
69 "It's Lucy Ricardo. \"Aaaah, Ricky!\", she says.",
70 "You stumble upon Bill Gates' stand-up act.",
71 "Just an autographed copy of the Kama Sutra.",
72 "It's the Will Rogers Highway. Who was Will Rogers, anyway?",
73 "It's another robot, more advanced in design than you but strangely immobile.",
74 "Leonard Richardson is here, asking people to lick him.",
75 "It's a stupid mask, fashioned after a beagle.",
76 "Your State Farm Insurance(tm) representative!",
77 "It's the local draft board.",
78 "Seven 1/4\" screws and a piece of plastic.",
80 "One of those stupid \"Homes of the Stars\" maps.",
81 "A signpost saying \"TO KITTEN\". It points in no particular direction.",
82 "A hammock stretched between a tree and a volleyball pole.",
83 "A Texas Instruments of Destruction calculator.",
84 "It's a dark, amphorous blob of matter.",
86 "Oh hey, you're not Llorean!",
87 "It's a mighty zombie talking about some love and prosperity.",
88 "\"Dear robot, you may have already won our 10 MILLION DOLLAR prize...\"",
89 "It's just an object.",
90 "A mere collection of pixels.",
91 "A badly dented high-hat cymbal lies on its side here.",
92 "A marijuana brownie.",
94 "Daily hunger conditioner from Australasia",
96 "Why are you touching this when you should be finding kitten?",
97 "A glorious fan of peacock feathers.",
98 "It's some compromising photos of Babar the Elephant.",
99 "A copy of the Weekly World News. Watch out for the chambered nautilus!",
100 "It's the proverbial wet blanket.",
101 "A \"Get Out of Jail Free\" card.",
102 "An incredibly expensive \"Mad About You\" collector plate.",
103 "Paul Moyer's necktie.",
104 "A haircut and a real job. Now you know where to get one!",
105 "An automated robot-hater. It frowns disapprovingly at you.",
106 "An automated robot-liker. It smiles at you.",
107 "It's a black hole. Don't fall in!",
108 "It's a Toshiba MK8022GAA hard drive, untested, as-is.",
109 "Just a big brick wall.",
110 "You found kitten! No, just kidding.",
111 "Heart of Darkness brand pistachio nuts.",
112 "A smoking branding iron shaped like a 24-pin connector.",
113 "It's a Java applet.",
114 "An abandoned used-car lot.",
115 "A shameless plug for Crummy: http://www.crummy.com/",
116 "A shameless plug for the UCLA Linux Users Group: http://linux.ucla.edu/",
117 "A can of Spam Lite.",
118 "This is another fine mess you've gotten us into, Stanley.",
119 "It's scenery for \"Waiting for Godot\".",
120 "This grain elevator towers high above you.",
122 "It's the constellation Pisces.",
123 "It's a fly on the wall. Hi, fly!",
124 "This kind of looks like kitten, but it's not.",
125 "It's a banana! Oh, joy!",
126 "A helicopter has crashed here.",
127 "Carlos Tarango stands here, doing his best impression of Pat Smear.",
128 "A patch of mushrooms grows here.",
129 "It's a song by Kraftwerk, all about robots.",
130 "A patch of grape jelly grows here.",
131 "A spindle, and a grindle, and a bucka-wacka-woom!",
132 "A geyser sprays water high into the air.",
133 "A toenail? What good is a toenail?",
134 "You've found the fish! Not that it does you much good in this game.",
135 "A Buttertonsils bar.",
136 "One of the few remaining discoes.",
137 "Ah, the uniform of a Revolutionary-era minuteman.",
138 "A punch bowl, filled with punch and lemon slices.",
139 "It's nothing but a G-thang, baby.",
140 "IT'S ALIVE! AH HA HA HA HA!",
141 "This was no boating accident!",
142 "Wait! This isn't the poker chip! You've been tricked! DAMN YOU, MENDEZ!",
143 "A livery stable! Get your livery!",
144 "It's a perpetual immobility machine.",
145 "\"On this spot in 1962, Henry Winkler was sick.\"",
146 "There's nothing here; it's just an optical illusion.",
147 "The World's Biggest Motzah Ball!",
148 "A tribe of cannibals lives here. They eat Malt-O-Meal for breakfast, you know.",
149 "This appears to be a rather large stack of trashy romance novels.",
150 "Look out! Exclamation points!",
151 "A herd of wild coffee mugs slumbers here.",
152 "It's a limbo bar! How low can you go?",
153 "It's the horizon. Now THAT'S weird.",
154 "A vase full of artificial flowers is stuck to the floor here.",
155 "A large snake bars your way.",
156 "A pair of saloon-style doors swing slowly back and forth here.",
157 "It's an ordinary bust of Beethoven... but why is it painted green?",
158 "It's TV's lovable wisecracking Crow! \"Bite me!\", he says.",
159 "Hey, look, it's war. What is it good for? Absolutely nothing. Say it again.",
160 "It's the amazing self-referential thing that's not kitten.",
161 "A flamboyant feather boa. Now you can dress up like Carol Channing!",
162 "\"Sure hope we get some rain soon,\" says Farmer Joe.",
163 "\"How in heck can I wash my neck if it ain't gonna rain no more?\" asks Farmer Al.",
164 "\"Topsoil's all gone, ma,\" weeps Lil' Greg.",
165 "This is a large brown bear. Oddly enough, it's currently peeing in the woods.",
166 "A team of arctic explorers is camped here.",
167 "This object here appears to be Louis Farrakhan's bow tie.",
168 "This is the world-famous Chain of Jockstraps.",
169 "A trash compactor, compacting away.",
170 "This toaster strudel is riddled with bullet holes!",
171 "A capsaicin molecule.",
172 "It's a hologram of a crashed helicopter.",
173 "This is a television. On screen you see a robot strangely similar to yourself.",
174 "This balogna has a first name, it's R-A-N-C-I-D.",
175 "A salmon hatchery? Look again. It's merely a single salmon.",
176 "It's a rim shot. Ba-da-boom!",
177 "It's creepy and it's kooky, mysterious and spooky. It's also somewhat ooky.",
178 "This is an anagram.",
179 "This object is like an analogy.",
180 "It's a symbol. You see in it a model for all symbols everywhere.",
181 "The object pushes back at you.",
182 "A traffic signal. It appears to have been recently vandalized.",
183 "\"There is no kitten!\" cackles the old crone. You are shocked by her blasphemy.",
184 "This is a Lagrange point. Don't come too close now.",
185 "The dirty old tramp bemoans the loss of his harmonica.",
186 "Look, it's Fanny the Irishman!",
187 "What in blazes is this?",
188 "It's the instruction manual for a previous version of this game.",
189 "A brain cell. Oddly enough, it seems to be functioning.",
190 "Tea and/or crumpets.",
191 "This jukebox has nothing but Cliff Richards albums in it.",
192 "It's a Quaker Oatmeal tube, converted into a drum.",
193 "This is a remote control. Being a robot, you keep a wide berth.",
194 "It's a roll of industrial-strength copper wire.",
195 "Oh boy! Grub! Er, grubs.",
196 "A puddle of mud, where the mudskippers play.",
197 "Plenty of nothing.",
198 "Look at that, it's the Crudmobile.",
199 "Just Walter Mattheau and Jack Lemmon.",
200 "Two crepes, two crepes in a box.",
201 "An autographed copy of \"Primary Colors\", by Anonymous.",
202 "Another rabbit? That's three today!",
203 "It's a segmentation fault. Core dumped, by the way.",
204 "A historical marker showing the actual location of /dev/null.",
205 "Thar's Mobius Dick, the convoluted whale. Arrr!",
206 "It's a charcoal briquette, smoking away.",
207 "A pizza, melting in the sun.",
208 "It's a \"HOME ALONE 2: Lost in New York\" novelty cup.",
209 "A stack of 7 inch floppies wobbles precariously.",
210 "It's nothing but a corrupted floppy. Coaster anyone?",
211 "A section of glowing phosphor cells sings a song of radiation to you.",
212 "This TRS-80 III is eerily silent.",
213 "A toilet bowl occupies this space.",
214 "This peg-leg is stuck in a knothole!",
215 "It's a solitary vacuum tube.",
216 "This corroded robot is clutching a mitten.",
217 "\"Hi, I'm Anson Williams, TV's 'Potsy'.\"",
218 "This subwoofer was blown out in 1974.",
219 "Three half-pennies and a wooden nickel.",
220 "It's the missing chapter to \"A Clockwork Orange\".",
221 "It's a burrito stand flyer. \"Taqueria El Ranchito\".",
222 "This smiling family is happy because they eat LARD.",
223 "Roger Avery, persona un famoso de los Estados Unidos.",
224 "Ne'er but a potted plant.",
225 "A parrot, kipping on its back.",
226 "A forgotten telephone switchboard.",
227 "It's a trio of Swedish hackers. They seem to be busy with that MP3 player.",
228 "A forgotten telephone switchboard operator.",
229 "It's an automated robot-disdainer. It pretends you're not there.",
230 "It's a portable hole. A sign reads: \"Closed for the winter\".",
231 "Just a moldy loaf of bread.",
232 "A little glass tub of Carmex. ($.89) Too bad you have no lips.",
233 "A Swiss-Army knife. All of its appendages are out. (toothpick lost)",
234 "It's a zen simulation, trapped within an ASCII character.",
235 "It's a copy of \"The Rubaiyat of Spike Schudy\".",
236 "It's \"War and Peace\" (unabridged, very small print).",
237 "A willing, ripe tomato bemoans your inability to digest fruit.",
238 "A robot comedian. You feel amused.",
239 "It's KITT, the talking car.",
240 "Here's Pete Peterson. His batteries seem to have long gone dead.",
241 "\"Blup, blup, blup\", says the mud pot.",
242 "More grist for the mill.",
243 "Cory Doctorow's hot air balloon is tethered here.",
244 "Grind 'em up, spit 'em out, they're twigs.",
245 "The boom box cranks out an old Ethel Merman tune.",
246 "It's \"Finding kitten\", published by O'Reilly and Associates.",
247 "Pumpkin pie spice.",
248 "It's the Bass-Matic '76! Mmm, that's good bass!",
249 "\"Lend us a fiver 'til Thursday\", pleas Andy Capp.",
250 "It's a tape of '70s rock. All original hits! All original artists!",
251 "You've found the fabled America Online disk graveyard!",
252 "Empty jewelboxes litter the landscape.",
253 "It's the astounding meta-object.",
254 "Ed McMahon stands here, lost in thought. Seeing you, he bellows, \"YES SIR!\"",
256 "It's 1000 secrets the government doesn't want you to know!",
257 "The letters O and R.",
258 "A magical... magic thing.",
259 "It's a moment of silence.",
260 "It's Sirhan-Sirhan, looking guilty.",
261 "It's \"Chicken Soup for the Kitten-seeking Soulless Robot.\"",
262 "It is a set of wind-up chatter teeth.",
263 "It is a cloud shaped like an ox.",
264 "You see a snowflake here, melting slowly.",
265 "It's 91 yards of twine.",
266 "It's a big block of ice. Something seems to be frozen inside it.",
267 "Vladimir Lenin's casket rests here.",
268 "It's a copy of \"Zen and The Art of Robot Maintenance\".",
269 "This invisible box contains a pantomime horse.",
270 "A mason jar lies here open. It's label reads: \"do not open!\".",
271 "A train of thought chugs through here.",
272 "This jar of pickles expired in 1957.",
273 "Someone's identity disk lies here.",
274 "\"Yes!\" says the bit.",
275 "\"No!\" says the bit.",
276 "A dodecahedron bars your way.",
277 "Mr. Hooper is here, surfing.",
278 "It's a big smoking fish.",
279 "You have new mail in /var/spool/robot",
280 "Just a monitor with the blue element burnt out.",
281 "A pile of coaxial plumbing lies here.",
282 "It's a rotten old shoe.",
283 "It's a hundred-dollar bill.",
284 "It's a Dvorak keyboard.",
285 "It's Bender, the loveable kleptomaniac robot! \"Bite my shiny metal ass!\"",
286 "It's a cardboard box full of 8-tracks.",
287 "Just a broken hard drive containg the archives of Nerth Pork.",
288 "A broken metronome sits here, it's needle off to one side.",
289 "A sign reads: \"Go home!\"",
290 "A sign reads: \"No robots allowed!\"",
291 "It's the handheld robotfindskitten game, by Tiger.",
292 "This particular monstrosity appears to be ENIAC.",
293 "This is a tasty-looking banana creme pie.",
294 "A wireframe model of a hot dog rotates in space here.",
295 "Just the empty husk of a locust.",
296 "You disturb a murder of crows.",
297 "It's a copy of the robotfindskitten EULA.",
299 "It's an autographed copy of \"Secondary Colors,\" by Bob Ross.",
300 "It is a marzipan dreadnought that appears to have melted and stuck.",
301 "It's a DVD of \"Crouching Monkey, Hidden Kitten\", region encoded for the moon.",
302 "It's Kieran Hervold. Damn dyslexia!",
303 "A non-descript box of crackers.",
304 "Carbonated Water, High Fructose Corn Syrup, Color, Phosphoric Acid, Flavors, Caffeine.",
305 "\"Move along! Nothing to see here!\"",
306 "It's the embalmed corpse of Vladimir Lenin.",
307 "A coupon for one free steak-fish at your local family diner.",
308 "A set of keys to a 2001 Rolls Royce. Worthless.",
309 "A gravestone stands here. \"Izchak Miller, ascended.\"",
310 "Someone has written \"ad aerarium\" on the ground here.",
311 "A large blue eye floats in midair.",
312 "This appears to be a statue of Perseus.",
313 "There is an opulent throne here.",
314 "It's a squad of Keystone Kops.",
315 "This seems to be junk mail addressed to the finder of the Eye of Larn.",
316 "A wondrous and intricate golden amulet. Too bad you have no neck.",
317 "The swampy ground around you seems to stink with disease.",
318 "An animate blob of acid. Being metallic, you keep well away.",
319 "It's a copy of Knuth with the chapter on kitten-search algorithms torn out.",
320 "A crowd of people, and at the center, a popular misconception.",
321 "It's a blind man. When you touch, he exclaims \"It's a kitten prospecting robot!\"",
322 "It's a lost wallet. It's owner didn't have pets, so you discard it.",
323 "This place is called Antarctica. There is no kitten here.",
324 "It's a mousetrap, baited with soap.",
325 "A book with \"Don't Panic\" in large friendly letters across the cover.",
326 "A compendium of haiku about metals.",
327 "A discredited cosmology, relic of a bygone era.",
328 "A hollow voice says \"Plugh\".",
329 "A knight who says \"Either I am an insane knave, or you will find kitten.\"",
330 "The secret meeting place of the Knights of the Lambda Calculus.",
331 "A neural net -- maybe it's trying to recognize kitten.",
333 "A statue of a girl holding a goose like the one in Gottingen, Germany.",
334 "A tetradrachm dated \"42 B.C.\"",
335 "A voice booms out \"Onward, kitten soldiers...\"",
336 "An eminently forgettable zahir.",
337 "Apparently, it's Edmund Burke.",
338 "For a moment, you feel something in your hands, but it disappears!",
339 "Here is a book about Robert Kennedy.",
340 "Hey, robot, leave those lists alone.",
341 "Ho hum. Another synthetic a posteriori.",
342 "It's Asimov's Laws of Robotics. You feel a strange affinity for them.",
343 "It's Bach's Mass in B-minor!",
345 "It's a synthetic a priori truth! Immanuel would be so pleased!",
346 "It's the Tiki Room.",
347 "Just some old play by a Czech playwright, and you can't read Czech.",
348 "Kitten is the letter 'Q'. Oh, wait, maybe not.",
349 "Quidquid Latine dictum sit, kitten non est.",
350 "Sutro Tower is visible at some distance through the fog.",
351 "The Digital Millennium Copyright Act of 1998.",
352 "The United States Court of Appeals for the Federal Circuit.",
353 "The non-kitten item like this but with \"false\" and \"true\" switched is true.",
354 "The non-kitten item like this but with \"true\" and \"false\" switched is false.",
355 "This is the chapter called \"A Map of the Cat?\" from Feynman's autobiography.",
356 "This is the forest primeval.",
357 "Werner's \"Pocket Field Guide to Things That Are Not Kitten\".",
358 "You found nettik, but that's backwards.",
359 "You have found some zinc, but you must not stop here, for you must find kitten.",
360 "\"50 Years Among the Non-Kitten Items\", by Ann Droyd.",
361 "\"Robot may not injure kitten, or, through inaction, ...\"",
362 "\"Address Allocation for Private Internets\" by Yakov Rekhter et al.",
363 "\"Mail Routing and the Domain System\" by Craig Partridge.",
364 "\"The Theory and Practice of Oligarchical Collectivism\" by Emmanuel Goldstein.",
365 "\"201 Kitten Verbs, Fully Conjugated\". You look for \"find\".",
366 "A card shark sits here, practicing his Faro shuffle. He ignores you.",
367 "A copy of DeCSS. They're a dime a dozen these days.",
368 "A demonic voice proclaims \"There is no kitten, only Zuul\". You flee.",
369 "A lotus. You make an interesting pair.",
370 "It's the missing 24 seconds of \"Monty Python and the Holy Grail\".",
371 "A milk carton, with a black and white picture of kitten on the side.",
372 "Any ordinary robot could see from a mile away that this wasn't kitten.",
373 "A stegosaurus, escaped from the stegosaurusfindsrobot game. It finds you.",
374 "Baling wire and chewing gum.",
375 "Chewing gum and baling wire.",
376 "Here is no kitten but only rock, rock and no kitten and the sandy road.",
377 "Hey, I bet you thought this was kitten.",
378 "It is an ancient mariner, and he stoppeth one of three.",
379 "It pleases you to be kind to what appears to be kitten -- but it's not!",
380 "It's a blatant plug for Ogg Vorbis, http://www.vorbis.com/",
381 "It's a business plan for a new startup, kitten.net.",
382 "It's a revised business plan for a new startup, my.kitten.net.",
384 "It seems to be a copy of \"A Tail of Two Kitties\".",
385 "It's the Donation of Constantine!",
386 "It's this message, nothing more.",
387 "Lysine, an essential amino acid. Well, maybe not for robots.",
389 "The score for a Czech composer's \"Kitten-Finding Symphony in C\".",
390 "This looks like Bradley's \"Appearance and Reality\", but it's really not.",
391 "This non-kitten item no verb.",
392 "You feel strangely unfulfilled.",
393 "You hit the non-kitten item. The non-kitten item fails to yowl.",
394 "You suddenly yearn for your distant homeland.",
395 "You've found the snows of yesteryear! So that's where they all went to.",
396 "Approaching. One car. J. Followed by. Two car. M, M. In five. Minutes.",
397 "Free Jon Johansen!",
398 "Free Dmitry Sklyarov!",
399 "One person shouts \"What do we want?\" The crowd answers \"Free Dmitry!\"",
400 "Judith Platt insults librarians.",
401 "This map is not the territory.",
402 "\"Go back to Libraria!\", says Pat Schroeder.",
403 "This is a porcelain kitten-counter. 0, 0, 0, 0, 0...",
404 "An old bootable business card, unfortunately cracked down the middle.",
405 "A kitten sink, for washing kitten (if only kitten liked water).",
406 "A kitten source (to match the kitten sink).",
407 "If it's one thing, it's not another.",
408 "If it's not one thing, it's another.",
411 "A hedgehog. It looks like it knows something important.",
412 "You've found... Oh wait, that's just a cat.",
413 "Robot should not be touching that.",
414 "Air Guitar!!! NA na NA na!!",
415 "An aromatherapy candle burns with healing light.",
416 "You find a bright shiny penny.",
417 "It's a free Jon Johansen!",
418 "It's a free Dmitry Sklyarov!",
419 "The rothe hits! The rothe hits!",
420 "It's an Internet chain letter about sodium laureth sulfate.",
421 "Ed Witten sits here, pondering string theory.",
422 "Something is written here in the dust. You read: \"rJbotf ndQkttten\".",
423 "We wish you a merry kitten, and a happy New Year!",
424 "Run away! Run away!",
425 "You can see right through this copy of Brin\'s \"Transparent Society\".",
426 "This copy of \"Steal This Book\" has been stolen from a bookstore.",
428 "This kit is the fourteenth in a series of kits named with Roman letters.",
429 "This is the tenth key you've found so far.",
430 "You find a fraud scheme in which loans are used as security for other loans.",
431 "It's the phrase \"and her\", written in ancient Greek.",
432 "It's the author of \"Randomness and Mathematical Proof\".",
433 "It's the crusty exoskeleton of an arthropod!",
434 "It's Emporer Shaddam the 4th's planet!",
435 "It's the triangle leg adjacent to an angle divided by the leg opposite it.",
436 "It's a bottle of nail polish remover.",
437 "You found netkit! Way to go, robot!",
438 "It's the ASCII Floating Head of Seth David Schoen!",
439 "A frosted pink party-cake, half eaten.",
440 "A bitchin' homemade tesla coil.",
441 "Conan O'Brian, sans jawbone.",
442 "It's either a mirror, or another soulless kitten-seeking robot.",
443 "Preoccupation with finding kitten prevents you from investigating further.",
444 "Fonzie sits here, mumbling incoherently about a shark and a pair of waterskis.",
445 "The ghost of your dance instructor, his face a paper-white mask of evil.",
446 "A bag of groceries taken off the shelf before the expiration date.",
447 "A book: Feng Shui, Zen: the art of randomly arranging items that are not kitten.",
448 "This might be the fountain of youth, but you'll never know.",
451 "A canister of pressurized whipped cream, sans whipped cream.",
452 "The non-kitten item bites!",
453 "A chain hanging from two posts reminds you of the Gateway Arch.",
454 "A mathematician calculates the halting probability of a Turing machine.",
455 "A number of short theatrical productions are indexed 1, 2, 3, ... n.",
456 "A technical university in Australia.",
457 "It is -- I just feel something wonderful is about to happen.",
458 "It's a Cat 5 cable.",
459 "It's a U.S. president.",
460 "It's a piece of cloth used to cover a stage in between performances.",
461 "The ionosphere seems charged with meaning.",
462 "This tomography is like, hella axial, man!",
463 "It's your favorite game -- robotfindscatan!",
464 "Just a man selling an albatross.",
465 "The intermission from a 1930s silent movie.",
466 "It's an inverted billiard ball!",
467 "The spectre of Sherlock Holmes wills you onwards.",
470 #define RFK_VERSION "v1.4142135.406"
472 /* Button definitions stolen from maze.c */
473 #if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
474 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
475 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
476 # undef __PLUGINLIB_ACTIONS_H__
477 # define RFK_QUIT (BUTTON_SELECT | BUTTON_MENU)
478 # define RFK_RIGHT BUTTON_RIGHT
479 # define RFK_LEFT BUTTON_LEFT
480 # define RFK_UP BUTTON_MENU
481 # define RFK_DOWN BUTTON_PLAY
482 # define RFK_RRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
483 # define RFK_RLEFT (BUTTON_LEFT | BUTTON_REPEAT)
484 # define RFK_RUP (BUTTON_MENU | BUTTON_REPEAT)
485 # define RFK_RDOWN (BUTTON_PLAY | BUTTON_REPEAT)
487 #elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
488 # undef __PLUGINLIB_ACTIONS_H__
489 # define RFK_QUIT (BUTTON_HOME|BUTTON_REPEAT)
490 # define RFK_RIGHT BUTTON_RIGHT
491 # define RFK_LEFT BUTTON_LEFT
492 # define RFK_UP BUTTON_UP
493 # define RFK_DOWN BUTTON_DOWN
494 # define RFK_RRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
495 # define RFK_RLEFT (BUTTON_LEFT | BUTTON_REPEAT)
496 # define RFK_RUP (BUTTON_UP | BUTTON_REPEAT)
497 # define RFK_RDOWN (BUTTON_DOWN | BUTTON_REPEAT)
500 # define RFK_QUIT PLA_QUIT
501 # define RFK_RIGHT PLA_RIGHT
502 # define RFK_LEFT PLA_LEFT
503 # define RFK_UP PLA_UP
504 # define RFK_DOWN PLA_DOWN
505 # define RFK_RRIGHT PLA_RIGHT_REPEAT
506 # define RFK_RLEFT PLA_LEFT_REPEAT
507 # define RFK_RUP PLA_UP_REPEAT
508 # define RFK_RDOWN PLA_DOWN_REPEAT
511 /*Constants for our internal representation of the screen.*/
516 /* if SYSFONT_WIDTH is 0 (which it is during dependency generation) gcc
517 will abort (div by 0) and this plugin won't get any dependencies
519 #if SYSFONT_WIDTH < 1
520 #define SYSFONT_WIDTH 10
521 #define SYSFONT_HEIGHT 10
524 /*Screen dimensions.*/
526 #define X_MAX ((LCD_WIDTH/SYSFONT_WIDTH) - 1)
528 #define Y_MAX ((LCD_HEIGHT/SYSFONT_HEIGHT) - 1)
533 #define ROBOT_COLOR LCD_DARKGRAY
534 const unsigned colors
[NUM_COLORS
] = {
535 LCD_RGBPACK(255, 255, 0), /* Yellow */
536 LCD_RGBPACK(0, 255, 255), /* Cyan */
537 LCD_RGBPACK(255, 0, 255), /* Purple */
538 LCD_RGBPACK(0, 0, 255), /* Blue */
539 LCD_RGBPACK(255, 0, 0), /* Red */
540 LCD_RGBPACK(0, 255, 0), /* Green */
544 #define ROBOT_COLOR LCD_DARKGRAY
545 const unsigned colors
[NUM_COLORS
] = {
552 #define ROBOT_COLOR 0
553 const unsigned colors
[NUM_COLORS
] = {
556 #endif /* HAVE_LCD_COLOR */
558 /*Macros for generating numbers in different ranges*/
559 #define randx() (rb->rand() % X_MAX) + 1
560 #define randy() (rb->rand() % (Y_MAX-Y_MIN+1))+Y_MIN /*I'm feeling randy()!*/
561 #define randchar() rb->rand() % (126-'!'+1)+'!';
562 #define randcolor() rb->rand() % NUM_COLORS
563 #define randbold() (rb->rand() % 2 ? true:false)
565 /*Row constants for the animation*/
567 #define ANIMATION_MEET (X_MAX/3)*2
568 #define ANIMATION_LENGTH 4
570 /*This struct contains all the information we need to display an object
582 *Function definitions
585 /*Initialization and setup functions*/
586 static void initialize_arrays(void);
587 static void initialize_robot(void);
588 static void initialize_kitten(void);
589 static void initialize_bogus(void);
590 static void initialize_screen(void);
591 static void instructions(void);
592 static void finish(int sig
);
595 static void play_game(void);
596 static void process_input(int);
599 static void pause(void);
600 static int validchar(char);
601 static void play_animation(int);
603 /*Global variables. Bite me, it's fun.*/
604 struct screen_object robot
;
605 struct screen_object kitten
;
607 #if X_MAX*Y_MAX < 200
612 struct screen_object bogus
[NUM_BOGUS
];
613 unsigned short bogus_messages
[NUM_BOGUS
];
614 bool used_messages
[MESSAGES
];
618 /* This array contains our internal representation of the screen. The
619 array is bigger than it needs to be, as we don't need to keep track
620 of the first few rows of the screen. But that requires making an
621 offset function and using that everywhere. So not right now. */
622 int screen
[X_MAX
+ 1][Y_MAX
+ 1];
624 /******************************************************************************
626 * Begin meaty routines that do the dirty work.
628 *****************************************************************************/
630 static void drawchar(int x
, int y
, char c
)
633 rb
->snprintf(str
, sizeof(str
), "%c", c
);
634 rb
->lcd_putsxy(x
*SYSFONT_WIDTH
, y
*SYSFONT_HEIGHT
, str
);
637 static void draw(struct screen_object o
)
640 unsigned oldforeground
;
641 oldforeground
= rb
->lcd_get_foreground();
642 rb
->lcd_set_foreground(o
.color
);
643 drawchar(o
.x
, o
.y
, o
.character
);
644 rb
->lcd_set_foreground(oldforeground
);
646 drawchar(o
.x
, o
.y
, o
.character
);
650 static void message(char * str
)
652 rb
->lcd_puts_scroll(0, ADV_ROW
, str
);
655 static void refresh(void)
661 *play_game waits in a loop getting input and sending it to process_input
663 static void play_game()
667 int input
= 0; /* Not sure what a reasonable initial value is */
668 #ifdef __PLUGINLIB_ACTIONS_H__
669 const struct button_mapping
*plugin_contexts
[] = {generic_directions
, generic_actions
};
672 while (input
!= RFK_QUIT
&& exit_rfk
== false)
674 process_input(input
);
676 /*Redraw robot, where applicable. We're your station, robot.*/
677 if (!(old_x
== robot
.x
&& old_y
== robot
.y
))
679 /*Get rid of the old robot*/
680 drawchar(old_x
, old_y
, ' ');
681 screen
[old_x
][old_y
] = EMPTY
;
683 /*Meet the new robot, same as the old robot.*/
686 screen
[robot
.x
][robot
.y
] = ROBOT
;
691 #ifdef __PLUGINLIB_ACTIONS_H__
692 input
= pluginlib_getaction(TIMEOUT_BLOCK
, plugin_contexts
, 2);
694 input
= rb
->button_get(true);
702 *Given the keyboard input, process_input interprets it in terms of moving,
703 *touching objects, etc.
705 static void process_input(int input
)
707 int check_x
= robot
.x
;
708 int check_y
= robot
.y
;
730 /*Check for going off the edge of the screen.*/
731 if (check_y
< Y_MIN
|| check_y
> Y_MAX
|| check_x
< X_MIN
|| check_x
> X_MAX
)
733 return; /*Do nothing.*/
738 * disabled because it breaks the scrolling for some reason
740 /* rb->lcd_puts_scroll(0, ADV_ROW, " "); */
742 /*Check for collision*/
743 if (screen
[check_x
][check_y
] != EMPTY
)
745 switch (screen
[check_x
][check_y
])
748 /*We didn't move, or we're stuck in a
749 time warp or something.*/
751 case KITTEN
: /*Found it!*/
752 play_animation(input
);
753 /* Wait for the user to click something */
756 default: /*We hit a bogus object; print its message.*/
757 message(messages
[bogus_messages
[screen
[check_x
][check_y
]-2]]);
764 /*Otherwise, move the robot.*/
769 /*finish is called upon signal or progam exit*/
770 static void finish(int sig
)
776 /******************************************************************************
778 * Begin helper routines
780 *****************************************************************************/
787 button
= rb
->button_get(true);
789 while( ( button
== BUTTON_NONE
)
790 || ( button
& (BUTTON_REL
|BUTTON_REPEAT
) ) );
793 static int validchar(char a
)
805 static void play_animation(int input
)
808 struct screen_object left
;
809 struct screen_object right
;
810 /*The grand cinema scene.*/
811 rb
->lcd_puts_scroll(0, ADV_ROW
, " ");
813 if (input
== RFK_RIGHT
|| input
== RFK_DOWN
||
814 input
== RFK_RRIGHT
|| input
== RFK_RDOWN
)
825 left
.x
= ANIMATION_MEET
- ANIMATION_LENGTH
- 1;
826 right
.x
= ANIMATION_MEET
+ ANIMATION_LENGTH
;
828 for (counter
= ANIMATION_LENGTH
; counter
> 0; counter
--)
832 /* Clear the previous position (empty the first time) */
833 drawchar(left
.x
- 1, left
.y
, ' ');
834 drawchar(right
.x
+ 1, right
.y
, ' ');
841 message("You found kitten! Way to go, robot!");
846 /******************************************************************************
848 * Begin initialization routines (called before play begins).
850 *****************************************************************************/
852 static void instructions()
854 #define WORDS (sizeof help_text / sizeof (char*))
855 static char* help_text
[] = {
857 /* Not sure if we want to include this? */
858 "robotfindskitten", RFK_VERSION
, "", "",
859 "By", "the", "illustrious", "Leonard", "Richardson", "(C)", "1997,", "2000", "",
860 "Written", "originally", "for", "the", "Nerth", "Pork", "robotfindskitten", "contest", "", "",
862 "In", "this", "game", "you", "are", "robot", "(#).", "Your", "job", "is",
863 "to", "find", "kitten.", "This", "task", "is", "complicated", "by", "the",
864 "existence", "of", "various", "things", "which", "are", "not", "kitten.",
865 "Robot", "must", "touch", "items", "to", "determine", "if", "they", "are",
866 "kitten", "or", "not.", "",
867 "The", "game", "ends", "when", "robotfindskitten.", "", "",
868 "Press", "any", "key", "to", "start",
870 display_text(WORDS
, help_text
, NULL
, NULL
);
874 static void initialize_arrays()
876 unsigned int counter
, counter2
;
877 struct screen_object empty
;
879 /*Initialize the empty object.*/
883 empty
.color
= LCD_BLACK
;
888 empty
.character
= ' ';
890 for (counter
= 0; counter
<= X_MAX
; counter
++)
892 for (counter2
= 0; counter2
<= Y_MAX
; counter2
++)
894 screen
[counter
][counter2
] = EMPTY
;
898 /*Initialize the other arrays.*/
899 for (counter
= 0; counter
< MESSAGES
; counter
++)
901 used_messages
[counter
] = false;
903 for (counter
= 0; counter
< NUM_BOGUS
; counter
++)
905 bogus_messages
[counter
] = 0;
906 bogus
[counter
] = empty
;
910 /*initialize_robot initializes robot.*/
911 static void initialize_robot()
913 /*Assign a position to the player.*/
917 robot
.character
= '#';
918 robot
.color
= ROBOT_COLOR
;
920 screen
[robot
.x
][robot
.y
] = ROBOT
;
923 /*initialize kitten, well, initializes kitten.*/
924 static void initialize_kitten()
926 /*Assign the kitten a unique position.*/
930 } while (screen
[kitten
.x
][kitten
.y
] != EMPTY
);
932 /*Assign the kitten a character and a color.*/
934 kitten
.character
= randchar();
935 } while (!(validchar(kitten
.character
)));
936 screen
[kitten
.x
][kitten
.y
] = KITTEN
;
938 kitten
.color
= colors
[randcolor()];
939 kitten
.bold
= randbold();
942 /*initialize_bogus initializes all non-kitten objects to be used in this run.*/
943 static void initialize_bogus()
946 for (counter
= 0; counter
< NUM_BOGUS
; counter
++)
949 bogus
[counter
].color
= colors
[randcolor()];
950 bogus
[counter
].bold
= randbold();
952 /*Give it a character.*/
954 bogus
[counter
].character
= randchar();
955 } while (!(validchar(bogus
[counter
].character
)));
957 /*Give it a position.*/
959 bogus
[counter
].x
= randx();
960 bogus
[counter
].y
= randy();
961 } while (screen
[bogus
[counter
].x
][bogus
[counter
].y
] != EMPTY
);
963 screen
[bogus
[counter
].x
][bogus
[counter
].y
] = counter
+2;
965 /*Find a message for this object.*/
967 index
= rb
->rand() % MESSAGES
;
968 } while (used_messages
[index
] != false);
969 bogus_messages
[counter
] = index
;
970 used_messages
[index
] = true;
975 /*initialize_screen paints the screen.*/
976 static void initialize_screen()
982 *Print the status portion of the screen.
984 rb
->lcd_clear_display();
985 rb
->lcd_setfont(FONT_SYSFIXED
);
986 rb
->snprintf(buf
, sizeof(buf
), "robotfindskitten %s", RFK_VERSION
);
987 rb
->lcd_puts_scroll(0, 0, buf
);
990 /*Draw a line across the screen.*/
991 for (counter
= X_MIN
; counter
<= X_MAX
+ 1; counter
++)
993 drawchar(counter
, ADV_ROW
+1, '_');
997 *Draw all the objects on the playing field.
999 for (counter
= 0; counter
< NUM_BOGUS
; counter
++)
1001 draw(bogus
[counter
]);
1011 /* this is the plugin entry point */
1012 enum plugin_status
plugin_start(const void* parameter
)
1018 rb
->srand(*rb
->current_tick
);
1020 initialize_arrays();
1023 * Now we initialize the various game objects.
1026 initialize_kitten();
1030 * Set up white-on-black screen on color targets
1033 rb
->lcd_set_backdrop(NULL
);
1034 rb
->lcd_set_foreground(LCD_WHITE
);
1035 rb
->lcd_set_background(LCD_BLACK
);
1043 initialize_screen();
1047 rb
->lcd_setfont(FONT_UI
);