--------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F5G00064 Date: 04/24/98 From: BRUCE CORBETT Time: 06:37pm \/To: SAM ANDREWS (Read 3 times) Subj: write #1,"ahhhhhh" Hi SAM ANDREWS, hope you are having a nice day .+'~'+. | Qouted from a message from SAM ANDREWS 19-Apr-98| To ALL `+._.+' | About write #1,"ahhhhhh" SA> the problem i put the code bellow in a sub and for somereason it cannot SA> write SA> the ansi stuff to a file while in a sub. I could take the stuff away and SA> it SA> would work. So what is a beter way to write the file in a beter way then SA> below? SA> barbwall$ = "barbwall.txt" SA> OPEN barbwall$ FOR APPEND AS #1 SA> PRINT #1, " Barber:" I had that problem once before.... I beleive I fixed it by using a CHR$(27) whenever a ansi sequance is to start..... try this. barbwall$ = "barbwall.txt" OPEN barbwall$ FOR APPEND AS #1 PRINT #1, chr$(27)+"[0m"+chr$(27)+"[1m " 'I removed it to make it smaller you get the idea.... otherwise try reading the stuff to put in, into a file. .+'~'+. | Bruce Corbett (Hook@Cheerful.com) H O O K | Hk Software (www.members.tripod/~nzhook) `+._.+' | ruce's anter S (3:775/70) ((646) 756-6331 Np, Nz) --- * Origin: ruce's anter S (3:775/70) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F5G00065 Date: 04/25/98 From: DAVID WILLIAMS Time: 10:06am \/To: ANDY HOLDING (Read 3 times) Subj: random letters -> DW> make the RNDs *less* like real random numbers! -> You can't more or less random numbers on a computer they are never -> random its just a long and complicated series which the randomize -> timer tells it what term to start at. As I said, the RNDs are *like* random numbers. Yes, it's true, they're not truly random. If you generate enough of them (billions, I believe), the cycle will go back to the start, and you'll get the exact same sequence of numbers you got earlier. However, any reasonably short chunk of RNDs behaves remarkably like truly random numbers behave. It satisfies just about every empirical test for randomness. For example, if you take a formula such as: PRINT 1 + INT(6 * RND) which generates an integer between 1 and 6 (useful for simulating tossing dice, for instance), the six possible outcomes will occur pretty well exactly as would happen if you tossed a real die many times. The six numbers would come up equally often, in the long run, there would be no tendency for 4s to follow 1s, or whatever, more often than chance would predict, and so on and so on. In fact, the *only* way you can tell that the RND generator is not truly random, in a reasonably short period of time, is to seed it with the same number twice, and observe that it then generates the same sequence of numbers both times. Truly random numbers wouldn't do that. A lot of disparaging things are often written about using RNDs because they're not "really" random. Actually, few things ever are. If you take a deck of cards, cut it into two roughly equal parts, then riffle them together as someone does when shuffling them, the card that was on the top of the deck will almost certainly be in the top few cards after the first cut and riffle. Repeating the process many times, as is done when cards are really shuffled, makes the predictability far less, but it can never make the order of the cards really random. And yet everyone who plays cards assumes that their order, after shuffling, is random. For pretty well all practical purposes, the RNDs that computers generate are just fine. dow --- PCBoard (R) v15.3 (OS/2) 5 * Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F5G00066 Date: 04/25/98 From: DAVID WILLIAMS Time: 10:19am \/To: PETER DALTON (Read 3 times) Subj: using RND -> the array (A%) holds zeros to start with. Generate a random number -> (Y%) between 1 and 49 and check to see if that array element holds a -> zero. If it does then poke a '1' in there, if it doesn't then find -> another random number. I don't dispute that a program *could* be written that would work as you describe, and that it would produce satisfactory results - especially if time is not a factor. But the whole purpose of my post was to demonstrate that this kind of task can be carried out *without* ever having to re-generate random numbers because the same ones have been generated previously. Doing that kind of thing wastes time, sometimes a great deal of time. And it is not at all necessary. My program, as I posted it, produces six random integers, without any possibility of repetition, by generating just six RNDs, no more, no less. That's what I wanted to demonstrate. With very minor modifications, the same routine can be used to simulate shuffling a deck of 52 cards, extremely well (i.e. into an order that has no correlation with the original one), by generating just 51 RNDs. Try doing that by hunting and pecking! dow --- PCBoard (R) v15.3 (OS/2) 5 * Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F5G00067 Date: 04/25/98 From: DAVID WILLIAMS Time: 10:31am \/To: ROBERT ROLLESTON (Read 3 times) Subj: RANDOM -> I was wondering if anyone knows how to make a program read a random -> line out of a text file. Well, it could be done in a couple of ways. One would be to open the file and count how many lines are in it. You'd just INPUT a line, increment a counter, then if EOF hasn't been reached go back and INPUT another one. When you get to EOF, close the file. Now generate a random number between 1 and the number of lines. Re-open the file, and INPUT as many lines as the random number, discarding all the lines except the last one. The last one is the one you want. The other method would be to read the whole file into a string array, using one element of the array for each line. Then pick an element at random. This method would require a lot of memory if the file is long, but it would be faster than the first one, especially if you want to pick a lot of random lines. The file would have to be read only once. dow --- PCBoard (R) v15.3 (OS/2) 5 * Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F5G00068 Date: 04/24/98 From: SAM ANDREWS Time: 08:46pm \/To: STEVE IGREJAS (Read 3 times) Subj: write #1,"ahhhhhh" -=> Quoting Steve Igrejas to Rickey Parrish <=- -=> Quoting Rickey Parrish to Steve Igrejas <=- RP> WRITE #1 writes to the file with "" marks around it doesnt it? RP> Like Write #1, "Hello World" would write "Hello World" in the file. RP> PRINT #1, "Hello World" should only print Hello World to the file RP> (does here anyway :) SI> Yeah. So, when you INPUT #1, BLAH1$ it'll read from the file the SI> first variable. SI> What was the dilema again? SI> ... Yo Mama so, fat, she has to pull down her pants to get into her SI> pocket -!- Blue Wave/DOS v2.30 [NR] SI> ! Origin: >>>Xanadu BBS<<< New Bedford Ma. (508)995-9876 (FIDONET SI> 1:329/889) Hello i just wonderin if someone can help me here! i am writing a lord igm nd i made a scribble wall . I wantd to make it where the sysop could resest the wall just by deleting the barbwall.txt (the wall file) and when the igm was ran it would detect the file wasnt there and would write it and i did so and it seem to work. But when i tried to compile it! It woudnt let me . I found out the problem i put the code bellow in a sub and for somereason it cannot write the ansi stuff to a file while in a sub. I could take the stuff away and it would work. So what is a beter way to write the file in a beter way then below? barbwall$ = "barbwall.txt" OPEN barbwall$ FOR APPEND AS #1 PRINT #1, " Barber:" PRINT #1, " Hey everyone, the barbershop is now open!" PRINT #1, " old Woman:" PRINT #1, " Great! Long as you do not turn my head into a mop!" PRINT #1, " Fat Man:" PRINT #1, " Haha... You too?" PRINT #1, " Old Woman:" PRINT #1, " Yes my boy." PRINT #1, " Barber:" PRINT #1, " I have my good day and my bad days!" PRINT #1, " Fat Guy:" PRINT #1, " No kidding, last time I left here I had no head." PRINT #1, " Old Woman:" PRINT #1, " You sure looked fine to me sweetie!" PRINT #1, " Fat Guy:" PRINT #1, " Shutup you slut! You like any male that walks!" PRINT #1, " Barber:" PRINT #1, " Well now we do not need to get into all that!" PRINT #1, "" CLOSE #1 ... AlL LiTtLe Bad SpamMeRs ShaLL Be DelT With IN DiGiTAl ReHaB ___ Blue Wave/386 v2.30 [NR] --- * Origin: Digital Inc. % Warped! % [757] 480-0949 (1:275/38) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F5G00069 Date: 04/25/98 From: ROBERT ROLLESTON Time: 01:19pm \/To: ALL (Read 3 times) Subj: RANDOM Does anyone know how to make Quick Basic 4.5 read a random line out of a text file? --- * Origin: LORD Connection BBS 1:267/75 1-518-639-5572 (1:267/75) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F5G00070 Date: 04/25/98 From: TED CRAMER Time: 10:08am \/To: RICKEY PARRISH (Read 3 times) Subj: write #1,"ahhhhhh" RP-> SA> barbwall$ = "barbwall.txt" OPEN barbwall$ FOR APPEND AS #1 RP-> ^^^^^^ Im not 100% sure (I dont use append much) but if the file does RP-> not exist, I dont think you can open it for append. Try opening RP-> the file for OUTPUT instead. This will erase anything already RP-> in the file though, so only use that if you want to start fresh. He can create a 0 byte barbwall.txt file and the append command will then work. --- Ted's Castle * Origin: Ted's Castle / (216) 671-1057 (1:157/574) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F5G00071 Date: 04/25/98 From: TED CRAMER Time: 10:16am \/To: BRUCE BECK (Read 3 times) Subj: Re: write #1,"ahhhhhh" BB-> He can use APPEND, but have a ON ERROR that will create the file if BB-> it doesn't exist, for what he is using the file for, he will need BB-> to use the APPEND, so, the file will not have to be rewritten Another solution would be to create a 0-byte file than he can then use APPEND to update. --- Ted's Castle * Origin: Ted's Castle / (216) 671-1057 (1:157/574) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F5G00072 Date: 04/16/98 From: PAT PRIDGEN Time: 08:30pm \/To: DAVID AUKERMAN (Read 3 times) Subj: Code FAQ organizer? [In a message from David Aukerman to Pat Pridgen ] DA> Good, thanks. It'll actually take a little while to determine our DA> winner because Bruce Corbett has also expressed an interest in DA> the job. But we'll see, soon enough. :) Whatever you decide will be fine. I await with baited breath. . pat.pridgen@svis.org . La Grande, Oregon *SignIt 2.x #001* ... I don't want to be literate, I just want to program! ___ Blue Wave/DOS v2.30 --- Maximus 2.02 * Origin: THE LOFT in Auburn IN 219-925-5524 & 238-3222 HST/V34+ (1:236/7) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F5G00073 Date: 04/21/98 From: TERRY RETT Time: 08:45pm \/To: ALL (Read 3 times) Subj: thanks i want to thank everyone who m,ailed me and messaged me source for programs i'm working on, i greately apprweciate your help and suggestions thank you again t.rett --- Maximus 2.02 * Origin: THE LOFT in Auburn IN 219-925-5524 & 238-3222 HST/V34+ (1:236/7)