aVXD Sequence cracker by David R13th Mar 2005 10:47
|
---|
Summary A miniature Sequence-cracking device that gives any requested term, a term-to-term rule, and vene a formula for the sequence! Made in DbPro, but will work in DBC too. Description What does it do? Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com remstart ****************************************************** A9x8 Sequence cracking device ****************************************************** 1/7/2003 What does it do? ---------------- -> Allows you to obtain any term from a sequence -> Shows the formula for a sequence (to work out any term) Huh? ------ Ok, you don't really understand. Here's an example sequence: 9 , 18 , 27 , 36 Its quite obvious what the rule is here [+9 each time]. Yet, there is a problem: ******************************************************** What do I do if I want the 687th number in the sequence? ******************************************************** That's where this program comes in handy, and not only does it do this, it also gives you a formula to work out any term! KNOWN LIMITATION ----------------- The program cannot currently do descending sequence [E.g: -1 , -2 , -3] as it cannot work out the FiTermHook. The program shall generate an error if this happens: "Term to term rule is UNstable (NON Linear)..." I'm currently fixing this issue (So don't do descending sequences unless you want wrong answers!) ---------------------------------------------------------------- remend dim calc1(1) dim calc2(1) dim formula$(1) set text font "verdana" set text to bold set text size 18 ink RGB(255,0,0),1 print "THIS PROGRAM ONLY WORKS WITH LINEAR SET-PATH SEQUENCES" PRINT "PLEASE DOUBLE-CHECK THE RESULTS OF THIS PROGRAM BEFORE" PRINT "USING IN IMPORTANT PROJECTS OR WORK" PRINT " " print "THE USAGE OF EXTREMELY LARGE NUMBERS IN THIS PROGRAM CAUSES" PRINT "SPARODIC NEGATIVE OUTPUT - YOU HAVE BEEN WARNED" PRINT PRINT "PRESS ANY KEY" SUSPEND FOR KEY CLS set text to normal ink RGB(255,255,255),1 print "Enter sequence details" print "[You'll need the first THREE terms of the sequence]" print " " input "First term? ";a input "Second term? ";b input "Third term? ";c cls calculate(a,b,c) print " " cls print "Sequence formula: ";formula$(1) print "Enter any term number to retrieve the equivalent from the sequence" do print " " input "Term> ";term Termnew=term*calc1(1) Newnum=termnew+calc2(1) print "Answer: ";newnum print " " loop function calculate(first,second,third) firstnum=first secondnum=second thirdnum=third print "Please wait......" print "Function Copyright David Roberts 1999-2005(C)" print "Uses similar systems to XforV() copyright Mathe-Deutschland 2004(C)" print "Working Difa01..." if second>first print "Secterm>FiTerm" difa01=first-second else print "Assuming FiTerm>Secterm...." difa01=second-first endif print "Difa01 = ";difa01 print "Working PrimaryDifb01...." print "WARNING: MAY GENERATE UNSTABLE CONSQ() IF B<A!!!!" difb01=second-first print "Difb01 = ";difb01 print "Algerbraic Sequence cracker" print "[Will return to window soon]" print " " print "Retrieving term information..." wait 2500 print "Linear - Easy retrieval expected..." print "Adding Mathematik hooks..." wait 4000 print "Retrieving Term to term rule..." if secondnum>firstnum Calc1=secondnum-firstnum endif if secondnum<firstnum Calc1=firstnum-secondnum print "Test (T2) ___";calc1;"" endif if thirdnum>secondnum calcnew=thirdnum-calc1 endif if calcnew=secondnum print "Term to term rule is stable (Linear)...." print "Now cracking.." goto easy else ink RGB(255,0,0),1 print "Term to term rule is UNstable (NON Linear)...." print "Now ATTEMPTING cracking.." print print "*****THE OUTCOME MAY BE WRONG*******" ink RGB(255,255,255),1 endif easy: wait 2000 print "Term to term (Est.): ";calc1;"" print " " print "Performing secret formula..." wait 3000 Calc2=firstnum-calc1 calc3=calc*3 print " " print "T[n] = ";calc2;"+";calc1;"n" ca$=str$(calc1) cb$=str$(calc2) Termnew=term*calc1(1) Newnum=termnew+calc2(1) formula$(1)="Term answer = ( Term * "+ca$+" ) + "+cb$ print "Please wait..." wait 3000 calc1(1)=calc1 calc2(1)=calc2 endfunction |