Skip to content

Instantly share code, notes, and snippets.

@ruohki
Created September 2, 2016 05:37
Show Gist options
  • Save ruohki/e5b61b11b41e1f3b9a96a8531c82fc1b to your computer and use it in GitHub Desktop.
Save ruohki/e5b61b11b41e1f3b9a96a8531c82fc1b to your computer and use it in GitHub Desktop.
declare function isValid(array() as integer, number as integer) as byte
randomize timer
dim zahl as integer
dim i as integer
dim Zahlen(1 to 4) as integer
dim zaehler as integer
dim ende as byte
do
zahl = int((rnd() * 17) + 1)
if isValid(Zahlen(), zahl) then
zaehler += 1
Zahlen(zaehler) = zahl
if zaehler = ubound(Zahlen) then
ende = 1
end if
end if
loop until ende
print "Froehliche Hungerspiele"
print "Die Gewinnerzahlen sind:"
print
for i = 1 to ubound(Zahlen)
print Zahlen(i)
sleep 1000
next i
print
print "Herzlichen Glueckwunsch an alle Gewinner, und moege das Glueck stets mit euch sein!"
do
loop
function isValid(array() as integer, number as integer) as byte
dim a as integer
dim found as boolean
for a = lbound(array) to ubound(array)
if (array(a) = number) then
isValid = 0
exit function
end if
next
isValid = 1
end function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment