This is weird.
dim char$(26)
`store all morse code data
char$(1) = ".-"
char$(2) = "-..."
char$(3) = "-.-."
char$(4) = "-.."
char$(5) = "."
char$(6) = "..-."
char$(7) = "--."
char$(8) = "...."
char$(9) = ".."
char$(10) = ".---"
char$(11) = "-.-"
char$(12) = ".-.."
char$(13) = "--"
char$(14) = "-."
char$(15) = "---"
char$(16) = ".--."
char$(17) = "--.-"
char$(18) = ".-."
char$(19) = "..."
char$(20) = "-"
char$(21) = "..-"
char$(22) = "...-"
char$(23) = ".--"
char$(24) = "-..-"
char$(25) = "-.--"
char$(26) = "--.."
cls rgb(255,255,255)
ink 0,rgb(255,255,255)
input "number of characters",n
do
cls rgb(255,255,255) : ink 0,rgb(255,255,255)
`make question
question$ = ""
for i = 1 to n
question$ = question$ + chr$(65 + rnd(25))
next i
print question$
input "answer: ",answer$
`check for correct answer
q$ = conv2morse(question$)
a$ = answer$
if a$ = q$
ink rgb(0,255,0),0
print "Correct!"
else
ink rgb(255,0,0),0
print "False!"
endif
print a$
print q$
suspend for key
loop
function conv2morse(text$)
ret$ = ""
for i = 1 to len(text$)
a = asc(mid$(text$,i)) - 64
ret$ = ret$ + char$(a) + " "
next i
endfunction ret$
Or maybe my DBC compiler is bugged?
Even if you input the right answer, you get a false message.
The problem is that when I display both answer and question, they match perfectly...
Immunity and Annihalation makes Immunihalation...