'for typo's yep lineMun blah! b+ mod of kiara mod of b+ 2020-07-15
'2020-07-17 remove weekday names, move labels into there, fix bottom line up/down click
' fix function convertLottoNum2Date$ spelling
' clean out some redundant code loops
DEFINT A
-Z
' everything is integer unless DIM or suffix CONST nRows
= 11 ' rows of 5 data points in each line of fileDat
DIM count
' for number of lines in the data file
DIM lineNum
, lineNum2
' for tracking array access this is actual file line of data we are screening DIM lottoNum
, lottoNum2
' for extractions DIM lottoDate$
, lottoDate2$
' for the dates of lottos
' user inputs
DIM mb
, mx
, my
, oldmouse
' Mouse stuff oldmouse is trick Steve McNeill showed us to get ONE mouse click!
' these would normally go in SUBs or FUNCTIONs but we are using GOSUBs here
DIM shiftRight
, shiftRight2
' screening data left and right, normally these would be CONSTANTs shiftRight = 11 ' according to screen fit
shiftRight2 = 65 ' according to screen fit
DIM row
, col
, aPlace
' for screening Data from a string DIM rowCnt
, y
, rowPlus
' for loading lineDAT() from a file string DIM lineDAT
(1 TO 5, 1 TO nRows
) AS INTEGER 'an array to load from each line from DAT
DIM i
' common use for indexing
msNomeMesi(1) = "Gennaio"
msNomeMesi(2) = "Febbraio"
msNomeMesi(3) = "Marzo"
msNomeMesi(4) = "Aprile"
msNomeMesi(5) = "Maggio"
msNomeMesi(6) = "Giugno"
msNomeMesi(7) = "Luglio"
msNomeMesi(8) = "Agosto"
msNomeMesi(9) = "Settembre"
msNomeMesi(10) = "Ottobre"
msNomeMesi(11) = "Novembre"
msNomeMesi(12) = "Dicembre"
DIM labels
(1 TO 11) AS STRING ' setup screen labels for reporting data labels(1) = "BARI"
labels(2) = "CAGLIARI"
labels(3) = "FIRENZE"
labels(4) = "GENOVA"
labels(5) = "MILANO"
labels(6) = "NAPOLI"
labels(7) = "PALERMO"
labels(8) = "ROMA"
labels(9) = "TORINO"
labels(10) = "VENEZIA"
labels(11) = "NAZIONALE"
'-------------------------------- start Main setup get file data loaded into array
'count lines in file
' debug check inputs from file
'PRINT a
'INPUT " OK enter "; w$
IF LEN(_TRIM$(a
)) THEN count
= count
+ 1 'don't want empty lines _TRIM$ removes spaces or other nonsense
'now we now size of file so ready an array to load file Data
IF LEN(_TRIM$(a
)) THEN fileDAT
(i
) = a
'don't want empty lines _TRIM$ removes spaces or other nonsense
'get/set first line and get a data string from the FileDAT array (left set on screen)
lineNum = 1
a = fileDAT(lineNum)
lottoDate$ = ConvertLottoNumToDate$(lottoNum)
'get/set right side start variables
lineNum2 = 1
a2 = fileDAT(lineNum2)
lottoDate2$ = ConvertLottoNumToDate$(lottoNum2)
DO '------------------------------------------------ Main Loop User selects data to compare IF Q$
= "+" THEN lineNum
= lineNum
+ 1 IF Q$
= "-" THEN lineNum
= lineNum
- 1
'LOCATE 3, 1: PRINT mx, my
IF mb
AND oldmouse
= 0 AND my
> 24 THEN ' <<<<<<<<<<<<<<<<<<<<<<< THANK's SMcNeill '_DELAY .25 ' just one click please!
IF 3 <= mx
AND mx
<= 11 THEN lineNum
= lineNum
+ 1 IF 14 <= mx
AND mx
<= 23 THEN lineNum
= lineNum
- 1 IF 56 <= mx
AND mx
<= 64 THEN lineNum2
= lineNum2
+ 1 IF 67 <= mx
AND mx
<= 76 THEN lineNum2
= lineNum2
- 1 oldmouse
= _MOUSEBUTTON(1) ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< THANK's SMcNeill IF lineNum
> count
THEN lineNum
= 1 IF lineNum
< 1 THEN lineNum
= count
IF lineNum2
> count
THEN lineNum2
= 1 IF lineNum2
< 1 THEN lineNum2
= count
'get new data line
a = fileDAT(lineNum) 'left side data
lottoDate$ = ConvertLottoNumToDate$(lottoNum)
a2 = fileDAT(lineNum2) 'right side data
lottoDate2$ = ConvertLottoNumToDate$(lottoNum2)
'print out the data from the new line
GOSUB loadLineDAT_Mark30s
loadLineDAT_Mark30s: 'this loads the lineDAT array, so we can sweep through the columes and mark 30's
rowCnt = 1: y = 1
FOR i
= 5 TO LEN(a
) STEP 2 ' is marking off the start of each data 2 digit integer lineDAT
(rowCnt
, y
) = VAL(MID$(a
, i
, 2)) 'convert data item to integer rowCnt = rowCnt + 1 ' increase column if at 6 start new row
IF rowCnt
= 6 THEN y
= y
+ 1: rowCnt
= 1 COLOR 9 'blue marker seacrh through columes for 30's FOR col
= 1 TO 5 'for each of the columes of data FOR row
= 1 TO 10 'for each of the rows of dat FOR rowPlus
= row
+ 1 TO 11 'compare the next rows for diff 30 with current col, row IF diff30in90
(lineDAT
(col
, row
), lineDAT
(col
, rowPlus
)) THEN LOCATE row
* 2 + 1, col
* 3 - 2 + shiftRight:
PRINT DD$
(lineDAT
(col
, row
));
LOCATE rowPlus
* 2 + 1, col
* 3 - 2 + shiftRight:
PRINT DD$
(lineDAT
(col
, rowPlus
));
''----------------------------- plug in new color routine here for right side ???
'rowCnt = 1: y = 1
'FOR i = 5 TO LEN(a2) STEP 2 ' is marking off the start of each data 2 digit integer
' lineDAT(rowCnt, y) = VAL(MID$(a2, i, 2)) 'convert data item to integer
' rowCnt = rowCnt + 1 ' increase column if at 6 start new row
' IF rowCnt = 6 THEN y = y + 1: rowCnt = 1
'NEXT
'COLOR 9 'blue marker seacrh through columes for 30's
'FOR col = 1 TO 5 'for each of the columes of data
' FOR row = 1 TO 10 'for each of the rows of dat
' FOR rowPlus = row + 1 TO 11 'compare the next rows for diff 30 with current col, row
' 'IF diff30in90(lineDAT(col, row), lineDAT(col, rowPlus)) THEN
' ' LOCATE row * 2 + 1, col * 3 - 2 + shiftRight2: PRINT DD$(lineDAT(col, row));
' ' LOCATE rowPlus * 2 + 1, col * 3 - 2 + shiftRight2: PRINT DD$(lineDAT(col, rowPlus));
' 'END IF
' NEXT
' NEXT
'NEXT
screenDataLine:
PRINT lottoNum; lottoDate$;
PRINT lottoNum2; lottoDate2$;
aPlace = 5
LOCATE row
* 2 + 1, col
* 3 - 2 + shiftRight:
PRINT MID$(a
, aPlace
, 2);
' Left side LOCATE row
* 2 + 1, col
* 3 - 2 + shiftRight2:
PRINT MID$(a2
, aPlace
, 2);
'<< a2 now Right Side aPlace = aPlace + 2
labelScreen:
PRINT " Fino / Up Giu / Down : Fare clic su : Fino / Up Giu / Down";
' 12345678901234567890123456789012345678901234567890123456789012345678901234567890
' 1 2 3 4 5 6 7 8
FUNCTION DD$
(number
) 'convert a number into a 2 digit string$
FUNCTION diff30in90
(a
, b
) 'default integers a-z diff30in90 = -1
' ----------------------------------------------------- Convert Lotto Num to Date Function and helpers
FUNCTION ConvertLottoNumToDate$
(lottoNumX
) DIM numberOfDays1463
, yr
, mo
numberOfDays1463
= INT(lottoNumX
- 1463) / 3 * 7 yr = 2017
mo = 6
WHILE numberOfDays1463
> daysInMonth%
(mo
, yr
) - 1 numberOfDays1463 = numberOfDays1463 - daysInMonth%(mo, yr)
mo = mo + 1
IF mo
= 13 THEN mo
= 1: yr
= yr
+ 1 ' date shound be day name date/month/year for Italians
ConvertLottoNumToDate$
= lottoday$
(lottoNumX
) + _TRIM$(STR$(numberOfDays1463
+ 1)) + "/" + msNomeMesi
(mo
) + "/" + _TRIM$(STR$(yr
))
IF lottoNum
MOD 3 = 1 THEN lottoday$
= "Martedi, " IF lottoNum
MOD 3 = 2 THEN lottoday$
= "Giovedi, " IF lottoNum
MOD 3 = 0 THEN lottoday$
= "Sabato, "
copyM = mNum
IF mNum
= 13 THEN copyM
= 1: copyY
= yearNum
+ 1 ELSE copyY
= yearNum
CASE 1, 3, 5, 7, 8, 10, 12: daysInMonth%
= 31 CASE 4, 6, 9, 11: daysInMonth%
= 30 CASE 2: daysInMonth%
= daysInFeb%
(copyY
)
FUNCTION daysInFeb%
(yr
) 'from Pete's calendar this is a very clear calc days = 29
IF days
THEN daysInFeb%
= days
ELSE daysInFeb%
= 28