RosettaCodeData/Task/RPG-attributes-generator/Microsoft-Small-Basic/rpg-attributes-generator.basic
2026-04-30 12:34:36 -04:00

32 lines
814 B
Text

rollAttributes:
total = 0
atleast15 = 0
For i = 1 To 6
sum = 0
least = 6
For j = 1 To 4
rolls[j] = Math.GetRandomNumber(6)
sum = sum + rolls[j]
If rolls[j] < least Then
least = rolls[j]
EndIf
EndFor
values[i] = sum - least
total = total + values[i]
If values[i] >= 15 Then
atleast15 = atleast15 + 1
EndIf
EndFor
If total < 75 Or atleast15 < 2 Then
Goto rollAttributes
EndIf
TextWindow.WriteLine("Strength: " + values[1])
TextWindow.WriteLine("Dexterity: " + values[2])
TextWindow.WriteLine("Constitution: " + values[3])
TextWindow.WriteLine("Intelligence: " + values[4])
TextWindow.WriteLine("Wisdom: " + values[5])
TextWindow.WriteLine("Charisma: " + values[6])
TextWindow.WriteLine("----------------")
TextWindow.WriteLine("Total: " + total)