Пример #1
0
def eligible_combos(c):
  # first one is always picked from the special list
  if len(NEMELEX_COMBOS) == 0:
    return [combos.NEM_ELIGIBLE_COMBOS]
  # sometimes look at the special list for the later ones, too
  if NEMELEX_USE_LIST:
    won_games = query.get_winning_games(c)
    won_combos = set([x['charabbrev'] for x in won_games])
    eligible =  [x for x in combos.NEM_ELIGIBLE_COMBOS
                 if (x not in won_combos)]
    pcombo_names = [x[0] for x in NEMELEX_COMBOS]
    weighting = weight_combos(eligible, pcombo_names)
    return [eligible,weighting]
  # otherwise pick from the valid combos with the lowest high score in the tourney:
  else:
    eligible = combos.VALID_COMBOS
    pcombo_names = [x[0] for x in NEMELEX_COMBOS]
    # Try not to use a repeat race or class if possible.
    filtered_eligible = filter_combos(eligible, pcombo_names)
    if filtered_eligible:
      eligible = filtered_eligible
    eligible_with_scores = [[combo_name, query.highscore(c, combo_name)] for combo_name in eligible]
    eligible_with_scores.sort(key = lambda e: e[1])
    l = 19
    if l > len(eligible_with_scores)-1:
      l = len(eligible_with_scores)-1
    candidates = [e[0] for e in eligible_with_scores if e[1] <= eligible_with_scores[l][1]]
    return [candidates]
Пример #2
0
def eligible_combos(c):
    # first one is always picked from the special list
    if len(NEMELEX_COMBOS) == 0:
        return [combos.NEM_ELIGIBLE_COMBOS]
    # sometimes look at the special list for the later ones, too
    if NEMELEX_USE_LIST:
        won_games = query.get_winning_games(c)
        won_combos = set([x['charabbrev'] for x in won_games])
        eligible = [
            x for x in combos.NEM_ELIGIBLE_COMBOS if (x not in won_combos)
        ]
        pcombo_names = [x[0] for x in NEMELEX_COMBOS]
        weighting = weight_combos(eligible, pcombo_names)
        return [eligible, weighting]
    # otherwise pick from the valid combos with the lowest high score in the tourney:
    else:
        eligible = combos.VALID_COMBOS
        pcombo_names = [x[0] for x in NEMELEX_COMBOS]
        # Try not to use a repeat race or class if possible.
        filtered_eligible = filter_combos(eligible, pcombo_names)
        if filtered_eligible:
            eligible = filtered_eligible
        eligible_with_scores = [[combo_name,
                                 query.highscore(c, combo_name)]
                                for combo_name in eligible]
        eligible_with_scores.sort(key=lambda e: e[1])
        l = 19
        if l > len(eligible_with_scores) - 1:
            l = len(eligible_with_scores) - 1
        candidates = [
            e[0] for e in eligible_with_scores
            if e[1] <= eligible_with_scores[l][1]
        ]
        return [candidates]
Пример #3
0
def eligible_combos(c):
  eligible = combos.VALID_COMBOS
  pcombo_names = [x[0] for x in NEMELEX_COMBOS]
  # Try not to use a repeat race or class if possible.
  filtered_eligible = filter_combos(eligible, pcombo_names)
  if filtered_eligible:
    eligible = filtered_eligible
  eligible_with_scores = [[combo_name, query.highscore(c, combo_name)] for combo_name in eligible]
  eligible_with_scores.sort(key = lambda e: e[1])
  l = 19
  if l > len(eligible_with_scores)-1:
    l = len(eligible_with_scores)-1
  candidates = [e[0] for e in eligible_with_scores if e[1] <= eligible_with_scores[l][1]]
  return candidates
Пример #4
0
elif difficulty == "h":
    rand_num = randint(0,100)
    guess = int(input("\nMy Number is between 0-100. Take a Guess\n"))
else:
    print("invalid difficulty")
    exit()

while guess != rand_num:
    score -= randint(5,20)
    guess = int(input("Incorrect. Take another guess:\n" ))
    if guess > rand_num:
        print("Your Number is too big ")
    elif guess < rand_num:
        print("Your Number is too low ")

print("Correct!")
print("Your score is", score)

highscore = highscore(name, difficulty)
add(name,score,difficulty)

if bool(highscore) == False:
    "nothing"
elif score > highscore[-1]:
    print("You beat your highscore of", highscore[-1], "on difficulty", difficulty)
else:
    print("You have not beaten your highscore of", highscore[-1],'yet.')
    
print("\nThis is the leaderboard for",difficulty,"difficulty:\n")
top10(difficulty)