‘Einer wird gewinnen, ein Abzähl Spiel programmieren mit VB-Script

Option Explicit

Dim n, m, i, x, count, flag
Dim Spieler()

n = InputBox(“Anzahl der Spieler?”)
m = InputBox(“Zähler?”)

ReDim Spieler(n)
count = 0

For x=1 To n-1
For i=1 To m
flag = 0
count = count+1
if count-n > 0 then
count = count-n
end if
if (Spieler(count)=”out”) then
do while flag=0
count = count+1
if count-n > 0 then
count = count-n
end if
if (Spieler(count)<>”out”) then
flag = 1
end if
loop
end if
Next
Spieler(count) = “out”
Next

For x=1 To n
if Spieler(x) <> “out” then
msgbox “Spieler ” & x & ” ist der Gewinner!”
‘Denn Gewinner des Abzähl Spiels ausgeben
end if
Next


Leave a Comment


You must log in to post a comment.