POV-Ray : Newsgroups : povray.text.scene-files : silly use of pov Server Time
23 Dec 2024 06:44:00 EST (-0500)
  silly use of pov (Message 1 to 6 of 6)  
From: Pete
Subject: silly use of pov
Date: 20 May 2001 20:02:19
Message: <6778.539T1442T13074611PeterC@nym.alias.net>
The cafeteria at work has begun to put some things on the
menu.  For example: one day they had a pizza burger.  The following
day they had a burger pizza.  They started to do weird combinations.
As a gag, I wrote a pov script to generate random menu ideas.  This
will be two files, "random.inc" and the main file" "leersunch.pov".
        To use, run (render) leersunch.pov.  This will create a file
called "menu.txt".  If the menu.txt file already exists, it will be
appended to.  Every render of leersunch.pov will add 20 random
dishes to the file.  It can generate some odd combinations.
        The code was thrown together real quick so there could
be bugs that I havn't found yet.

Enjoy

---- random.inc ----

/*

   a system for self-reseeding randomness in povray.  This enables a povray

   file have a different random number seed each time it is run.

   

   To use, simply include this file, then call "get_seed()" once.  Then use

   rseed as your seed troughout your render.  The last atatement in your .pov

   file should be a call to "update_seed()".



   The random seed will be stored in "randseed.pov"

*/





#macro get_seed()

  #if (file_exists("randseed.pov") = 1)

    #include "randseed.pov"

    // what if the file was bad or incomplete?

    #ifndef (rseed) // was this defined?

      // no.  It was not.  Fake it and hope better for next time around

      #render "bad randseed.pov file ... making a new one\n")

      #declare rseed = seed(83963179);

    #end

  #else

    // The file was not found.  Fake it and hope better for next time around

    #render "no randseed.pov file found ... making a new one\n")

    #declare rseed = seed(74747285);

  #end

  #ifndef (rseed)

    #render "\nWTF!  rseed STILL not defined!  That's impossible!!\n"

    #render "\g YOU HAVE A PROBLEM!!!!!\n"

  #end

#end





// update the random seed now that we are done with it.

#macro update_seed()

  #ifdef (rseed)

    #local new_seed = 99999999 * rand(rseed);

    #local new_seed = int(new_seed);

    #fopen F1 "randseed.pov" write

    #write (F1, "#declare rseed = seed(", str(new_seed, 0, 0), ");\n")

     #write (F1, "#render \"Seed used is: seed(", str(new_seed, 0, 0), ")
\"\n")

    #write (F1, "#render \"\"\n")

    #fclose F1

  #end

#end





/* actual end of this_file */


 ---- leersunch.pov ----

#include "random.inc"





get_seed()





#declare ntsc = false;

#declare last_word = "nothing"





#declare num_locations = 9;

#declare locations = array[num_locations] {

  "Italian",

  "Boston",

  "Chicago style",

  "Mexican",

  "San Francisco",



  "New England",

  "French",

  "Carolina",

  "Texas"

}





#declare num_pre_styles = 23;

#declare pre_styles = array[num_pre_styles] {

  "Cajun",

  "zesty",

  "barbecued",

  "pulled",

  "rubbed",



  "jerked",

  "marinated",

  "skewered",

  "boiled",

  "grilled",



  "fricasseed",

  "blackened",

  "deluxe",

  "old fashioned",

  "continental",



  "vegetable",

  "refried",

  "glazed",

  "Buffalo",

  "caramelized",



  "baked",

  "pan fried",

  "beer battered"

}





#declare num_post_styles = 6;

#declare post_styles = array[num_post_styles] {

  "au gratin",

  "du jour",

  "fondue",

  "surprise",

  "Santa Fe",



  "marinara"

}





#declare num_what_it_is = 13;

#declare what_it_is = array[num_what_it_is] {

  "burger",

  "chicken",

  "pizza",

  "salad",

  "meatloaf",



  "taco",

  "gyro",

  "omelet",

  "spaghetti",

  "ziti",



  "steak",

  "lasagna",

  "fish"

}

   



