QB / QB64 Discussion Forum      Other Subforums, Links and Downloads
 

 Return to Index  

quickbasic 4.5

February 1 2012 at 10:20 AM
lawgin  (no login)


Response to qbasic 1.1

 

I did basically the same thing except I kept the current value of the seed being tested in the separate file seed.txt. Before running it you have to create the file and put some number in it.


OPEN "seed.txt" FOR INPUT AS #1
INPUT #1, seed#
CLOSE 1
PRINT seed#
crypt$ = "OMNAN2L=\6"
all$ = "0123456789/"
RANDOMIZE seed#
FOR n = 1 TO LEN(crypt$)
r = INT(64 * RND) + 1
char = ASC(MID$(crypt$, n, 1)) - 33
comb$ = comb$ + LTRIM$(CHR$(r XOR char))
NEXT n
FOR n = 1 TO LEN(comb$)
IF INSTR(all$, MID$(comb$, n, 1)) = 0 THEN EXIT FOR
NEXT n
IF n = LEN(comb$) + 1 THEN PRINT "Combination is: "; comb$: END
OPEN "seed.txt" FOR OUTPUT AS #2
seed# = seed# + 1
PRINT #2, seed#
CLOSE 2
RUN





 
 Respond to this message   
Responses

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement