diff options
author | Eduardo Pedroni <e.pedroni91@gmail.com> | 2017-01-15 14:54:34 +0100 |
---|---|---|
committer | Eduardo Pedroni <e.pedroni91@gmail.com> | 2017-01-15 14:54:34 +0100 |
commit | f90daf96cd79bcdc72a8d76b3ab0484f64aad1b3 (patch) | |
tree | 1c3cd9ab70da16e3fc51194003f186789bb9544d | |
parent | d31f1337c252a65f3b33e7d74cdbda14547ae39f (diff) |
Sorted out card shuffling, cards are now served in random order and not repeated until all have been served
-rwxr-xr-x | flashcards | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -3,7 +3,7 @@ import re import sys from pathlib import Path -from random import randint +from random import shuffle cardRegex = "CARD: " prefixLength = 6 @@ -48,11 +48,12 @@ def extractCards(f): # Loops serving cards to the user until the program is exited def serveCards(cards): while True: - card = cards[randint(0, len(cards) - 1)] - print(card[0]) - input() - print(card[1]) - input() + for card in cards: + print("----------------------------------------------------------------------------") + print(card[0]) + input() + print(card[1]) + input() def debugCards(cardList): for c in cardList: @@ -62,6 +63,7 @@ def debugCards(cardList): def main(): files = getFileList() cards = createCardList(files) + shuffle(cards) serveCards(cards) if __name__ == "__main__": |