22 pixel high Nimbus-like font, containing only digits and the period; intended for...
[kugel-rb.git] / apps / plugins / robotfindskitten.c
blob99fc32708551b200bbc0776471edc428f5c8b7e7
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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
31 #include "plugin.h"
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 */
37 PLUGIN_HEADER
39 /*Be sure to change MESSAGES when you change the array, or bad things
40 will happen.*/
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.",
79 "An 80286 machine.",
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.",
85 "Just a pincushion.",
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.",
93 "A plush Chewbacca.",
94 "Daily hunger conditioner from Australasia",
95 "Just some stuff.",
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.",
121 "A Mentos wrapper.",
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!\"",
255 "...thingy???",
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.",
298 "It's Death.",
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.",
332 "A screwdriver.",
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!",
344 "It's a bug.",
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.",
383 "It's a square.",
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.",
388 "No kitten here.",
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.",
409 "A caboodle.",
410 "A grin.",
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.",
427 "It's Roya Naini.",
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.",
449 "Tigerbot Hesh.",
450 "Stimutacs.",
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)
499 #elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
500 # undef __PLUGINLIB_ACTIONS_H__
501 # define RFK_QUIT (BUTTON_REC|BUTTON_REPEAT)
502 # define RFK_RIGHT BUTTON_RIGHT
503 # define RFK_LEFT BUTTON_LEFT
504 # define RFK_UP BUTTON_UP
505 # define RFK_DOWN BUTTON_DOWN
506 # define RFK_RRIGHT (BUTTON_PLAY | BUTTON_RIGHT)
507 # define RFK_RLEFT (BUTTON_PLAY | BUTTON_LEFT)
508 # define RFK_RUP (BUTTON_PLAY | BUTTON_UP)
509 # define RFK_RDOWN (BUTTON_PLAY | BUTTON_DOWN)
511 #else
512 # define RFK_QUIT PLA_QUIT
513 # define RFK_RIGHT PLA_RIGHT
514 # define RFK_LEFT PLA_LEFT
515 # define RFK_UP PLA_UP
516 # define RFK_DOWN PLA_DOWN
517 # define RFK_RRIGHT PLA_RIGHT_REPEAT
518 # define RFK_RLEFT PLA_LEFT_REPEAT
519 # define RFK_RUP PLA_UP_REPEAT
520 # define RFK_RDOWN PLA_DOWN_REPEAT
522 #endif
523 /*Constants for our internal representation of the screen.*/
524 #define EMPTY -1
525 #define ROBOT 0
526 #define KITTEN 1
528 /* if SYSFONT_WIDTH is 0 (which it is during dependency generation) gcc
529 will abort (div by 0) and this plugin won't get any dependencies
531 #if SYSFONT_WIDTH < 1
532 #define SYSFONT_WIDTH 10
533 #define SYSFONT_HEIGHT 10
534 #endif
536 /*Screen dimensions.*/
537 #define X_MIN 0
538 #define X_MAX ((LCD_WIDTH/SYSFONT_WIDTH) - 1)
539 #define Y_MIN 3
540 #define Y_MAX ((LCD_HEIGHT/SYSFONT_HEIGHT) - 1)
542 /* Colours used */
543 #if LCD_DEPTH >= 16
544 #define NUM_COLORS 6
545 #define ROBOT_COLOR LCD_DARKGRAY
546 const unsigned colors[NUM_COLORS] = {
547 LCD_RGBPACK(255, 255, 0), /* Yellow */
548 LCD_RGBPACK(0, 255, 255), /* Cyan */
549 LCD_RGBPACK(255, 0, 255), /* Purple */
550 LCD_RGBPACK(0, 0, 255), /* Blue */
551 LCD_RGBPACK(255, 0, 0), /* Red */
552 LCD_RGBPACK(0, 255, 0), /* Green */
554 #elif LCD_DEPTH == 2
555 #define NUM_COLORS 3
556 #define ROBOT_COLOR LCD_DARKGRAY
557 const unsigned colors[NUM_COLORS] = {
558 LCD_LIGHTGRAY,
559 LCD_DARKGRAY,
560 LCD_BLACK,
562 #elif LCD_DEPTH == 1
563 #define NUM_COLORS 1
564 #define ROBOT_COLOR 0
565 const unsigned colors[NUM_COLORS] = {
568 #endif /* HAVE_LCD_COLOR */
570 /*Macros for generating numbers in different ranges*/
571 #define randx() (rb->rand() % X_MAX) + 1
572 #define randy() (rb->rand() % (Y_MAX-Y_MIN+1))+Y_MIN /*I'm feeling randy()!*/
573 #define randchar() rb->rand() % (126-'!'+1)+'!';
574 #define randcolor() rb->rand() % NUM_COLORS
575 #define randbold() (rb->rand() % 2 ? true:false)
577 /*Row constants for the animation*/
578 #define ADV_ROW 1
579 #define ANIMATION_MEET (X_MAX/3)*2
580 #define ANIMATION_LENGTH 4
582 /*This struct contains all the information we need to display an object
583 on the screen*/
584 struct screen_object
586 short x;
587 short y;
588 int color;
589 bool bold;
590 char character;
594 *Function definitions
597 /*Initialization and setup functions*/
598 static void initialize_arrays(void);
599 static void initialize_robot(void);
600 static void initialize_kitten(void);
601 static void initialize_bogus(void);
602 static void initialize_screen(void);
603 static void instructions(void);
604 static void finish(int sig);
606 /*Game functions*/
607 static void play_game(void);
608 static void process_input(int);
610 /*Helper functions*/
611 static void pause(void);
612 static int validchar(char);
613 static void play_animation(int);
615 /*Global variables. Bite me, it's fun.*/
616 struct screen_object robot;
617 struct screen_object kitten;
619 #if X_MAX*Y_MAX < 200
620 #define NUM_BOGUS 15
621 #else
622 #define NUM_BOGUS 20
623 #endif
624 struct screen_object bogus[NUM_BOGUS];
625 unsigned short bogus_messages[NUM_BOGUS];
626 bool used_messages[MESSAGES];
628 bool exit_rfk;
630 /* This array contains our internal representation of the screen. The
631 array is bigger than it needs to be, as we don't need to keep track
632 of the first few rows of the screen. But that requires making an
633 offset function and using that everywhere. So not right now. */
634 int screen[X_MAX + 1][Y_MAX + 1];
636 /******************************************************************************
638 * Begin meaty routines that do the dirty work.
640 *****************************************************************************/
642 static void drawchar(int x, int y, char c)
644 char str[2];
645 rb->snprintf(str, sizeof(str), "%c", c);
646 rb->lcd_putsxy(x*SYSFONT_WIDTH, y*SYSFONT_HEIGHT, str);
649 static void draw(struct screen_object o)
651 #if LCD_DEPTH > 1
652 unsigned oldforeground;
653 oldforeground = rb->lcd_get_foreground();
654 rb->lcd_set_foreground(o.color);
655 drawchar(o.x, o.y, o.character);
656 rb->lcd_set_foreground(oldforeground);
657 #else
658 drawchar(o.x, o.y, o.character);
659 #endif
662 static void message(char * str)
664 rb->lcd_puts_scroll(0, ADV_ROW, str);
667 static void refresh(void)
669 rb->lcd_update();
673 *play_game waits in a loop getting input and sending it to process_input
675 static void play_game()
677 int old_x = robot.x;
678 int old_y = robot.y;
679 int input = BUTTON_NONE;
680 #ifdef __PLUGINLIB_ACTIONS_H__
681 const struct button_mapping *plugin_contexts[] = {generic_directions, generic_actions};
682 #endif
684 while (input != RFK_QUIT && exit_rfk == false)
686 process_input(input);
688 /*Redraw robot, where applicable. We're your station, robot.*/
689 if (!(old_x == robot.x && old_y == robot.y))
691 /*Get rid of the old robot*/
692 drawchar(old_x, old_y, ' ');
693 screen[old_x][old_y] = EMPTY;
695 /*Meet the new robot, same as the old robot.*/
696 draw(robot);
697 refresh();
698 screen[robot.x][robot.y] = ROBOT;
700 old_x = robot.x;
701 old_y = robot.y;
703 #ifdef __PLUGINLIB_ACTIONS_H__
704 input = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, 2);
705 #else
706 input = rb->button_get(true);
707 #endif
709 message("Bye!");
710 refresh();
714 *Given the keyboard input, process_input interprets it in terms of moving,
715 *touching objects, etc.
717 static void process_input(int input)
719 int check_x = robot.x;
720 int check_y = robot.y;
722 switch (input)
724 case RFK_UP:
725 case RFK_RUP:
726 check_y--;
727 break;
728 case RFK_DOWN:
729 case RFK_RDOWN:
730 check_y++;
731 break;
732 case RFK_LEFT:
733 case RFK_RLEFT:
734 check_x--;
735 break;
736 case RFK_RIGHT:
737 case RFK_RRIGHT:
738 check_x++;
739 break;
742 /*Check for going off the edge of the screen.*/
743 if (check_y < Y_MIN || check_y > Y_MAX || check_x < X_MIN || check_x > X_MAX)
745 return; /*Do nothing.*/
749 * Clear textline
750 * disabled because it breaks the scrolling for some reason
752 /* rb->lcd_puts_scroll(0, ADV_ROW, " "); */
754 /*Check for collision*/
755 if (screen[check_x][check_y] != EMPTY)
757 switch (screen[check_x][check_y])
759 case ROBOT:
760 /*We didn't move, or we're stuck in a
761 time warp or something.*/
762 break;
763 case KITTEN: /*Found it!*/
764 play_animation(input);
765 /* Wait for the user to click something */
766 pause();
767 break;
768 default: /*We hit a bogus object; print its message.*/
769 message(messages[bogus_messages[screen[check_x][check_y]-2]]);
770 refresh();
771 break;
773 return;
776 /*Otherwise, move the robot.*/
777 robot.x = check_x;
778 robot.y = check_y;
781 /*finish is called upon signal or progam exit*/
782 static void finish(int sig)
784 (void)sig;
785 exit_rfk = true;
788 /******************************************************************************
790 * Begin helper routines
792 *****************************************************************************/
794 static void pause()
796 int button;
797 rb->lcd_update();
798 do {
799 button = rb->button_get(true);
801 while( ( button == BUTTON_NONE )
802 || ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
805 static int validchar(char a)
807 switch(a)
809 case '#':
810 case ' ':
811 case 127:
812 return 0;
814 return 1;
817 static void play_animation(int input)
819 int counter;
820 struct screen_object left;
821 struct screen_object right;
822 /*The grand cinema scene.*/
823 rb->lcd_puts_scroll(0, ADV_ROW, " ");
825 if (input == RFK_RIGHT || input == RFK_DOWN ||
826 input == RFK_RRIGHT || input == RFK_RDOWN)
828 left = robot;
829 right = kitten;
831 else {
832 left = kitten;
833 right = robot;
835 left.y = ADV_ROW;
836 right.y = ADV_ROW;
837 left.x = ANIMATION_MEET - ANIMATION_LENGTH - 1;
838 right.x = ANIMATION_MEET + ANIMATION_LENGTH;
840 for (counter = ANIMATION_LENGTH; counter > 0; counter--)
842 left.x++;
843 right.x--;
844 /* Clear the previous position (empty the first time) */
845 drawchar(left.x - 1, left.y, ' ');
846 drawchar(right.x + 1, right.y, ' ');
847 draw(left);
848 draw(right);
849 refresh();
850 rb->sleep(HZ);
853 message("You found kitten! Way to go, robot!");
854 refresh();
855 finish(0);
858 /******************************************************************************
860 * Begin initialization routines (called before play begins).
862 *****************************************************************************/
864 static void instructions()
866 static char* help_text[] = {
867 #if 0
868 /* Not sure if we want to include this? */
869 "robotfindskitten", RFK_VERSION, "", "",
870 "By", "the", "illustrious", "Leonard", "Richardson", "(C)", "1997,", "2000", "",
871 "Written", "originally", "for", "the", "Nerth", "Pork", "robotfindskitten", "contest", "", "",
872 #endif
873 "In", "this", "game", "you", "are", "robot", "(#).", "Your", "job", "is",
874 "to", "find", "kitten.", "This", "task", "is", "complicated", "by", "the",
875 "existence", "of", "various", "things", "which", "are", "not", "kitten.",
876 "Robot", "must", "touch", "items", "to", "determine", "if", "they", "are",
877 "kitten", "or", "not.", "",
878 "The", "game", "ends", "when", "robotfindskitten.", "", "",
879 "Press", "any", "key", "to", "start",
881 display_text(ARRAYLEN(help_text), help_text, NULL, NULL, false);
882 pause();
885 static void initialize_arrays()
887 unsigned int counter, counter2;
888 struct screen_object empty;
890 /*Initialize the empty object.*/
891 empty.x = -1;
892 empty.y = -1;
893 #if LCD_DEPTH > 1
894 empty.color = LCD_BLACK;
895 #else
896 empty.color = 0;
897 #endif
898 empty.bold = false;
899 empty.character = ' ';
901 for (counter = 0; counter <= X_MAX; counter++)
903 for (counter2 = 0; counter2 <= Y_MAX; counter2++)
905 screen[counter][counter2] = EMPTY;
909 /*Initialize the other arrays.*/
910 for (counter = 0; counter < MESSAGES; counter++)
912 used_messages[counter] = false;
914 for (counter = 0; counter < NUM_BOGUS; counter++)
916 bogus_messages[counter] = 0;
917 bogus[counter] = empty;
921 /*initialize_robot initializes robot.*/
922 static void initialize_robot()
924 /*Assign a position to the player.*/
925 robot.x = randx();
926 robot.y = randy();
928 robot.character = '#';
929 robot.color = ROBOT_COLOR;
930 robot.bold = false;
931 screen[robot.x][robot.y] = ROBOT;
934 /*initialize kitten, well, initializes kitten.*/
935 static void initialize_kitten()
937 /*Assign the kitten a unique position.*/
938 do {
939 kitten.x = randx();
940 kitten.y = randy();
941 } while (screen[kitten.x][kitten.y] != EMPTY);
943 /*Assign the kitten a character and a color.*/
944 do {
945 kitten.character = randchar();
946 } while (!(validchar(kitten.character)));
947 screen[kitten.x][kitten.y] = KITTEN;
949 kitten.color = colors[randcolor()];
950 kitten.bold = randbold();
953 /*initialize_bogus initializes all non-kitten objects to be used in this run.*/
954 static void initialize_bogus()
956 int counter, index;
957 for (counter = 0; counter < NUM_BOGUS; counter++)
959 /*Give it a color.*/
960 bogus[counter].color = colors[randcolor()];
961 bogus[counter].bold = randbold();
963 /*Give it a character.*/
964 do {
965 bogus[counter].character = randchar();
966 } while (!(validchar(bogus[counter].character)));
968 /*Give it a position.*/
969 do {
970 bogus[counter].x = randx();
971 bogus[counter].y = randy();
972 } while (screen[bogus[counter].x][bogus[counter].y] != EMPTY);
974 screen[bogus[counter].x][bogus[counter].y] = counter+2;
976 /*Find a message for this object.*/
977 do {
978 index = rb->rand() % MESSAGES;
979 } while (used_messages[index] != false);
980 bogus_messages[counter] = index;
981 used_messages[index] = true;
986 /*initialize_screen paints the screen.*/
987 static void initialize_screen()
989 int counter;
990 char buf[40];
993 *Print the status portion of the screen.
995 rb->lcd_clear_display();
996 rb->lcd_setfont(FONT_SYSFIXED);
997 rb->snprintf(buf, sizeof(buf), "robotfindskitten %s", RFK_VERSION);
998 rb->lcd_puts_scroll(0, 0, buf);
999 refresh();
1001 /*Draw a line across the screen.*/
1002 for (counter = X_MIN; counter <= X_MAX + 1; counter++)
1004 drawchar(counter, ADV_ROW+1, '_');
1008 *Draw all the objects on the playing field.
1010 for (counter = 0; counter < NUM_BOGUS; counter++)
1012 draw(bogus[counter]);
1015 draw(kitten);
1016 draw(robot);
1018 refresh();
1022 /* this is the plugin entry point */
1023 enum plugin_status plugin_start(const void* parameter)
1025 (void)parameter;
1027 exit_rfk = false;
1029 rb->srand(*rb->current_tick);
1031 initialize_arrays();
1034 * Now we initialize the various game objects.
1036 initialize_robot();
1037 initialize_kitten();
1038 initialize_bogus();
1041 * Set up white-on-black screen on color targets
1043 #if LCD_DEPTH >= 16
1044 rb->lcd_set_backdrop(NULL);
1045 rb->lcd_set_foreground(LCD_WHITE);
1046 rb->lcd_set_background(LCD_BLACK);
1047 #endif
1050 * Run the game
1052 instructions();
1054 initialize_screen();
1056 play_game();
1058 rb->lcd_setfont(FONT_UI);
1059 return PLUGIN_OK;