bug: 'prob_deck_eval() v collection vrne samo eno updejtano karto ne pa celega updejtanega decka

master
Kostanjevec 2022-05-01 18:00:26 +02:00
parent 88cb1f5bbe
commit 2de39b3b20
1 changed files with 11 additions and 5 deletions

16
test.py
View File

@ -58,11 +58,14 @@ def generate_weights(user_clltn):
return weights_new, weights_due
def generate_deck_prob(user_clltn, max_new, max_due):
deck, dck_due, dck_new = [], [], []
deck, dck_due, dck_new, due_cards = [], [], [], 0
w_new, w_due = generate_weights(user_clltn)
#treba je sestet non zero weights
new_cards = sum(w_new)
due_cards = sum(w_due)
for w in w_due:
if w > 0:
due_cards += 1
#preverimo, če imamo dovolj kartic
if new_cards<max_new:
@ -87,7 +90,7 @@ def prob_eval_card(card):
print("intrest rate je: ", due)
gumb = input("A te " + title + " zanima?") # predpostalvjmao y = yes, m = maybe, n = no
if gumb == "y":
due = 0.99
due = 1
elif gumb == "m":
due = abs(due / 1.3)
#abs je zato, ker "new" kodirano ko -1
@ -107,13 +110,16 @@ def prob_eval_deck(deck, user_clltn):
for index, card in enumerate(user_clltn):
if card[0] == id:
user_clltn[index] = card_mod
return user_clltn
break
return user_clltn #TODO ta collection ima samo eno karto updejtano, ne pa celega decka
# engine
def run(user_clltn, n_of_days, max_new, max_due):
for day in range(n_of_days):
deck = generate_deck_prob(user_clltn, max_new, max_due) #to more bit global, da se ne generira skoz nov
user_clltn = prob_eval_deck(deck, user_clltn)
print("konec dneva: ", user_clltn)
# config
@ -124,4 +130,4 @@ max_deck_size = max_new + max_due
user_clltn = generate_clltn(20)
run(user_clltn, n_of_days, max_new, max_due)
run(user_clltn, n_of_days, max_new, max_due)