The Ruby version of the script.
#!/usr/bin/ruby def level_th(number) number_th = number.to_s if number == 11 or number == 12 or number == 13 number_th = number_th + "th" elsif number_th[-1] == "1" number_th = number_th + "st" elsif number_th[-1] == "2" number_th = number_th + "nd" elsif number_th[-1] == "3" number_th = number_th + "rd" else number_th = number_th + "th" end return number_th end begin #Globals max_lvl = 40 #Main system("clear") #Windows and DOS use #system("cls") #Headers print "Char \t \tClass Skill\tCC Skill\t \tStat\t\n" print "Level\tXP\tMax Ranks\tMax Ranks\tFeats\tIncreases\t\n" #Main loop xp = 0 feats = 0 stats = 0 for level in 1...max_lvl + 1 xp = (xp + (level - 1) * 1000) maxranks = level + 3 maxcc = maxranks / 2.0 feat_check = level % 3 feats_out = "--" if feat_check == 0 || level == 1 feats = feats + 1 feats_out = level_th(feats) end stat_check = level % 4 stats_out = "--" if stat_check == 0 stats = stats + 1 stats_out = level_th(stats) end level_out = level_th(level) printf " %s\t%d\t%d\t\t%g\t\t%s\t%s\t\n", level_out, xp, maxranks, maxcc, feats_out, stats_out end end # vi: shiftwidth=3 tabstop=3 et