-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtippgenerator550.py
51 lines (40 loc) · 1.3 KB
/
tippgenerator550.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from tipp import Tipp
from helper import fuenfzig, sattolo
from blacklist import Blacklist
# Generates "infinite" tipps which are filtered using the playlist using an iterator
# style way by calling "next".
#
# Skipped tipps are collected in a list, call get_skipped to get them.
class TippGenerator550:
bl = Blacklist()
nums = 5
max_num = 50
print_nums_per_line = 10
def __init__(self):
self.current_pool = fuenfzig()
self.skipped = []
self.ignore_blacklist = False
def reset(self):
self.skipped.clear()
self.next()
def _get_tipp(self):
return Tipp(list(self.current_pool[:self.nums]), self.max_num, self.print_nums_per_line)
def set_ignore_blacklist(self, ignore):
self.ignore_blacklist = ignore
def next(self):
tipp = None
skipp = None
while True:
sattolo(self.current_pool)
tipp = self._get_tipp()
if self.ignore_blacklist:
return tipp
skipp = self.bl.contains(tipp)
if skipp:
self.skipped.append(skipp)
else:
return tipp
def get_skipped(self):
return self.skipped
def __str__(self):
return "current: [%s] skipped [%s]" % (self.current_pool, self.skipped)