#declare num_containers = 15;

#declare containers = array[num_containers] {

  "wedge",

  "sandwich",

  "casserole",

  "loaf",

  "roast",



  "wrap",

  "omelet",

  "pot pie",

  "parmagian",

  "medley",



  "gumbo",

  "soup",

  "lo mein",

  "burrito",

  "prima vera"

}





#declare num_side_dish = 19;

#declare side_dish = array[num_side_dish] {

  "a side of glazed beets",

  "french fries",

  "curly fries",

  "corn bread",

  "mint jelly",



  "brussels sprouts",

  "vegetable medley",

  "onion rings",

  "waffle fries",

  "biscuit",



  "apple sauce",

  "cranberry sauce",

  "rice pilaf",

  "refried beans",

  "feta cheese",



  "egg roll",

  "wonton soup",

  "peas and carrots",

  "zucchini bread"

}





#macro rnd(n)

  #local rnd_result = int((n * rand(rseed)));

  rnd_result

#end





#macro print_word(this_word, words)

  #write (menufile, concat(words[this_word], " "))

#end





#macro gen_and_print_word(num_words, words)

  #local yy = rnd(num_words);

  #if (0 = strcmp(words[yy], last_word)) // check to prevent repeats

    #local loop_limit = 14;

    #while (loop_limit > 0)

      #local yy = rnd(num_words); // pick another

      #if (0 = strcmp(words[yy], last_word)) // is it different from the last
word?

        #local loop_limit = loop_limit - 1;  // no, try again

      #else

        #local loop_limit = 0; // yes, can stop looping now

      #end

    #end

  #end

  print_word(yy, words)

  #declare last_word = words[yy]

#end





#macro make_lunch()

  #local dummy = rand(rseed);

  #local dummy = rand(rseed);

  #if (rnd(3) > 1)

    gen_and_print_word(num_locations, locations)

  #end

  gen_and_print_word(num_pre_styles, pre_styles)

  gen_and_print_word(num_what_it_is, what_it_is)

  #if (rnd(3) = 0)

    gen_and_print_word(num_what_it_is, what_it_is) // pizza burger, burger
pizza

  #end

  #if (rnd(2) < 1)

    #if (rnd(2) = 0)

      gen_and_print_word(num_post_styles, post_styles)

    #end

    #if (rnd(3) = 0)

      gen_and_print_word(num_containers, containers)

    #end

  #else

    #if (rnd(3) = 0)

      gen_and_print_word(num_containers, containers)

    #end

    #if (rnd(2) = 0)

      gen_and_print_word(num_post_styles, post_styles)

    #end

  #end

  #if (rnd(4) > 0) // add a side dish

    #write (menufile, "with ")

    gen_and_print_word(num_side_dish, side_dish)

  #end

  #write (menufile, " \n")

#end





#fopen menufile "menu.txt" append

make_lunch()

make_lunch()

make_lunch()

make_lunch()

make_lunch()



make_lunch()

make_lunch()

make_lunch()

make_lunch()

make_lunch()



make_lunch()

make_lunch()

make_lunch()

make_lunch()

make_lunch()



make_lunch()

make_lunch()

make_lunch()

make_lunch()

make_lunch()





#fclose menufile





update_seed()





#if (file_exists("randloop.pov") = 1)

  #include "randloop.pov"

#else

  camera {

    location 0

    direction <0, 0, 1.1>

    #if (ntsc = true)

      right <(640 / 400) * (10/11), 0, 0>

    #else

      right <(640 / 480), 0, 0>

    #end

    up <0, 1, 0>

    translate <0, 0, -8>

  }





  sphere {

    0, 1

    pigment { color rgb 1 }

    finish { ambient 1 diffuse 0 }

  }

#end





/* actual end of this file */


Post a reply to this message

From: Bob H 
Subject: Re: silly use of pov
Date: 21 May 2001 00:35:40
Message: <3b089b1c@news.povray.org>
Fascinating.  Do you work as a chef there or is your brain turning to
oatmeal because of the job you do?  Sorry, these are the jokes, they don't
get any funnier.  :-D

