lcd-m6sp.c: remove \r
[kugel-rb.git] / apps / plugins / robotfindskitten.c
blob0e5c94ea7e084fb0bac0b0ddb0e1e4bc89b2c609
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 # define RFK_QUIT PLA_CANCEL
473 # define RFK_RIGHT PLA_RIGHT
474 # define RFK_LEFT PLA_LEFT
475 # define RFK_UP PLA_UP
476 # define RFK_DOWN PLA_DOWN
477 # define RFK_RRIGHT PLA_RIGHT_REPEAT
478 # define RFK_RLEFT PLA_LEFT_REPEAT
479 # define RFK_RUP PLA_UP_REPEAT
480 # define RFK_RDOWN PLA_DOWN_REPEAT
482 /*Constants for our internal representation of the screen.*/
483 #define EMPTY -1
484 #define ROBOT 0
485 #define KITTEN 1
487 /* if SYSFONT_WIDTH is 0 (which it is during dependency generation) gcc
488 will abort (div by 0) and this plugin won't get any dependencies
490 #if SYSFONT_WIDTH < 1
491 #define SYSFONT_WIDTH 10
492 #define SYSFONT_HEIGHT 10
493 #endif
495 /*Screen dimensions.*/
496 #define X_MIN 0
497 #define X_MAX ((LCD_WIDTH/SYSFONT_WIDTH) - 1)
498 #define Y_MIN 3
499 #define Y_MAX ((LCD_HEIGHT/SYSFONT_HEIGHT) - 1)
501 /* Colours used */
502 #if LCD_DEPTH >= 16
503 #define NUM_COLORS 6
504 #define ROBOT_COLOR LCD_DARKGRAY
505 const unsigned colors[NUM_COLORS] = {
506 LCD_RGBPACK(255, 255, 0), /* Yellow */
507 LCD_RGBPACK(0, 255, 255), /* Cyan */
508 LCD_RGBPACK(255, 0, 255), /* Purple */
509 LCD_RGBPACK(0, 0, 255), /* Blue */
510 LCD_RGBPACK(255, 0, 0), /* Red */
511 LCD_RGBPACK(0, 255, 0), /* Green */
513 #elif LCD_DEPTH == 2
514 #define NUM_COLORS 3
515 #define ROBOT_COLOR LCD_DARKGRAY
516 const unsigned colors[NUM_COLORS] = {
517 LCD_LIGHTGRAY,
518 LCD_DARKGRAY,
519 LCD_BLACK,
521 #elif LCD_DEPTH == 1
522 #define NUM_COLORS 1
523 #define ROBOT_COLOR 0
524 const unsigned colors[NUM_COLORS] = {
527 #endif /* HAVE_LCD_COLOR */
529 /*Macros for generating numbers in different ranges*/
530 #define randx() (rb->rand() % X_MAX) + 1
531 #define randy() (rb->rand() % (Y_MAX-Y_MIN+1))+Y_MIN /*I'm feeling randy()!*/
532 #define randchar() rb->rand() % (126-'!'+1)+'!';
533 #define randcolor() rb->rand() % NUM_COLORS
534 #define randbold() (rb->rand() % 2 ? true:false)
536 /*Row constants for the animation*/
537 #define ADV_ROW 1
538 #define ANIMATION_MEET (X_MAX/3)*2
539 #define ANIMATION_LENGTH 4
541 /*This struct contains all the information we need to display an object
542 on the screen*/
543 struct screen_object
545 short x;
546 short y;
547 int color;
548 bool bold;
549 char character;
553 *Function definitions
556 /*Initialization and setup functions*/
557 static void initialize_arrays(void);
558 static void initialize_robot(void);
559 static void initialize_kitten(void);
560 static void initialize_bogus(void);
561 static void initialize_screen(void);
562 static void instructions(void);
563 static void finish(int sig);
565 /*Game functions*/
566 static void play_game(void);
567 static void process_input(int);
569 /*Helper functions*/
570 static void pause(void);
571 static int validchar(char);
572 static void play_animation(int);
574 /*Global variables. Bite me, it's fun.*/
575 struct screen_object robot;
576 struct screen_object kitten;
578 #if X_MAX*Y_MAX < 200
579 #define NUM_BOGUS 15
580 #else
581 #define NUM_BOGUS 20
582 #endif
583 struct screen_object bogus[NUM_BOGUS];
584 unsigned short bogus_messages[NUM_BOGUS];
585 bool used_messages[MESSAGES];
587 bool exit_rfk;
589 /* This array contains our internal representation of the screen. The
590 array is bigger than it needs to be, as we don't need to keep track
591 of the first few rows of the screen. But that requires making an
592 offset function and using that everywhere. So not right now. */
593 int screen[X_MAX + 1][Y_MAX + 1];
595 /******************************************************************************
597 * Begin meaty routines that do the dirty work.
599 *****************************************************************************/
601 static void drawchar(int x, int y, char c)
603 char str[2];
604 rb->snprintf(str, sizeof(str), "%c", c);
605 rb->lcd_putsxy(x*SYSFONT_WIDTH, y*SYSFONT_HEIGHT, str);
608 static void draw(struct screen_object o)
610 #if LCD_DEPTH > 1
611 unsigned oldforeground;
612 oldforeground = rb->lcd_get_foreground();
613 rb->lcd_set_foreground(o.color);
614 drawchar(o.x, o.y, o.character);
615 rb->lcd_set_foreground(oldforeground);
616 #else
617 drawchar(o.x, o.y, o.character);
618 #endif
621 static void message(char * str)
623 rb->lcd_puts_scroll(0, ADV_ROW, str);
626 static void refresh(void)
628 rb->lcd_update();
632 *play_game waits in a loop getting input and sending it to process_input
634 static void play_game()
636 int old_x = robot.x;
637 int old_y = robot.y;
638 int input = BUTTON_NONE;
639 const struct button_mapping *plugin_contexts[] = {pla_main_ctx};
641 while (input != RFK_QUIT && exit_rfk == false)
643 process_input(input);
645 /*Redraw robot, where applicable. We're your station, robot.*/
646 if (!(old_x == robot.x && old_y == robot.y))
648 /*Get rid of the old robot*/
649 drawchar(old_x, old_y, ' ');
650 screen[old_x][old_y] = EMPTY;
652 /*Meet the new robot, same as the old robot.*/
653 draw(robot);
654 refresh();
655 screen[robot.x][robot.y] = ROBOT;
657 old_x = robot.x;
658 old_y = robot.y;
660 input = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts,
661 ARRAYLEN(plugin_contexts));
663 message("Bye!");
664 refresh();
668 *Given the keyboard input, process_input interprets it in terms of moving,
669 *touching objects, etc.
671 static void process_input(int input)
673 int check_x = robot.x;
674 int check_y = robot.y;
676 switch (input)
678 case RFK_UP:
679 case RFK_RUP:
680 check_y--;
681 break;
682 case RFK_DOWN:
683 case RFK_RDOWN:
684 check_y++;
685 break;
686 case RFK_LEFT:
687 case RFK_RLEFT:
688 check_x--;
689 break;
690 case RFK_RIGHT:
691 case RFK_RRIGHT:
692 check_x++;
693 break;
696 /*Check for going off the edge of the screen.*/
697 if (check_y < Y_MIN || check_y > Y_MAX || check_x < X_MIN || check_x > X_MAX)
699 return; /*Do nothing.*/
703 * Clear textline
704 * disabled because it breaks the scrolling for some reason
706 /* rb->lcd_puts_scroll(0, ADV_ROW, " "); */
708 /*Check for collision*/
709 if (screen[check_x][check_y] != EMPTY)
711 switch (screen[check_x][check_y])
713 case ROBOT:
714 /*We didn't move, or we're stuck in a
715 time warp or something.*/
716 break;
717 case KITTEN: /*Found it!*/
718 play_animation(input);
719 /* Wait for the user to click something */
720 pause();
721 break;
722 default: /*We hit a bogus object; print its message.*/
723 message(messages[bogus_messages[screen[check_x][check_y]-2]]);
724 refresh();
725 break;
727 return;
730 /*Otherwise, move the robot.*/
731 robot.x = check_x;
732 robot.y = check_y;
735 /*finish is called upon signal or progam exit*/
736 static void finish(int sig)
738 (void)sig;
739 exit_rfk = true;
742 /******************************************************************************
744 * Begin helper routines
746 *****************************************************************************/
748 static void pause()
750 int button;
751 rb->lcd_update();
752 do {
753 button = rb->button_get(true);
755 while( ( button == BUTTON_NONE )
756 || ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
759 static int validchar(char a)
761 switch(a)
763 case '#':
764 case ' ':
765 case 127:
766 return 0;
768 return 1;
771 static void play_animation(int input)
773 int counter;
774 struct screen_object left;
775 struct screen_object right;
776 /*The grand cinema scene.*/
777 rb->lcd_puts_scroll(0, ADV_ROW, " ");
779 if (input == RFK_RIGHT || input == RFK_DOWN ||
780 input == RFK_RRIGHT || input == RFK_RDOWN)
782 left = robot;
783 right = kitten;
785 else {
786 left = kitten;
787 right = robot;
789 left.y = ADV_ROW;
790 right.y = ADV_ROW;
791 left.x = ANIMATION_MEET - ANIMATION_LENGTH - 1;
792 right.x = ANIMATION_MEET + ANIMATION_LENGTH;
794 for (counter = ANIMATION_LENGTH; counter > 0; counter--)
796 left.x++;
797 right.x--;
798 /* Clear the previous position (empty the first time) */
799 drawchar(left.x - 1, left.y, ' ');
800 drawchar(right.x + 1, right.y, ' ');
801 draw(left);
802 draw(right);
803 refresh();
804 rb->sleep(HZ);
807 message("You found kitten! Way to go, robot!");
808 refresh();
809 finish(0);
812 /******************************************************************************
814 * Begin initialization routines (called before play begins).
816 *****************************************************************************/
818 static void instructions()
820 static char* help_text[] = {
821 #if 0
822 /* Not sure if we want to include this? */
823 "robotfindskitten", RFK_VERSION, "", "",
824 "By", "the", "illustrious", "Leonard", "Richardson", "(C)", "1997,", "2000", "",
825 "Written", "originally", "for", "the", "Nerth", "Pork", "robotfindskitten", "contest", "", "",
826 #endif
827 "In", "this", "game", "you", "are", "robot", "(#).", "Your", "job", "is",
828 "to", "find", "kitten.", "This", "task", "is", "complicated", "by", "the",
829 "existence", "of", "various", "things", "which", "are", "not", "kitten.",
830 "Robot", "must", "touch", "items", "to", "determine", "if", "they", "are",
831 "kitten", "or", "not.", "",
832 "The", "game", "ends", "when", "robotfindskitten.", "", "",
833 "Press", "any", "key", "to", "start",
835 display_text(ARRAYLEN(help_text), help_text, NULL, NULL, false);
836 pause();
839 static void initialize_arrays()
841 unsigned int counter, counter2;
842 struct screen_object empty;
844 /*Initialize the empty object.*/
845 empty.x = -1;
846 empty.y = -1;
847 #if LCD_DEPTH > 1
848 empty.color = LCD_BLACK;
849 #else
850 empty.color = 0;
851 #endif
852 empty.bold = false;
853 empty.character = ' ';
855 for (counter = 0; counter <= X_MAX; counter++)
857 for (counter2 = 0; counter2 <= Y_MAX; counter2++)
859 screen[counter][counter2] = EMPTY;
863 /*Initialize the other arrays.*/
864 for (counter = 0; counter < MESSAGES; counter++)
866 used_messages[counter] = false;
868 for (counter = 0; counter < NUM_BOGUS; counter++)
870 bogus_messages[counter] = 0;
871 bogus[counter] = empty;
875 /*initialize_robot initializes robot.*/
876 static void initialize_robot()
878 /*Assign a position to the player.*/
879 robot.x = randx();
880 robot.y = randy();
882 robot.character = '#';
883 robot.color = ROBOT_COLOR;
884 robot.bold = false;
885 screen[robot.x][robot.y] = ROBOT;
888 /*initialize kitten, well, initializes kitten.*/
889 static void initialize_kitten()
891 /*Assign the kitten a unique position.*/
892 do {
893 kitten.x = randx();
894 kitten.y = randy();
895 } while (screen[kitten.x][kitten.y] != EMPTY);
897 /*Assign the kitten a character and a color.*/
898 do {
899 kitten.character = randchar();
900 } while (!(validchar(kitten.character)));
901 screen[kitten.x][kitten.y] = KITTEN;
903 kitten.color = colors[randcolor()];
904 kitten.bold = randbold();
907 /*initialize_bogus initializes all non-kitten objects to be used in this run.*/
908 static void initialize_bogus()
910 int counter, index;
911 for (counter = 0; counter < NUM_BOGUS; counter++)
913 /*Give it a color.*/
914 bogus[counter].color = colors[randcolor()];
915 bogus[counter].bold = randbold();
917 /*Give it a character.*/
918 do {
919 bogus[counter].character = randchar();
920 } while (!(validchar(bogus[counter].character)));
922 /*Give it a position.*/
923 do {
924 bogus[counter].x = randx();
925 bogus[counter].y = randy();
926 } while (screen[bogus[counter].x][bogus[counter].y] != EMPTY);
928 screen[bogus[counter].x][bogus[counter].y] = counter+2;
930 /*Find a message for this object.*/
931 do {
932 index = rb->rand() % MESSAGES;
933 } while (used_messages[index] != false);
934 bogus_messages[counter] = index;
935 used_messages[index] = true;
940 /*initialize_screen paints the screen.*/
941 static void initialize_screen()
943 int counter;
944 char buf[40];
947 *Print the status portion of the screen.
949 rb->lcd_clear_display();
950 rb->lcd_setfont(FONT_SYSFIXED);
951 rb->snprintf(buf, sizeof(buf), "robotfindskitten %s", RFK_VERSION);
952 rb->lcd_puts_scroll(0, 0, buf);
953 refresh();
955 /*Draw a line across the screen.*/
956 for (counter = X_MIN; counter <= X_MAX + 1; counter++)
958 drawchar(counter, ADV_ROW+1, '_');
962 *Draw all the objects on the playing field.
964 for (counter = 0; counter < NUM_BOGUS; counter++)
966 draw(bogus[counter]);
969 draw(kitten);
970 draw(robot);
972 refresh();
976 /* this is the plugin entry point */
977 enum plugin_status plugin_start(const void* parameter)
979 (void)parameter;
981 exit_rfk = false;
983 rb->srand(*rb->current_tick);
985 initialize_arrays();
988 * Now we initialize the various game objects.
990 initialize_robot();
991 initialize_kitten();
992 initialize_bogus();
995 * Set up white-on-black screen on color targets
997 #if LCD_DEPTH >= 16
998 rb->lcd_set_backdrop(NULL);
999 rb->lcd_set_foreground(LCD_WHITE);
1000 rb->lcd_set_background(LCD_BLACK);
1001 #endif
1004 * Run the game
1006 instructions();
1008 initialize_screen();
1010 play_game();
1012 rb->lcd_setfont(FONT_UI);
1013 return PLUGIN_OK;