From 8fe580e24d8d7ae9f803f43decdd833aa0ce9865 Mon Sep 17 00:00:00 2001 From: julien lengrand-lambert Date: Wed, 11 Sep 2013 16:17:24 +0200 Subject: [PATCH] Implements the stripping routine> Everything is sequential, but as we dont have much data this is not really an issue --- e_54.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/e_54.py b/e_54.py index 6e7356f..8b6e20e 100644 --- a/e_54.py +++ b/e_54.py @@ -38,13 +38,32 @@ def load_data(filename): file.close() return hands +def sort_n_strip(hands): + """ + As description indicates data is correct, we can ignore the color of the + cards. (and hence strip the value) + We also want to sort the players hands (to be worked with easier later) + """ + # just keeping the first element of the cards + stripped_hands = [[[val[0] for val in h] for h in hand] for hand in hands] + + sorted_hands = stripped_hands + #need to sort now + return sorted_hands + def winning_hands(filename): """ Returns the first of the firs num consecutive primes. """ hands = load_data(filename) - for val in hands: - print val + + data = sort_n_strip(hands) + print hands + print data + + #for val in hands: + + #print val if __name__ == '__main__': winning_hands("./e_54_poker.txt")