While the first few letters in the array <= xback can be completely random it's different for the rest. There's supposed to be a certain number of matches between within the array, e.g. if xback is 1 and matches 3 and totallaenge 5 a possible sequence is (A a B b b) - I guess the problem with the code is somehow when I subtract 1 from x, but it makes sense for me, hopefully someone can help!
Thank you very much in advance!
Code: Select all
On Preopencard
put "B C D F G H J K M N P Q R S T V X Z" into abc #start Values
split abc with space
put 1 into xback
put 3 into matches
put 5 into totallaenge
put 0 into gematched
repeat with x = 1 to totallaenge
put Random(17) into randomnumber
If x <= xback then
put abc[randomnumber] into nback[x]
else
put Random(20) into muenze
If gematched <= matches And muenze = 10 then
put ToLower(nback[x-xback]) into nback[x]
add 1 to gematched
Else
If abc[randomnumber] <> nback[x-xback] then
put abc[randomnumber] into nback[x]
else
subtract 1 from x
End if
End if
End if
put Test && nback[x] into Test
end repeat
put Test into fld "letter"
delete local Test
end Preopencard