dopolnil model kartic

master
Kostanjevec 2022-04-29 16:57:24 +02:00
parent ca342a20a3
commit 18222ed6a0
1 changed files with 46 additions and 24 deletions

70
test.py
View File

@ -3,67 +3,89 @@ from random import randint
#collection
clltn = []
def generate_card ():
# card = title, due, interval
def generate_card (clltn=[], user="bob", shared=False):
id = len(clltn) + 1
title = "".join([chr(randint(ord('a'), ord('z'))) for i in range(5)])
due = -1 #means new
interval = 0
card = title, due, interval
owned_by = user
card = id, title, due, interval, owned_by, shared
return card
def generate_clltn (n_of_cards):
clltn = [] #mogoče bi blo dobro met kaj drugega...
clltn = [] #mogoče bi blo dobro met dictionary, sam žeštejemo len zgoraj...
for n in range(n_of_cards):
clltn.append(generate_card())
clltn.append(generate_card(clltn=clltn))
return clltn
# USER
deck_size = 10
## config
deck_size = 3
max_new = 1
# setup
user_clltn = generate_clltn(100)
max_new = 5
# generate deck
##1 SR - super-memo style
def get_new(user_clltn, n_of_cards):
for card in user_clltn:
pass
def get_due(user_clltn, n_of_cards):
pass
def generate_deck(user_clltn, max_new, deck_size):
def generate_deck_sr(user_clltn, max_new, deck_size):
pass
#1 SR - super-memo style
def run_sr():
pass
#2 Probabilistic
## problem je, da pri probabilističnem težko nardiš, da pač en dan ni nič v decku...
#TODO
def generate_deck_prob(user_clltn, deck_size, max_new):
deck = []
for c in range(deck_size):
deck.append(user_clltn[c]) # tu vzame prvic ampak moralo bi random c brez ponavljanja obteženih z "due". rabimo tudi naključnih/najnovejših? max_new novih cardov.
return deck
interest_rate_def = 0.5
def prob_eval(card):
title, due, interval = card #due je tukaj interest rate
id, title, due, interval, owned_by, shared = card #due je tukaj interest rate
print("intrest rate je: ", due)
gumb = input("A te " + title + " zanima?")
gumb = input("A te " + title + " zanima?") # predpostalvjmao y = yes, m = maybe, n = no
if gumb == "y":
due = 0.99
elif gumb == "m":
due = abs(due / 1.3)
else:
due = abs(due / 1.3)
#abs je zato, ker "new" kodirano ko -1
# /1.3 in /2 sta na pamet izbrani funkciji
elif gumb=="n":
due = abs(due / 2)
card_mod = title, due, interval
card_mod = id, title, due, interval, owned_by, shared
return card_mod
# engine
deck = []
for c in range(deck_size):
deck.append(user_clltn[c])
print(deck)
deck_mod = []
for c in deck:
c = prob_eval(c)
deck_mod.append(c)
#TODO
def run_prob(deck, user_clltn):
#tu more dejansko spremenit collection...
deck_mod = []
for c in deck:
c = prob_eval(c)
deck_mod.append(c)
return deck_mod
print(deck_mod)
# engine
# random python stuff
## kako najt tuple v listu in ga spremeniti?
## kako vzet weight iz tuple in ga assignat pri izbiranju?