TIP: Click on subject to list as thread! ANSI
echo: z3_pascal
to: Bek Oberin
from: Frank Malcolm
date: 1995-08-30 11:04:20
subject: Randomizing Quote Files

Hi, Bek.

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

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

Yeah, that pretty much stuffs up that idea of mine. I guess I had in
mind something like random taglines, where I think it would be quite
viable.

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

BO> BO>> Got any ideas?

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

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

So do I!  Oh, you mean quotes. :-)

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

BO> That gives me two ideas, really, first is to generate an index file and hav
BO> it automatically update along with the general point maintenance
BO> which runs every day - there would be bits where it was out of synch by
BO> because it tends to get longer, not shorter, it probably wouldn't be

If it always gets longer because you add to the end, never stick a new
quote into the middle for example, that sounds like the best idea. If
you happen to run your 'give me todays quote' program after new quotes
have been added but before daily maintenance has been run, the only bad
effect is that you can't get at those new quotes yet. Not a problem.

BO> fatal.  Second would be to have an file containing just the date and
BO> time of the quote file as well as the index, and use that to re-generate th
BO> index file if it senses it's out of date...

Can't see any advantage to the separate file, might as well stick it at
the beginning of the index file.

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

BO> Yep..

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

BO> Makes perfect sense to me!

Well you're clever then! :-)

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

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

Very clever! :-)

BO> --- pEDguin v0.15/a

Is pEdquin your own mail reader/writer? All your own work? In Pascal?

Regards, FIM.

 * * Does the name Pavlov ring a bell?
@EOT:

---
* Origin: Pedants Inc. (3:711/934.24)
SEEN-BY: 633/267 270
@PATH: 711/809 808 50/99 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™.