Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options


by idnopheq (Chaplain)
on Aug 13, 2001 at 20:04 UTC ( #104472=sourcecode: print w/replies, xml ) Need Help??
Category: Fun Stuff
Author/Contact Info idnopheq
Description: horoscope -- see what the stars have in store for YOU!

I'm not terribly happy right now on how I did this (subs, redundent randomness, additional redunacies, etc.), yet it does work. Comments and recommendations are appreciated.

UPDATE 0: this is my first stab at converting lisp ( which I'm not terribly good at ) to perl. But this thing is so much fun, I could not help myself.

UPDATE 1: Thanks to Albannach and his advice on CB, I rewrote this whole thing as a Hash of Arrays, shortening the script considerably. NodeReaper has yet to make an apperance in this. Please, as before, comments are solicited.

#!/usr/bin/perl -w


=head1 NAME

B<horoscope> -- see what the stars have in store for YOU!




B<horoscope>, created 1995-08-02, returns YOUR future!

kleped it from horoscope.el,v 1.2 1998/12/11

Bob Manson originally wrote this program in ksh,
then later converted it to emacs lisp.
Noah Friedman rewrote parts of the engine.
Dexter Coffin (poorly) converted it to perl and added some stuff,
klepping it from horoscope.el,v 1.2 1998/12/11 on 2001/08/13.


use strict;
use diagnostics;

srand ( time () ^ ( $$ + ( $$ << 15 ) ) );

my %horoscope = ();

@{$horoscope{'personverb'}}   = (
        "sit next to you on the bus",
        "give you good advice",
        "become pregnant",
        "kiss you",
        "make you feel warm and fuzzy",
        "eat your mail",
        "lift weights",
        "hit you",
        "give you pennies",
        "share intimate feelings",
        "throw up",

@{$horoscope{'thingverb'}}    = (
        "opened up",

@{$horoscope{'planet'}}       = (
        "the Moon"

@{$horoscope{'number'}}       = (

@{$horoscope{'side'}}         = (
        "left-hand quadrant",
        "right-hand quadrant",
        "upper half",
        "lower half",

@{$horoscope{'zodiac'}}       = (

@{$horoscope{'luckynum'}}     = (
        "Your lucky number today is 29842924728.  Look for it everywhe
        "12 is your lucky number",
        "Your lucky numbers are 20, 30, and 40",
        "Don't forget, it's only 366 days at most until Christmas",
        "The answer to all your questions is 42",
        "You will find yourself bound by the Law of Fives"

@{$horoscope{'animal'}}       = (
        "mutant shrimp",
        "talking fish",
        "penguin on the television"

@{$horoscope{'action'}}       = (
        "making love",
        "straining in the toilet",
        "washing clothes",
        "becoming pregnant",
        "doing something",
        "asking for a raise",
        "starting a revolution",
        "becoming paranoid",
        "reading mail",
        "talking with piglet3",
        "balancing a checkbook",
        "stealing from the company",
        "buying a new computer",
        "using a Torx \#9 wrench",
        "not answering the phone",
        "staying where you are",
        "cleaning the fridge",
        "wearing clothes"

@{$horoscope{'time'}}         = (

@{$horoscope{'attime'}}      = (
        "this week",
        "this month",
        "right now",

@{$horoscope{'value'}}        = (
        "quite worthwhile",
        "a good idea",
        "a positive step in the right direction"

@{$horoscope{'likevalue'}}   = (
        "quite worthwhile",
        "like a good idea",
        "like a positive step in the right direction",
        "like a maze of twisty passages, all alike",
        "like a maze of twisty passages, all different"

@{$horoscope{'noun'}}         = (
        "endothermic therapsid",
        "life insurance",

@{$horoscope{'dothing'}}      = (
        "brush its teeth",
        "take a bath",
        "make love",
        "mow the lawn",
        "go shopping",
        "rotate the TV antenna",
        "eat worms",
        "genetically engineer your plants",
        "drink a bath",
        "get life insurance from a TV ad"

@{$horoscope{'evilpeople'}}   = (
        "god-fearing Crustaceans",
        "the Doctor",
        "the Dentist",
        "aliens from Mars",

@{$horoscope{'evilperson'}}   = (
        "an Iranian",
        "an Iraqui",
        "an American",
        "a god-fearing Crustacean",
        "an alien",
        "a bobbie",
        "a loon",
        "a Frenchman",
        "a German",
        "an alien from Mars",
        "a Republican",
        "a Democrat",
        "a Communist",
        "a Socialist",
        "an idiot",
        "an artist"

@{$horoscope{'thing'}}        = (
        "nasty body odor",
        "fortune good or bad,",
        "a gift",
        "a small bomb",
        "a flight recorder",
        "a large dog",
        "a piglet",
        "a steering wheel",
        "a toaster oven with a built-in clock radio",
        "an egg",
        "bad weather",
        "good weather",
        "a deadly disease"

@{$horoscope{'state'}}        = (
        "a Borg",

@{$horoscope{'statenoun'}}    = (

@{$horoscope{'color'}}        = (
        "hot pink"

@{$horoscope{'adjective'}}    = (

@{$horoscope{'relationship'}} = (
        "corporate stooge",
        "local convenience store clerk"

@{$horoscope{'moneystates'}}  = (

@{$horoscope{'vaguenumber'}}  = (
        "4 or 9",
        "1 or 7"

@{$horoscope{'greeted'}}      = (
        "said hello to",
        "shook hands with",
        "talked to",
        "fondled gently",
        "gave an organ to"

@{$horoscope{'times'}}        = (
        "a few times",
        "5 or 11 times",
        "3 to 6 times",
        "988,122 times"

@{$horoscope{'consider'}}     = (
        "think about",
        "make a stab at",
        "meditate upon",
        "look at deeply",

@{$horoscope{'zodplace'}}     = (

        ${$horoscope{'zodiac'}}[rand @{$horoscope{'zodiac'}}], 

        "the ${$horoscope{'number'}}[rand @{$horoscope{'number'}}] hou
+se of ${$horoscope{'zodiac'}}[rand @{$horoscope{'zodiac'}}]",

        "the ${$horoscope{'side'}}[rand @{$horoscope{'side'}}] of ${$h
+oroscope{'zodiac'}}[rand @{$horoscope{'zodiac'}}]"


@{$horoscope{'thingstodo'}}   = (
        "set your clock",
        "get married ${$horoscope{'attime'}}[rand @{$horoscope{'attime
        "dye your hair",
        "move away",
        "have your ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}] s
+payed or neutered",
        "watch Dr. Who",
        "watch Wheel of Fortune",
        "see your psychologist",
        "talk to your plants",
        "pet piglet",
        "clean your apartment",
        "think about financial concerns",
        "discuss life with RMS",
        "marry the milkperson",
        "adjust your girdle",
        "tune your stereo",
        "tune your car",
        "lift weights",
        "play Sam and Max Hit the Road",
        "play Car Bomb",
        "use strict\;"
@{$horoscope{'verb'}}         = (
        "become pregnant",
        "eat holes in your carpet",
        "piss on the bed",
        "eat watermelon",
        "sell your house",
        "give away your ${$horoscope{'relationship'}}[rand @{$horoscop
+e{'relationship'}}] to ${$horoscope{'evilpeople'}}[rand @{$horoscope{
        "talk to piglet",
        "get a ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}]",
        "have financial problems",
        "adjust your girdle",
        "sit quietly",
        "put money in the bank",
        "play games"
@{$horoscope{'discovery'}}    = (
        "you are married",
        "you have two left feet",
        "Nazi Germany is your country of birth",
        "you do not have a pet",
        "several Conspiracy members are following you",
        "the wives are catching colds",
        "your ${$horoscope{'relationship'}}[rand @{$horoscope{'relatio
+nship'}}] is confused",
        "your ${$horoscope{'relationship'}}[rand @{$horoscope{'relatio
+nship'}}] is an alien",
        "you lost your piglet",
        "someone thinks of you as Liza Minelli",
        "you are Madonna's child",
        "your long-lost brother is lost",
        "${$horoscope{'evilpeople'}}[rand @{$horoscope{'evilpeople'}}]
+ are abusing your ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}]",
        "your ${$horoscope{'relationship'}}[rand @{$horoscope{'relatio
+nship'}}] was responsible for the overthrow of Communist Russia",
        "your ${$horoscope{'relationship'}}[rand @{$horoscope{'relatio
+nship'}}] is a ${$horoscope{'evilperson'}}[rand @{$horoscope{'evilper
        "you're originally from ${$horoscope{'planet'}}[rand @{$horosc
        "using a ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}] as 
+a sex toy is ${$horoscope{'value'}}[rand @{$horoscope{'value'}}]"
@{$horoscope{'change'}}       = (
        "turning ${$horoscope{'color'}}[rand @{$horoscope{'color'}}]",
        ${$horoscope{'color'}}[rand @{$horoscope{'color'}}]
@{$horoscope{'when'}}         = (
        "fall into a state of ${$horoscope{'statenoun'}}[rand @{$horos
+cope{'statenoun'}}] but eventually",
        "perhaps in a few ${$horoscope{'time'}}[rand @{$horoscope{'tim
        "once in a while"
@{$horoscope{'event'}}        = (
        "a party",
        "a gathering of some sort",
        "a social reception",
        "an intimate office party",
        "your ${$horoscope{'relationship'}}[rand @{$horoscope{'relatio
+nship'}}]'s wedding",
        "${$horoscope{'evilperson'}}[rand @{$horoscope{'evilperson'}}]
+\'s trial",
        "a bad frat party",
        "Underwear City",
        "at the phlebotomist's"

@{$horoscope{'person'}}       = (
     "a stranger",
     "a friend",
     "your " . ${$horoscope{'relationship'}}[rand @{$horoscope{'relati
     "someone you ${$horoscope{'greeted'}}[rand @{$horoscope{'greeted'
+}}] ${$horoscope{'times'}}[rand @{$horoscope{'times'}}] at ${$horosco
+pe{'event'}}[rand @{$horoscope{'event'}}]",
     "your ${$horoscope{'animal'}}[rand @{$horoscope{'animal'}}]",
     "your teddy bear",
     "your mom",
     "the mailman",
     "the man",
     "your wonderful pet ${$horoscope{'animal'}}[rand @{$horoscope{'an
     "your child",
     "your spouse",
     "a wallflower",
     "a lout",
     "a warmonger",
     "two other people put together",
     "someone you know",
     "Larry Wall"


@{$horoscope{'try'}}          = (
        "attempted lightly",
        "tried without the advice of a doctor",
        "considered unusual",
        "done under the influence of alcohol",
        "achieved with the help of ZenIRC",
        "done while wearing a girdle", "stared at",
        "questioned by ${$horoscope{'person'}}[rand @{$horoscope{'pers
        "performed by a ${$horoscope{'relationship'}}[rand @{$horoscop
        "shown on TV",
        "shown to small children"
@{$horoscope{'bullshit'}}     = (

        "As ${$horoscope{'planet'}}[rand @{$horoscope{'planet'}}] move
+s into ${$horoscope{'zodplace'}}[rand @{$horoscope{'zodplace'}}] be c
+areful of your relationship with your ${$horoscope{'relationship'}}[r
+and @{$horoscope{'relationship'}}]",

        "You will be in conflict with ${$horoscope{'zodiac'}}[rand @{$
+horoscope{'zodiac'}}] since ${$horoscope{'planet'}}[rand @{$horoscope
+{'planet'}}] has moved into ${$horoscope{'zodiac'}}[rand @{$horoscope


@{$horoscope{'sentence0'}}    = (

   ucfirst "${$horoscope{'person'}}[rand @{$horoscope{'person'}}] will
+ ${$horoscope{'personverb'}}[rand @{$horoscope{'personverb'}}] ${$hor
+oscope{'attime'}}[rand @{$horoscope{'attime'}}]",

   ucfirst "${$horoscope{'attime'}}[rand @{$horoscope{'attime'}}] is n
+ot a good time for ${$horoscope{'action'}}[rand @{$horoscope{'action'

   "Your ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}] will ${$hor
+oscope{'verb'}}[rand @{$horoscope{'verb'}}] soon",

   ucfirst "${$horoscope{'thing'}}[rand @{$horoscope{'thing'}}] is not
+ in the air",

   "You will discover that ${$horoscope{'discovery'}}[rand @{$horoscop

   ucfirst "${$horoscope{'attime'}}[rand @{$horoscope{'attime'}}] will
+ be a good time for ${$horoscope{'action'}}[rand @{$horoscope{'action

   "Be sure to ${$horoscope{'verb'}}[rand @{$horoscope{'verb'}}] befor
+e you find out that ${$horoscope{'discovery'}}[rand @{$horoscope{'dis

   "Your programs will start ${$horoscope{'action'}}[rand @{$horoscope

   "Look for ${$horoscope{'person'}}[rand @{$horoscope{'person'}}] wit
+h one eye",

   "Don't let ${$horoscope{'person'}}[rand @{$horoscope{'person'}}] ${
+$horoscope{'dothing'}}[rand @{$horoscope{'dothing'}}] with your ${$ho
+roscope{'noun'}}[rand @{$horoscope{'noun'}}]",

   "Listen to your ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}] $
+{$horoscope{'attime'}}[rand @{$horoscope{'attime'}}]",

   "Your ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}] will be ${$
+horoscope{'change'}}[rand @{$horoscope{'change'}}] in the next ${$hor
+oscope{'vaguenumber'}}[rand @{$horoscope{'vaguenumber'}}] ${$horoscop
+e{'time'}}[rand @{$horoscope{'time'}}]",

   ucfirst "${$horoscope{'thingstodo'}}[rand @{$horoscope{'thingstodo'

   "You might want to consider ${$horoscope{'action'}}[rand @{$horosco

   ucfirst "${$horoscope{'time'}}[rand @{$horoscope{'time'}}] from now
+ ${$horoscope{'action'}}[rand @{$horoscope{'action'}}] may seem ${$ho
+roscope{'likevalue'}}[rand @{$horoscope{'likevalue'}}]",

   "Do not ${$horoscope{'verb'}}[rand @{$horoscope{'verb'}}] ${$horosc
+ope{'attime'}}[rand @{$horoscope{'attime'}}]",

   ucfirst "${$horoscope{'person'}}[rand @{$horoscope{'person'}}] ${$h
+oroscope{'adjective'}}[rand @{$horoscope{'adjective'}}] ${$horoscope{
+'relationship'}}[rand @{$horoscope{'relationship'}}]",

   ucfirst "${$horoscope{'attime'}}[rand @{$horoscope{'attime'}}] ${$h
+oroscope{'person'}}[rand @{$horoscope{'person'}}] ${$horoscope{'thing
+stodo'}}[rand @{$horoscope{'thingstodo'}}]",

   "Don\'t ${$horoscope{'thingstodo'}}[rand @{$horoscope{'thingstodo'}
+}] ${$horoscope{'attime'}}[rand @{$horoscope{'attime'}}]",

   "Put your ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}] on hold
+ ${$horoscope{'attime'}}[rand @{$horoscope{'attime'}}]",

   "Loaning money to your ${$horoscope{'relationship'}}[rand @{$horosc
+ope{'relationship'}}] will bring dividends",

   ${$horoscope{'bullshit'}}[rand @{$horoscope{'bullshit'}}]


@{$horoscope{'sentence1'}}    = (

   ucfirst "${$horoscope{'person'}}[rand @{$horoscope{'person'}}] will
+ eventually reveal itself to be ${$horoscope{'person'}}[rand @{$horos

   "Your efforts at ${$horoscope{'action'}}[rand @{$horoscope{'action'
+}}] turn out to be ${$horoscope{'value'}}[rand @{$horoscope{'value'}}

   "Many people will ask you for advice about ${$horoscope{'action'}}[
+rand @{$horoscope{'action'}}]",

   ucfirst "${$horoscope{'person'}}[rand @{$horoscope{'person'}}] will
+ think of you as ${$horoscope{'person'}}[rand @{$horoscope{'person'}}

   "Beware of ${$horoscope{'person'}}[rand @{$horoscope{'person'}}] be
+aring ${$horoscope{'thing'}}[rand @{$horoscope{'thing'}}]",

   "Loving your ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}] now 
+will turn out to be ${$horoscope{'value'}}[rand @{$horoscope{'value'}
+}] after a few ${$horoscope{'time'}}[rand @{$horoscope{'time'}}]",

   "Don't forget to ${$horoscope{'thingstodo'}}[rand @{$horoscope{'thi

   ucfirst "${$horoscope{'thingstodo'}}[rand @{$horoscope{'thingstodo'
+}}] with the help of ${$horoscope{'person'}}[rand @{$horoscope{'perso

   "Never ${$horoscope{'thingstodo'}}[rand @{$horoscope{'thingstodo'}}
+] without ${$horoscope{'action'}}[rand @{$horoscope{'action'}}] first

   "Do something nice for ${$horoscope{'person'}}[rand @{$horoscope{'p
+erson'}}] ${$horoscope{'attime'}}[rand @{$horoscope{'attime'}}]",

   "You will meet ${$horoscope{'person'}}[rand @{$horoscope{'person'}}
+] this week",

   "Your ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}] will need t
+o be thing${$horoscope{'verb'}}[rand @{$horoscope{'verb'}}] ${$horosc
+ope{'attime'}}[rand @{$horoscope{'attime'}}]",

   ucfirst "${$horoscope{'evilpeople'}}[rand @{$horoscope{'evilpeople'
+}}] will ${$horoscope{'verb'}}[rand @{$horoscope{'verb'}}] ${$horosco
+pe{'attime'}}[rand @{$horoscope{'attime'}}]",

   ucfirst "${$horoscope{'attime'}}[rand @{$horoscope{'attime'}}] ${$h
+oroscope{'thing'}}[rand @{$horoscope{'thing'}}] would be a good thing
+ to ${$horoscope{'consider'}}[rand @{$horoscope{'consider'}}]",

   "Stealing a ${$horoscope{'noun'}}[rand @{$horoscope{'noun'}}] shoul
+d not be ${$horoscope{'try'}}[rand @{$horoscope{'try'}}]",

   "Your finances will become ${$horoscope{'moneystates'}}[rand @{$hor
+oscope{'moneystates'}}] in the next several ${$horoscope{'time'}}[ran
+d @{$horoscope{'time'}}]",

   ${$horoscope{'bullshit'}}[rand @{$horoscope{'bullshit'}}]


@{$horoscope{'paragraph'}} = (

          "${$horoscope{'sentence0'}}[rand @{$horoscope{'sentence0'}}]
+. ${$horoscope{'sentence1'}}[rand @{$horoscope{'sentence1'}}]. ${$hor
+oscope{'sentence0'}}[rand @{$horoscope{'sentence0'}}]\. ${$horoscope{
+'sentence1'}}[rand @{$horoscope{'sentence1'}}]. You'll ${$horoscope{'
+when'}}[rand @{$horoscope{'when'}}] be ${$horoscope{'state'}}[rand @{
+$horoscope{'state'}}]. ${$horoscope{'luckynum'}}[rand @{$horoscope{'l
          "${$horoscope{'sentence0'}}[rand @{$horoscope{'sentence0'}}]
+. ${$horoscope{'sentence1'}}[rand @{$horoscope{'sentence1'}}]. ${$hor
+oscope{'sentence1'}}[rand @{$horoscope{'sentence1'}}]. You'll ${$horo
+scope{'when'}}[rand @{$horoscope{'when'}}] be ${$horoscope{'state'}}[
+rand @{$horoscope{'state'}}].",
          "${$horoscope{'sentence1'}}[rand @{$horoscope{'sentence1'}}]
+. ${$horoscope{'sentence0'}}[rand @{$horoscope{'sentence0'}}]. ${$hor
+oscope{'sentence0'}}[rand @{$horoscope{'sentence0'}}]. ${$horoscope{'
+sentence1'}}[rand @{$horoscope{'sentence1'}}]. You'll ${$horoscope{'w
+hen'}}[rand @{$horoscope{'when'}}] be ${$horoscope{'state'}}[rand @{$

do {
  foreach my $foo ( sort keys %horoscope ) {
    print "$foo: " , scalar ( @{$horoscope{$foo}} ) , "\n";
    foreach my $bar ( sort @{$horoscope{$foo}} ) {
      print "\t$bar\n";
  if $ARGV[0] && $ARGV[0] =~ /d/;

print "\n${$horoscope{'paragraph'}}[rand @{$horoscope{'paragraph'}}]\n


=head1 BUGS

B<horoscope> suffers from no known bugs at this time.  But I'm not too
pleased with the wacky randomization I krufted.

Believed to work on Windows NT, Windows 2K, Solaris, Linux, and NetBSD


Ask the "Psychic Friends Network".


    Revision 1.0  2001/08/13 11:34:03  idnopheq
    Initial revision

=head1 AUTHOR

The Perl implementation of B<horoscope> was written by Dexter Coffin,


=head1 SEE ALSO


=for html

Replies are listed 'Best First'.
Re: horoscope
by mugwumpjism (Hermit) on Aug 21, 2001 at 04:59 UTC

    Why do you preclude the possibility that horoscopes might work? Because you can't see any way that they could possibly work, given the current status quo scientific model of reality?

    Divination is an age old tradition of many cultures, including the I Ching, Tarot and Astrology to name but a few. The holographic model of the universe may offer an explanation to why these ancient divination processes actually work. (If they didn't work, they wouldn't have found the widespread acceptance they have now. People aren't that stupid)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://104472]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2020-09-30 05:20 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (159 votes). Check out past polls.