TIP: Click on subject to list as thread! ANSI
echo: z3_pascal
to: Frank Malcolm
from: Bek Oberin
date: 1995-08-24 08:19:00
subject: Randomizing Quote Files

(Frank Malcolm >> Bek Oberin)


 FM> OK, if the samples you put in your message to Ron are mixed with a
 FM> one-liners, the one-liners would have a significantly less chance of
 FM> being selected using my suggestion above.

It's actually even more extreme, the longest one in the file is
something like 30 lines, and yes there's one-liners there too..

BO>> is reading through the file counting quotes, then generating a
BO>> random number and re-reading though the file.  It takes just
BO>> about second to come up with a quote doing that which is
BO>> acceptible at the moment, but hardly ideal.

BO>> Got any ideas?

 FM> A few. :-) I'll assume your quotes file is relatively static, but
 FM> sometimes you add more quotes using, probably, a text editor or some
 FM> cut-and-paste process. IOW it's not totally fixed so an index file
 FM> generated once won't do.

More or less.  It tends to get mangled fairly often (say, every few
days) because I keep seeing things I like :)

 FM> The possibilities I'd consider are...
 FM> a) Generate an index file.  A quickie prog could do this every time
[..]
 FM> b) Re-index every time the prog that presents the quotes is run.
[..]
 FM> c) At least eliminate the first pass which you mention above, by

That gives me two ideas, really, first is to generate an index file and
have it automatically update along with the general point maintenance
which runs every day - there would be bits where it was out of synch by
because it tends to get longer, not shorter, it probably wouldn't be
fatal.  Second would be to have an file containing just the date and
time of the quote file as well as the index, and use that to re-generate
the index file if it senses it's out of date...

 FM> If, OTOH, you can use an index file (alternative b)), then I guess it
 FM> would have the date/timestamp of the actual quote file, followed by a
 FM> lot of longints pointing to each quote in the quote file. You'd need
 FM> read that one as an untyped file from the pointer from the index file
 FM> until the next double crlf.

Yep..

 FM> Now I've just re-read all that and I'm not sure I've really explained
 FM> well what I'm thinking of. Tell me the bits that don't make sense. Or
 FM> you want to see some code?

Makes perfect sense to me!

I think I'll use the index-file-with-date-and-time-stamp one, shouldn't be
too hard ...

My project for this week has been to make pEDguin do random origin
lines, as well as fixed-per-area ones ...  much to my abject shock, it
worked the very first time!




Bek

--- pEDguin v0.15/a
* Origin: The Dreamerie, Melbourne, Oz (3:632/522.3)
SEEN-BY: 633/267 270
@PATH: 632/522 998 635/503 633/371 252 267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.