'OldMoses' 32 bit modification of jeffjeff's vernier reader
DIM SHARED ansNum
, ansUnit$
, indelning
, enhet$
, faktor
'this program is to create a vernier reading practice game'
'ge information om programmet
info
ChooseMeter
max = 20 'greatest value of reading in cm
L1 = 40 ' longer scale line
L2 = 10 'shorter scale line
space = 20 'spacing of main scale
tolerance = .008 'cm error allowed
x1 = 200 + I% * space * 1.9 '0.9 or1.9 for different vern widths
y1 = 100
y2 = y1 + L1
y2 = y1 + (L1 + L2) / 2
LINE (x1
, y1
)-(x1
, y2
), &HFFA800A8 reading = del * max
Rmm10
= INT(reading
* 100) maincm = 200 - (reading - rcm) * space * 10
xm1 = maincm + I% * space
ym1 = 100
ym2 = ym1 - L1
ym2 = ym1 - (L1 + L2) / 2
LINE (xm1
, ym1
)-(xm1
, ym2
) LOCATE 3, 26 - (reading
- rcm
) * 25 LOCATE 3, 50 - (reading
- rcm
) * 25 LOCATE 3, 75 - (reading
- rcm
) * 25 NumDec (ans$)
IF ABS(ansNum
- reading
) < tolerance
AND ansUnit$
= "cm" OR ABS(ansNum
/ 10 - reading
) < tolerance
AND ansUnit$
= "mm" THEN rightRow = rightRow + 1
PRINT "Good! You've done "; rightRow;
" right in a row!" PRINT "Try to see what you did wrong!" rightRow = 0
PRINT "mm Exact value: "; reading;
" cm" INPUT "Ready to continue? y/n (y)", r$
enhet$ = "mm"
enhet$ = "cm"
'denna subrutin skall slumpa fram skala m„tomr†de mm
'v„lj enhet
'this sub creates a random scale and markings w unit
ChooseEnhet
'v„lj factor
ChoseFaktor
faktor = 1
faktor = 2
faktor = 10
faktor = 10
PRINT " VERNIER3.BAS PRACTICE PROGRAM FOR READING VERNIER SCALE" PRINT " English Version 1995 Apr 10 Jeff Forssell www.TupoMedia.se " PRINT " The first step is to see what is the number of whole units on" PRINT " the main scale. In the case of the VERNIER CALIPER this would be" PRINT " millimeters (mm). This you read by looking at the main scale just" PRINT " above the first (=zero) line of the vernier scale. Then to get the" PRINT " tenths of mm (1/10 mm) we look at the vernier scale and use the value" PRINT " corresponding to the line which best matches (aligns with) the lines " PRINT " on the main scale above it. (If two lines match equally try XX.X5mm.)" PRINT " You should answer to 1/10mm like this: 34.5mm or 3.45cm " PRINT " You can use either . or , as decimal separator. You can also " PRINT " have a space(s) between 34,5 mm if you want. But you may not have " PRINT " CM or MM as units. This program is not prepared yet for other" PRINT " correct forms like 0.0345m or 3.45e-2m." PRINT " If the program doesn't say GOOD about you answer, try to find" PRINT " your mistake. If you don't, make a screen shot [PrtScr] and send to" PRINT " jeff.forssell@gmail.com . There might be a program error or" PRINT " something you don't understand yet." PRINT " If you want to LEAVE the program now, Press <L> and <ENTER>" PRINT " Otherwise press <ENTER> to continue."
'denna program h„mtar in en storlek med sifferv„rde och enhet
'och delar upp det i ett m„tetal och en enhetsstr„ng
'this program gets input and divides it into a number and unit string
LINE INPUT "Read caliper! (L for Leave) ", ans$
'„ndrar komma till decimalpunkt och tar bort mellanslag
'changes comma to decimal point and removes SPACEs
NyDec$ = ""
char$
= MID$(ans$
, num
, 1) IF char$
= "," THEN char$
= "." IF char$
= " " THEN char$
= "" NyDec$ = NyDec$ + char$
ansUnit$ = ""
char$ = ""
char$ = ""
ansUnit$ = ansUnit$ + char$
PRINT "A reading must have a unit to be meaningful!" PRINT "Your answer = "; ansNum;
" "; ansUnit$;