8-Bit Software Online Conversion

The Ultimate Lottery Program - Listing

10DEFFNS="Lotter7" 20MODE7 30VDU23;8202;0;0;0; 40DIM N%(49) 50DIM O%(49) 60DIM P%(49) 70PROCgetdat 80ONERROR VDU3:CLOSE#F%:F%=0:IF ERR<> 17:REPORT:PRINTERL:END 90REPEAT 100C%=T%/W% 110CLS 120PRINT'"     130PRINT"     140PRINT'" By C.J.Richardson. For 8-Bi t Software."' 150PRINT" Program Suggested And" 160PRINT" Data Entered By B.Thack eray D3D." 170PRINT'TAB(13)" ""A Bit Of Fun""" 180PRINT'TAB(6)" ";STR$(W%);" Weeks Of Data Entered." 190PRINT'" Average Total Over ";STR$( W%);" Weeks Is ";STR$(C%) 200PRINT'TAB(6)" 1. Enter Data " 210PRINTTAB(6)" 2. Main Program " 220PRINTTAB(6)" 3. Info " 230PRINTTAB(6)" 4. Print Out/View Da ta " 240PRINTTAB(6)" 5. End " 250PRINT'TAB(11)" Press 1-5 " 260PRINT'TAB(6)" ESCAPE To Return He re " 270*FX21 280REPEAT 290A$=GET$ 300UNTILINSTR("12345",A$) 310IF A$="1"PROCinput 320IF A$="3"PROCinfo 330IF A$="4"PROCprintout 340IF A$="5":END 350UNTILA$="2" 360REPEAT 370REPEAT 380CLS 390PROCdispnum 400PROCdisporder 410PRINT''" Press (S)uggested Number s (P)rint "; 420*FX21 430REPEAT 440A$=GET$ 450IF INSTR("Pp",A$)PROCprint 460UNTILINSTR("Ss",A$) 470REPEAT 480PROCsuggest 490PRINT'" Press (S)tatistics (A)gai n (P)rint "; 500*FX21 510REPEAT 520A$=GET$ 530IF INSTR("Pp",A$)PROCprint 540UNTILINSTR("SsAa",A$) 550UNTILINSTR("Ss",A$) 560UNTILFALSE 570END 580DEFPROCgetdat 590PRINTTAB(6,11);"    600PRINTTAB(6,12);"    610F%=OPENIN"UltDat" 620W%=0 630T%=0 640REPEAT 650W%=W%+1 660FORL%=1TO7 670A%=BGET#F% 680IF L%<>7T%=T%+A% 690N%(A%)=N%(A%)+1 700NEXT 710UNTILEOF#F% 720CLOSE#F%:F%=0 730FORL%=1TO49 740O%(L%)=N%(L%) 750NEXT 760FORL%=49 TO 1 STEP-1 770Q%=0 780FORI%=1TO49 790IF O%(I%)>Q%:Q%=O%(I%):R%=I% 800NEXT 810P%(L%)=R% 820O%(R%)=0 830NEXT 840ENDPROC 850DEFPROCinput 860*FX200,1 870F%=OPENUP"UltDat" 880PTR#F%=EXT#F% 890REPEAT 900FORL%=1TO49 910O%(L%)=0 920NEXT 930W%=W%+1 940CLS 950FORL%=1 TO 7 960REPEAT 970REPEAT 980IF L%<>7 PRINT" Enter Week ";STR$(W %);" Lottery Number ";STR$(L%) ELSE PRIN T" Enter Week ";STR$(W%);" Bonus Number " 990INPUT A% 1000PRINT" Correct Y/N?" 1010REPEAT 1020A$=GET$ 1030UNTILINSTR("YyNn",A$) 1040UNTILINSTR("Yy",A$) AND A%>0 AND A% <50 1050UNTILO%(A%)=0 1060O%(A%)=1 1070BPUT#F%,A% 1080NEXT 1090REPEAT 1100PRINT" Another Week? Y/N" 1110A$=GET$ 1120UNTILINSTR("YyNn",A$) 1130CLS 1140UNTILINSTR("Nn",A$) 1150FORL%=1TO49 1160N%(L%)=0 1170NEXT 1180CLOSE#F%:F%=0 1190PROCgetdat 1200*FX200 1210ENDPROC 1220DEFPROCdispnum 1230PRINT" Lottery Numbers. Total App earances. " 1240X%=0 1250Y%=2 1260FORI%=1TO49 1270IF X%=0 VDU31,X%,Y%,134,31,X%,Y%+1, 130:X%=X%+1 1280VDU31,X%,Y% 1290PRINTSTR$(I%); 1300VDU31,X%,Y%+1 1310PRINTSTR$(N%(I%)); 1320X%=X%+4 1330IF X%=41 X%=0:Y%=Y%+3:VDU31,X%,Y%,6 4 1340NEXT 1350ENDPROC 1360DEFPROCdisporder 1370PRINT''" Order Of Appearance. Lea st First. "' 1380VDU131 1390FORL%=1TO49 1400PRINTSTR$(P%(L%)); 1410IF L%MOD13=0 PRINT:VDU131 ELSE PRIN T" "; 1420NEXT 1430ENDPROC 1440DEFPROCsuggest 1450CLS 1460PRINT'" Suggested Lottery Numbers : " 1470PRINT'" Average Total Over ";STR$(W %);" Weeks Is ";STR$(C%)' 1480PRINT" Number Of Line Away From" 1490PRINT" Random Numbers Total Average"' 1500FORL%=6TO0 STEP-1 1510S%=0 1520VDU130 1530FORI%=1TO49 1540O%(I%)=0 1550NEXT 1560PRINTSTR$(6-L%); 1570PRINT":"; 1580IF L%<>0PRINT" "; 1590FORZ%=0TOL% 1600IF Z%<>0 PRINTSTRING$(2-LEN(STR$(P% (Z%))),"0")+STR$(P%(Z%));:IF Z%<>L% PRIN T" "; ELSE IF Z%=L% PRINT" "; 1610O%(Z%)=1 1620S%=S%+P%(Z%) 1630NEXT 1640IF L%=6 PROCstats:PRINT:NEXT 1650FORZ%=L%+1TO6 1660REPEAT 1670U%=RND(-TIME) 1680U%=RND(48)+1 1690UNTILO%(U%)<>1 1700PRINTSTRING$(2-LEN(STR$(P%(U%))),"0 ")+STR$(P%(U%));" "; 1710O%(U%)=1 1720S%=S%+P%(U%) 1730NEXT 1740PROCstats 1750PRINT 1760NEXT 1770ENDPROC 1780DEFPROCstats 1790PRINT TAB(23)" ";STR$(S%);TAB(31)" ";STR$ABS(C%-S%) 1800ENDPROC 1810DEFPROCprint 1820FORL%=0TO22 1830FORI%=0TO39 1840V%=?(&7C00+(L%*40)+I%) 1850IF V%<32 OR V%>126 V%=32 1860VDU2,1,V%,3 1870NEXT 1880VDU2,1,13,3 1890NEXT 1900ENDPROC 1910DEFPROCinfo 1920CLS 1930PRINT" PRESS SHIFT TO SCROLL THE TE XT." 1940PRINT 1950VDU14 1960PRINT" This program will allow you to input" 1970PRINT" the 7 numbers from the lotte ry" 1980PRINT" each week and choose some nu mbers" 1990PRINT" using previous numbers. All the" 2000PRINT" numbers that have appeared u p to the" 2010PRINT" writing of this program are already" 2020PRINT" entered into the data file U LTDAT." 2030PRINT 2040PRINT" The program is very simple t o operate." 2050PRINT" Entering data requires that you have" 2060PRINT" the disc with ULTDAT in the drive. IF" 2070PRINT" YOU ARE USING DFS, IT IS IMP ORTANT" 2080PRINT" THAT THIS FILE HAS ROOM TO B E ADDED" 2090PRINT" TO. Do this by saving this p rogram" 2100PRINT" (Lotter7) to a freshly forma tted disc" 2110PRINT" and then copying the datafil e ULTDAT" 2120PRINT" onto the disc. Enter all 6 n umbers" 2130PRINT" plus the bonus number for ea ch week." 2140PRINT 2150PRINT" The first thing you will see when" 2160PRINT" choosing the second option i s a list" 2170PRINT" of the numbers 1 to 49 with, directly" 2180PRINT" below, the number of times t hat this" 2190PRINT" has appeared. Underneath thi s list is" 2200PRINT" a list of the numbers 1 to 4 9 in the" 2210PRINT" order that they have appeare d, least" 2220PRINT" first." 2230PRINT 2240PRINT" Press P to print out this da ta. Press" 2250PRINT" S to view the suggested numb ers. This" 2260PRINT" displays 5 rows of numbers. The first" 2270PRINT" row consists of 6 numbers ch osen" 2280PRINT" because they have not appear ed as many" 2290PRINT" times as other numbers. The second row" 2300PRINT" is made up of 5 numbers chos en in the" 2310PRINT" above manner and one chosen at random." 2320PRINT" With each progressive row mo re numbers" 2330PRINT" are chosen at random until t he last row"; 2340PRINT" when all numbers are randoml y chosen." 2350PRINT 2360PRINT" Press P to print the screen. Press A" 2370PRINT" to re-display the screen wit h fresh" 2380PRINT" random numbers. Press S to g o back to" 2390PRINT" the statistics screen." 2400PRINT 2410PRINT" Random numbers are green. Di rectly" 2420PRINT" after the suggested numbers are two" 2430PRINT" columns of numbers. The firs t column" 2440PRINT" is the total of the row of n umbers." 2450PRINT" The second column is the dif ference" 2460PRINT" between the first column num ber and" 2470PRINT" the average total for all th e previous" 2480PRINT" data. This is the 'secret' o f the" 2490PRINT" program. Press A until the f igure in" 2500PRINT" the last column is 0." 2510PRINT 2520PRINT" PRESS A KEY" 2530PRINT 2540VDU15 2550*FX21 2560REPEATUNTILGET 2570ENDPROC 2580DEFPROCprintout 2590F%=OPENIN"UltDat" 2600CLS:PRINT'"To Printer Y/N?"' 2610*FX21 2620REPEAT 2630A$=GET$ 2640UNTILINSTR("YyNn",A$) 2650IF INSTR("Yy",A$) VDU2 ELSE PRINT"P ress SHIFT To Scroll Numbers"':VDU14 2660A%=1 2670REPEAT 2680PRINT"Week ";STR$(A%);TAB(9); 2690FORL%=1 TO 6 2700B%=BGET#F% 2710PRINTSTRING$(2-LEN(STR$(B%)),"0")+S TR$(B%);:IF L%<>6PRINT","; 2720NEXT 2730B%=BGET#F% 2740PRINTTAB(28)" Bonus ";STRING$(2-LEN (STR$(B%)),"0")+STR$(B%) 2750A%=A%+1 2760UNTILEOF#F% 2770CLOSE#F%:F%=0 2780VDU3,15 2790*FX21 2800PRINT'"Press A Key" 2810REPEATUNTILGET 2820ENDPROC 2830I really have no idea why I write t hese lottery programs as I am against th e lottery by principle. I think that the popularity of the lottery is a sad refl ection of the quite sick world that we l ive in when 1/4 of the world 2840starves and people such as us waste money on "a bit of fun" such as the lot tery. 2850It amuses me slightly when I hear t he treasury has miscalculated the effect that it would have on the economy (peop le wasting money and lining a few alread y rich peoples pockets instead of spendi ng it on cheap tat in the market 2860place). Also, the government takes only 12% of the money instead of the 17. 5% they were taking on it when people sp ent it on tat. I would much sooner give my pennies directly to my chosen charity . I reckon they should have 2870given the contract to Richard Brans on of Branson Pickles. Great with a sala d. Having said all that, I am in a syndi cate at work forking out ten bob a week. I did not want to, but decided (what a whimp) that there would be far less 2880hassle from workmates if I was "in" . A previous (aborted) attempt at a pool s syndicate at work that I refused to jo in taught me. Comments such as "When we win you will want some of it" and variou s other related pathetic ramblings 2890do get to you in the end no matter how thick you are (thick skinned?). Oooh , look at me now. Look at the time. Must dash.