It's really quite a work of macroing and file writing.  One problem though,
it had errors.  A couple word wraps in the pov file and a parenthesis at the
ends of the first two '#render' lines of the inc file.
I'm just complaining because the menu looks so much better than what I have
to eat here.

Bob H.


Post a reply to this message

From: Pete
Subject: Re: silly use of pov
Date: 26 May 2001 15:05:19
Message: <1401.543T2951T12726116PeterC@nym.alias.net>
Bob H (omn### [at] msncom) wrote:

>Fascinating.  Do you work as a chef there or is your brain turning to
>oatmeal because of the job you do?  Sorry, these are the jokes, they don't
>get any funnier.  :-D

        My co-workers all got a laugh out of it.  The whole idea was
to come up with truly strange meals out of combinations of components
of ordinary meals.  The day after I posted it, I looked on the menu
and saw something that the script had come up with the day before!
Funny!

>It's really quite a work of macroing and file writing.  One problem though,
>it had errors.  A couple word wraps in the pov file and a parenthesis at the
>ends of the first two '#render' lines of the inc file.

        The Chris Colefax city include taught me all I know.  It is a
wonderful collection of files to read for instruction on the
possibilities of povray as a programming tool.
        Yeah.  Word wrap stinks.  When I read the message after it
was posted, it came up on my newsreader as double spaced!  DOh!

>I'm just complaining because the menu looks so much better than what I have
>to eat here.

        Hmm: the meals are not supposed to be appatising.  I mean, do you
really want a "marinated blackened salad omelete" or a "glazed taco"?
        So I guess you were able to get it to work despite the
word wrap problems?  Feel free to tweak and spread the .pov if you find
it useful.

>Bob H.


Post a reply to this message

From: Bob H 
Subject: Re: silly use of pov
Date: 27 May 2001 00:24:19
Message: <3b108173$1@news.povray.org>
"Pete" <Pet### [at] nymaliasnet> wrote in message
news:140### [at] nymaliasnet...
> was posted, it came up on my newsreader as double spaced!  DOh!

Thought that was intentional.  There was a "white space" discussion a long
time ago but I forget the outcome.  Larger files/easier to read kind of
thing I think.

> >I'm just complaining because the menu looks so much better than what I
have
> >to eat here.

>         Hmm: the meals are not supposed to be appatising.  I mean, do you
> really want a "marinated blackened salad omelete" or a "glazed taco"?

First line was: beer battered burger du jour with refried beans
Although I don't drink beer (anymore) and don't care much for beans it still
sounded better than what I had in my 'fridge or cabinets.
The line: Texas Buffalo pizza meatloaf au gratin wrap with mint jelly
wasn't quite as appetizing.

>         So I guess you were able to get it to work despite the
> word wrap problems?  Feel free to tweak and spread the .pov if you find
> it useful.

Was an easy fix, used to it.  Another good example of macroing and file
writing is always a welcome thing.

Bob H.


Post a reply to this message

From: Ken
Subject: Re: silly use of pov
Date: 27 May 2001 00:27:09
Message: <3B1082E1.13F6E086@pacbell.net>
"Bob H." wrote:

> First line was: beer battered burger du jour with refried beans
> Although I don't drink beer (anymore) and don't care much for beans it still
> sounded better than what I had in my 'fridge or cabinets.
> The line: Texas Buffalo pizza meatloaf au gratin wrap with mint jelly
> wasn't quite as appetizing.

I wonder if it could easily be turned into an insult generator...

-- 
Ken Tyler


Post a reply to this message

From: Ib Rasmussen
Subject: Re: silly use of pov
Date: 27 May 2001 04:27:18
Message: <3B10BA6B.C8916D2@ibras.dk>
Ken wrote:

> I wonder if it could easily be turned into an insult generator...

Shouldn't be too hard. Just exchange the food descriptions with stuff
like
"Your mother was a hamster and your father smelt of elderberries!" 

Hmm, The Daily Raytraced Insult, there's an idea for a web site.

/Ib


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.