Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -29,59 +29,59 @@ set wordgap 7
|
|||
|
||||
|
||||
def gap (int n)
|
||||
sleep (* n e)
|
||||
sleep (* n e)
|
||||
end gap
|
||||
decl function off
|
||||
set off gap
|
||||
|
||||
|
||||
def on (int n)
|
||||
snd.beep f (/ (* n e) 1000)
|
||||
snd.beep f (/ (* n e) 1000)
|
||||
end on
|
||||
|
||||
|
||||
def dot ()
|
||||
on 1
|
||||
off 1
|
||||
on 1
|
||||
off 1
|
||||
end dot
|
||||
|
||||
|
||||
def dash ()
|
||||
on 3
|
||||
off 1
|
||||
on 3
|
||||
off 1
|
||||
end dash
|
||||
|
||||
|
||||
def bloop (int n)
|
||||
snd.beep (/ f 2) (/ (* n e) 1000)
|
||||
snd.beep (/ f 2) (/ (* n e) 1000)
|
||||
end bloop
|
||||
|
||||
|
||||
def encode_morse (string text)
|
||||
decl string<> words
|
||||
set words (split (upper (trim text)) " ")
|
||||
decl int i j k
|
||||
for () (< i (size words)) (inc i)
|
||||
for (set j 0) (< j (size words<i>)) (inc j)
|
||||
decl int loc
|
||||
set loc (locate words<i><j> chars)
|
||||
if (= loc -1)
|
||||
bloop 3
|
||||
else
|
||||
for (set k 0) (< k (size morse<loc>)) (inc k)
|
||||
if (= morse<loc><k> "-")
|
||||
dash
|
||||
elif (= morse<loc><k> ".")
|
||||
dot
|
||||
else
|
||||
bloop 3
|
||||
end if
|
||||
end for
|
||||
end if
|
||||
gap chargap
|
||||
end for
|
||||
gap wordgap
|
||||
end for
|
||||
decl string<> words
|
||||
set words (split (upper (trim text)) " ")
|
||||
decl int i j k
|
||||
for () (< i (size words)) (inc i)
|
||||
for (set j 0) (< j (size words<i>)) (inc j)
|
||||
decl int loc
|
||||
set loc (locate words<i><j> chars)
|
||||
if (= loc -1)
|
||||
bloop 3
|
||||
else
|
||||
for (set k 0) (< k (size morse<loc>)) (inc k)
|
||||
if (= morse<loc><k> "-")
|
||||
dash
|
||||
elif (= morse<loc><k> ".")
|
||||
dot
|
||||
else
|
||||
bloop 3
|
||||
end if
|
||||
end for
|
||||
end if
|
||||
gap chargap
|
||||
end for
|
||||
gap wordgap
|
||||
end for
|
||||
end encode_morse
|
||||
|
||||
|
||||
|
|
@ -92,6 +92,6 @@ end encode_morse
|
|||
|
||||
|
||||
while true
|
||||
out "A string to change into morse: " console
|
||||
encode_morse (in string console)
|
||||
out "A string to change into morse: " console
|
||||
encode_morse (in string console)
|
||||
end while
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue