-
Notifications
You must be signed in to change notification settings - Fork 0
/
tableboard.py
786 lines (644 loc) · 28 KB
/
tableboard.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
#!/usr/bin/env python
"""tableboard.py class required for tableboard
:author: Jose Carlos Recuero
:version: 0.1
:since: 10/01/2014
"""
__docformat__ = 'restructuredtext en'
###############################################################################
## _ _
## (_)_ __ ___ _ __ ___ _ __| |_ ___
## | | '_ ` _ \| '_ \ / _ \| '__| __/ __|
## | | | | | | | |_) | (_) | | | |_\__ \
## |_|_| |_| |_| .__/ \___/|_| \__|___/
## |_|
###############################################################################
#
# import std python modules
#
import copy
#
# import user python modules
#
import loggerator
import objecto
import tablecell
###############################################################################
##
## ___ ___ _ __ ___| |_ __ _ _ __ | |_ ___
## / __/ _ \| '_ \/ __| __/ _` | '_ \| __/ __|
## | (_| (_) | | | \__ \ || (_| | | | | |_\__ \
## \___\___/|_| |_|___/\__\__,_|_| |_|\__|___/
##
###############################################################################
#
COUNT_LIMIT = 100
MIN_MATCH = 3
WILDCARD = 9
AXE_X = 1
AXE_Y = 2
DIR_RIGHT = 1
DIR_LEFT = 2
DIR_UP = 3
DIR_DOWN = 4
MOVE_IN_BOARD = {'right': {'loopFunc': lambda first, second: (first, second),
'incFunc': lambda (x, y): (x, y + 1),
'axe': AXE_X,
'direction': DIR_RIGHT},
'left': {'loopFunc': lambda first, second: (first, second),
'incFunc': lambda (x, y): (x, y - 1),
'axe': AXE_X,
'direction': DIR_LEFT},
'down': {'loopFunc': lambda first, second: (second, first),
'incFunc': lambda (x, y): (x + 1, y),
'axe': AXE_Y,
'direction': DIR_DOWN},
'up': {'loopFunc': lambda first, second: (second, first),
'incFunc': lambda (x, y): (x - 1, y),
'axe': AXE_Y,
'direction': DIR_UP}, }
###############################################################################
## _ _ _
## ___ _ _| |__ _ __ ___ _ _| |_(_)_ __ ___ ___
## / __| | | | '_ \| '__/ _ \| | | | __| | '_ \ / _ \/ __|
## \__ \ |_| | |_) | | | (_) | |_| | |_| | | | | __/\__ \
## |___/\__,_|_.__/|_| \___/ \__,_|\__|_|_| |_|\___||___/
##
###############################################################################
#
###############################################################################
## _ _ __ _ _ _ _
## ___| | __ _ ___ ___ __| | ___ / _(_)_ __ (_) |_(_) ___ _ __ ___
## / __| |/ _` / __/ __| / _` |/ _ \ |_| | '_ \| | __| |/ _ \| '_ \/ __|
## | (__| | (_| \__ \__ \ | (_| | __/ _| | | | | | |_| | (_) | | | \__ \
## \___|_|\__,_|___/___/ \__,_|\___|_| |_|_| |_|_|\__|_|\___/|_| |_|___/
##
###############################################################################
#
#
#------------------------------------------------------------------------------
class TableBoard(objecto.Objecto):
#--------------------------------------------------------------------------
def __init__(self, theSize, theBoard=None, theNewCellCb=None):
""" TableBoard initialization method.
:type theSize: int
:param theSize: Size of the board (size x size).
:type theBoard: list
:param theBoard: board to be used for the tableboard
:type theNewCellCb: func
:param theNewCellCb: Function to be called to create a new cell
"""
super(TableBoard, self).__init__('tableboard')
self.size = theSize
self.newCellCb = theNewCellCb
self.board = theBoard if theBoard else self._createDefaultTableBoard()
self.logger = loggerator.getLoggerator('tableboard')
#--------------------------------------------------------------------------
def _copyToListAndSort(self, theSet):
""" Copy a set to a list and sort the list result.
:type theSet: set
:param theSet: Set instance to copy and sort.
:rtype: list
:return: Sorted list with the given set content.
"""
lista = list(theSet)
lista.sort()
return lista
#--------------------------------------------------------------------------
def _createDefaultTableBoard(self):
""" Create a new default table board
It used callback method passed when the tableboard was created in order
to create new cells on the board.
:rtype: list
:return: board with a default table board
"""
return [[self.newCellCb((x, y)) for y in xrange(self.size)] for x in xrange(self.size)]
#--------------------------------------------------------------------------
def addNewCell(self, thePosition):
""" Create a new cell at the given position
Create a new cell using the tableboard callback method passed at init
time.
:type thePosition: tuple
:param thePosition: Tuple with x and y position coordinates
:rtype: Cell
:return: New cell instance
"""
x, y = thePosition
aCell = self.newCellCb(thePosition)
self.board[x][y] = aCell
return aCell
#--------------------------------------------------------------------------
def removeCell(self, thePosition):
""" Remove a cell from the given position
Cell is removed from the tableboard and None is set for the empty
position.
:type thePosition: tuple
:param thePosition: Tuple with x and y position coordinates
:rtype: Cell
:return: Cell instance being removed
"""
x, y = thePosition
aCell = self.getCell(thePosition)
self.board[x][y] = None
return aCell
#--------------------------------------------------------------------------
def _loopForCells(self, theSide):
""" Loop a row or a column for matches.
:type theSide: object
:param theSide: Direction to traverse for finding matches.
:rtype: list
:return: List with all matches for the give direction.
"""
match = []
for firstLoopIdx in xrange(self.size):
secondLoopIdx = 0
# We don't have to loop until the end, because if it does not find
# a match at MIN_MATCH - 1, it is not going to find it in what is
# left.
while secondLoopIdx <= (self.size - (MIN_MATCH - 1)):
#self.logger.debug('%s %s %s %s' % (theSide, firstLoopIdx, secondLoopIdx, match))
position = MOVE_IN_BOARD[theSide]['loopFunc'](firstLoopIdx, secondLoopIdx)
traverseMatch = set()
inc = self.findMatch(position, self.getCellData(position), 0, traverseMatch, theSide)
if inc >= MIN_MATCH:
traverseListMatch = list(traverseMatch)
traverseListMatch.sort()
match.append(traverseListMatch)
secondLoopIdx += inc
return match
#--------------------------------------------------------------------------
def isValueIn(self, theValue):
""" Check if the given value is inside the range.
:type theValue: int
:param theValue: Value t o check.
:rtype: boolean
:return: True if position is in the range. False if it is outside.
"""
return theValue in xrange(self.size)
#--------------------------------------------------------------------------
def isCellInBoard(self, thePosition):
""" Check if the given cell is inside the board.
:type thePosition: list
:param thePosition: Point with the position.
:rtype: boolean
:return: True if position is inside the board. False if it is outside.
"""
x, y = thePosition
return self.isValueIn(x) and self.isValueIn(y)
#--------------------------------------------------------------------------
def getCell(self, thePosition):
""" Get the cell instance for a given position.
:type thePosition: list
:param thePosition: Point with the position.
:rtype: Cell
:return: The Cell instance for the given position.
"""
if self.isCellInBoard(thePosition):
x, y = thePosition
return self.board[x][y]
else:
return None
#--------------------------------------------------------------------------
def getCellData(self, thePosition):
""" Get the cell data instance for a given position.
:type thePosition: list
:param thePosition: Point with the position.
:rtype: object
:return: The data object instance for the given position.
"""
aCell = self.getCell(thePosition)
return aCell.getData() if aCell else None
#--------------------------------------------------------------------------
def getCellSprite(self, thePosition):
""" Get the cell sprite instance for a given position.
:type thePosition: list
:param thePosition: Point with the position.
:rtype: object
:return: The sprite object instance for the given position.
"""
aCell = self.getCell(thePosition)
return aCell.getSprite() if aCell else None
#--------------------------------------------------------------------------
def iterCell(self):
""" Iterate all cells in the board.
:rtype: iterator
:return: iterator with next cell in the board
"""
for row in self.board:
for aCell in row:
yield aCell
#--------------------------------------------------------------------------
def iterCellData(self):
""" Iterate all cells data in the board.
:rtype: iterator
:return: iterator with next cell data in the board
"""
for row in self.board:
for aCell in row:
yield aCell.getData()
#--------------------------------------------------------------------------
def iterCellSprite(self):
""" Iterate all cells sprite in the board.
:rtype: iterator
:return: iterator with next cell sprite in the board
"""
for row in self.board:
for aCell in row:
yield aCell.getSprite()
#--------------------------------------------------------------------------
def setCell(self, thePosition, theCell):
""" Asign the given cell instance to the given position.
:type thePosition: list
:param thePosition: Point with the position.
:type theCell: Cell
:param theCell: Cell instance to insert in the table
:rtype: boolean
:return: True if cell was inserted. False if not (outside the baord).
"""
if self.isCellInBoard(thePosition):
x, y = thePosition
self.board[x][y] = theCell
return True
else:
return False
#--------------------------------------------------------------------------
def setCellData(self, thePosition, theData):
""" Asign the given data instance to the given position.
:type thePosition: list
:param thePosition: Point with the position.
:type theData: object
:param theData: Data object instance to insert in the table
:rtype: boolean
:return: True if data was inserted. False if not (outside the baord).
"""
aCell = self.getCell(thePosition)
return aCell.setData(theData) if aCell else False
#--------------------------------------------------------------------------
def setCellSprite(self, thePosition, theSprite):
""" Asign the given sprite instance to the given position.
:type thePosition: list
:param thePosition: Point with the position.
:type theSprite: object
:param theSprite: Sprite object instance to insert in the table
:rtype: boolean
:return: True if sprite was inserted. False if not (outside the baord).
"""
aCell = self.getCell(thePosition)
return aCell.setSprite(theSprite) if aCell else False
#--------------------------------------------------------------------------
def swapCells(self, theFirstCell, theSecondCell):
""" Swap cell content for given position.
Move cell from the second position to the second one, and viceverse.
:type theFirstCell: Cell
:param theFirstCell: First Cell instance to swap.
:type theSecondCell: Cell
:param theSecondCell: Second Cell instance to swap.
:rtype: boolean
:return: True.
"""
x1, y1 = theFirstCell.position
x2, y2 = theSecondCell.position
#self.logger.debug("Swap (%s, %s) %s for (%s, %s) %s" % (x1, y1, theFirstCell.data, x2, y2, theSecondCell.data))
theFirstCell.swap(theSecondCell)
self.board[x1][y1], self.board[x2][y2] = self.board[x2][y2], self.board[x1][y1]
return True
#--------------------------------------------------------------------------
def fallCell(self, theCell):
""" Move down all non-empty cells on top of the given one.
:type theCell: Cell
:param theCell: Cells on top of this will be moved down
"""
if theCell.getData() is None:
#self.logger.debug('falling cell %s %s' % (theCell.getPosition(), theCell.getData()))
x, y = theCell.getPosition()
if x == (self.size - 1):
return -1
topCell = self.board[x + 1][y]
if topCell.getData() is None:
if self.fallCell(topCell) == -1:
return -1
topCell = self.board[x + 1][y]
self.swapCells(theCell, topCell)
else:
return 0
#--------------------------------------------------------------------------
def isMatch(self, theValue, theMatch):
""" Check if the given value is a valid match.
:type theValue: object
:param theValue: Value to match.
:rtype: boolean
:return: True if value is a valid match. False if it is not.
"""
return theValue == theMatch or theMatch == WILDCARD
#--------------------------------------------------------------------------
def incPosition(self, thePosition, theSide):
""" Increase a traverse cell through the board in a given direction.
:type thePosition: list
:param thePostion: Point with the initial position.
:type theSide: object
:param theSide: Direction to traverse.
"""
newPosition = MOVE_IN_BOARD[theSide]['incFunc'](thePosition)
return None if False in map(self.isValueIn, newPosition) else newPosition
#--------------------------------------------------------------------------
def findMatch(self, thePosition, theValue, theCounter, theMatchSet, theSide):
""" Find how many matches can be found in a given direction.
:type thePosition: list
:param thePosition: Point with position to check matches.
:type theValue: object
:param theValue: Value to check any match.
:type theCounter: int
:param theCounter: Number of matches.
:type theMatchSet: set
:param theMatchSet: Set with all points that match the value.
:type theSide: object
:param theSide: Direction to traverse for finding matches..
"""
#x, y = thePosition
#self.logger.debug("pos: (%s, %s), value: %s data: %s" % (x, y, theValue, self.getCellData(thePosition)))
if self.isMatch(theValue, self.getCellData(thePosition)):
theCounter += 1
theMatchSet.add(thePosition)
if theCounter == COUNT_LIMIT:
return theCounter
else:
newPosition = self.incPosition(thePosition, theSide)
return self.findMatch(newPosition, theValue, theCounter, theMatchSet, theSide) if newPosition else theCounter
else:
return theCounter
#--------------------------------------------------------------------------
def matchAtCell(self, thePosition):
""" Find matches in all direction for a given position.
:type thePosition: list
:param thePosition: Point with the position to check all matches.
:rtype: tuple
:return: Tuple with all row and column matches.
"""
xMatch = set()
yMatch = set()
self.findMatch(thePosition, self.getCellData(thePosition), 0, xMatch, 'right')
self.findMatch(thePosition, self.getCellData(thePosition), 0, xMatch, 'left')
self.findMatch(thePosition, self.getCellData(thePosition), 0, yMatch, 'down')
self.findMatch(thePosition, self.getCellData(thePosition), 0, yMatch, 'up')
return (self._copyToListAndSort(xMatch), self._copyToListAndSort(yMatch))
#--------------------------------------------------------------------------
def matchBoard(self):
""" Look for matches in all the board.
:rtype: list
:return: List with all matches found in the board.
"""
matches = []
for side in ('right', 'down'):
matches.append(self._loopForCells(side))
#self.logger.debug('matches: %s' % (matches, ))
return matches
#--------------------------------------------------------------------------
def defaultMatches(self):
""" Return default matches list to be used in a loop
:rtype: list
:return: List with default values to be used in a loop
"""
return [True, True]
#--------------------------------------------------------------------------
def isThereAnyMatch(self, theMatches):
""" Check if there is any match in the parameter passed
:type theMatches: list
:param theMatches: list with row and column matches
:rtype: bool
:return: True if there is any match, else False
"""
return theMatches[0] or theMatches[1]
#--------------------------------------------------------------------------
def emptyCellsInBoard(self):
""" Look for cells with None data
:rtype: list
:return: List with all cells wiht None data
"""
matches = []
for aCell in self.iterCell():
if aCell.data is None:
matches.append(aCell)
return matches
#--------------------------------------------------------------------------
def setEmptyCells(self, theMatches):
""" Set Cell data to none for all position being passed
:type theMatches: list
:param theMatches: Row and Column lists with matches to None
"""
rowMatches, colMatches = theMatches
for match in rowMatches:
for pos in match:
self.setCellData(pos, None)
for match in colMatches:
for pos in match:
self.setCellData(pos, None)
#--------------------------------------------------------------------------
def fallBoard(self):
""" Traverse all cells in the board and make then fall
"""
for aCell in self.iterCell():
self.fallCell(aCell)
#--------------------------------------------------------------------------
def logBoard(self):
""" Log all board information
"""
for x in xrange(self.size):
row = ""
for y in xrange(self.size):
pos = (x, y)
c = self.getCell(pos)
row += '%s %s' % (c.position, c.data)
#self.logger.debug('%s' % (row, ))
#--------------------------------------------------------------------------
def matchResults(self, theMatches, theUser=None):
""" Update dictionary after cell match
:type theMatches: list
:param theMatches: Row and Column lists with matches to None
:type theUser: User
:param theUser: user instance
:rtype: dict
:return: dictionary with final stats
"""
attrsDict = tablecell.TableCell.createAttrsDict()
for matchLines in theMatches:
for match in matchLines:
cellToUse = self.getCell(match[0])
matchDict = cellToUse.executeMatch(match, theUser)
for key in attrsDict.keys():
attrsDict[key] += matchDict.get(key, 0)
cellKlass = cellToUse.getClass()
theUser.addStatCount(cellKlass, len(match))
theUser.addStatRuns(cellKlass)
return attrsDict
#--------------------------------------------------------------------------
def cellTogetherCell(self, theCell, theOtherCell):
""" Check if two cells are together (row or column wise)
:type theCell: Cell
:param theCell: first cell to check
:type theOtherCell: Cell
:param theOtherCell: second cell to check
:rtype: bool
:return: True if they are together, else False
"""
x1, y1 = theCell.position
x2, y2 = theOtherCell.position
if (x1 == x2) and abs(y1 - y2) == 1:
return True
if (y1 == y2) and abs(x1 - x2) == 1:
return True
return False
#--------------------------------------------------------------------------
def streamlineTableRows(self):
""" Transform 2-dim table in 1-dim streaming rows
:rtype: list
:return: list with 2-dim table streamlines per row
"""
oneline = []
for line in self.board:
oneline += copy.copy(line)
return oneline
#--------------------------------------------------------------------------
def streamlineTableCols(self):
""" Transform 2-dim table in 1-dim streaming columns
:rtype: list
:return: list with 2-dim table streamlines per column
"""
return [self.board[y][x] for x in xrange(self.size) for y in xrange(self.size)]
#--------------------------------------------------------------------------
def matchInWindow(self, theWindow, theMatchSize):
""" Check if there is a match in window provided.
:type theWindow: list
:param theWindow: list to search for matches
:type theMatchSize: int
:param theMatchSize: size for a valid match
:rtype: bool
:return: True if a match was found, else False
"""
klasses = {}
for x in theWindow:
klassName = x.getClass()
if klassName in klasses:
klasses[klassName] += [x]
if len(klasses[klassName]) == theMatchSize:
matchCell = klasses[klassName][0]
otherCell = [acell for acell in theWindow if acell.getClass() != klassName]
#self.logger.info('match at %s, match is %s, other is %s' %
# (theWindow, matchCell, otherCell))
return (True, matchCell, otherCell)
else:
klasses[klassName] = [x]
return (False, None, None)
#--------------------------------------------------------------------------
def _logWindow(self, theWindow):
""" Log information for the given window in a readable way.
:type theWindow: list
:parama theWindow: window to log information
"""
retoStr = ""
for acell in theWindow:
x, y = acell.getPosition()
retoStr += '%s[%d][%d] ' % (acell.getClass(), x, y)
return retoStr
#--------------------------------------------------------------------------
def searchInCrossStreamline(self, theStreamline, theSize):
""" Search if there is any match in the given cross streamline list
It search if at least there is the number of cells passed as theSize,
and then check if moving the given ones can we make a match.
:type theStreamline: list
:param theStreamline: list to search for matches
:type theSize: int
:param theSize: window size
:rtype: bool
:return: True if a match was found, else False
"""
window = []
index = 0
streamlineLen = len(theStreamline)
while True:
if (index + theSize) > streamlineLen:
return False
window = theStreamline[index:index + theSize]
anyMatch, matchCell, noMatchCell = self.matchInWindow(window, theSize - 1)
if anyMatch and noMatchCell:
noMatchIndex = theStreamline.index(noMatchCell[0])
beforeIndex = noMatchIndex - self.size
afterIndex = noMatchIndex + self.size
if beforeIndex >= 0 and theStreamline[beforeIndex].getClass() == matchCell.getClass():
self.logger.info('searchInCrossStreamline: match found at %s' %
(self._logWindow(window), ))
return True
if afterIndex < streamlineLen and theStreamline[afterIndex].getClass() == matchCell.getClass():
self.logger.info('searchInCrossStreamline: match found at %s' %
(self._logWindow(window), ))
return True
if (index + theSize) % self.size:
index += 1
else:
index += theSize
#--------------------------------------------------------------------------
def searchInStreamline(self, theStreamline, theSize, theMatchSize):
""" Search if there is any match in the given streamline list
:type theStreamline: list
:param theStreamline: list to search for matches
:type theSize: int
:param theSize: window size
:type theMatchSize: int
:param theMatchSize: size for a valid match
:rtype: bool
:return: True if a match was found, else False
"""
window = []
index = 0
while True:
if (index + theSize) > len(theStreamline):
return False
window = theStreamline[index:index + theSize]
anyMatch, matchCell, noMatchCell = self.matchInWindow(window, theMatchSize)
if anyMatch:
self.logger.info('searchInStreamline: match found at %s' %
(self._logWindow(window), ))
return True
else:
if (index + theSize) % self.size:
index += 1
else:
index += theSize
#--------------------------------------------------------------------------
def searchForAnyPossibleMatch(self):
""" Check if could be any match in the table
:rtype: bool
:return: True if could be a match, else False
"""
lines = (self.streamlineTableRows(), self.streamlineTableCols())
for line in lines:
if self.searchInCrossStreamline(line, MIN_MATCH):
return True
if self.searchInStreamline(line, MIN_MATCH + 1, MIN_MATCH):
return True
return False
#--------------------------------------------------------------------------
def searchForAnyMatch(self):
""" Check if there is any match in the table
:rtype: bool
:return: True if there is a match, else False
"""
if self.searchInStreamline(self.streamlineTableRows(), MIN_MATCH, MIN_MATCH):
return True
else:
return self.searchInStreamline(self.streamlineTableCols(), MIN_MATCH, MIN_MATCH)
###############################################################################
## _
## _ __ ___ __ _(_)_ __
## | '_ ` _ \ / _` | | '_ \
## | | | | | | (_| | | | | |
## |_| |_| |_|\__,_|_|_| |_|
##
###############################################################################
#
if __name__ == '__main__':
#import unittest
#import test.test_tableboard as testTB
#runner = unittest.TextTestRunner(verbosity=2)
#runner.run(testTB.TableBoardTestSuite())
import doctest
doctest.testmod()