Changeset 216
- Timestamp:
- 02/03/07 14:28:45 (1 year ago)
- Files:
-
- 06/libkombilo/search.cpp (modified) (6 diffs)
- 06/libkombilo/testsearch.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
06/libkombilo/search.cpp
r215 r216 204 204 } else if (type == CORNER_NE_PATTERN) { 205 205 top = bottom = 0; 206 left = right = boardsize - 1 -sizeX;206 left = right = boardsize - sizeX; 207 207 } else if (type == CORNER_SE_PATTERN) { 208 top = bottom = boardsize - 1 -sizeY;209 left = right = boardsize - 1 -sizeX;208 top = bottom = boardsize - sizeY; 209 left = right = boardsize - sizeX; 210 210 } else if (type == CORNER_SW_PATTERN) { 211 top = bottom = boardsize - 1 -sizeY;211 top = bottom = boardsize - sizeY; 212 212 left = right = 0; 213 213 } else if (type == SIDE_N_PATTERN) { … … 216 216 right = boardsize -1 - sizeX; 217 217 } else if (type == SIDE_E_PATTERN) { 218 left = right = boardsize - 1 -sizeX;218 left = right = boardsize - sizeX; 219 219 top = 1; 220 220 bottom = boardsize -1 - sizeY; … … 224 224 bottom = boardsize -1 - sizeY; 225 225 } else if (type == SIDE_S_PATTERN) { 226 top = bottom = boardsize - 1 -sizeY;226 top = bottom = boardsize - sizeY; 227 227 left = 1; 228 228 right = boardsize -1 - sizeX; … … 253 253 } else if (type == CORNER_NE_PATTERN) { 254 254 top = bottom = 0; 255 left = right = boardsize - 1 -sizeX;255 left = right = boardsize - sizeX; 256 256 } else if (type == CORNER_SE_PATTERN) { 257 top = bottom = boardsize - 1 -sizeY;258 left = right = boardsize - 1 -sizeX;257 top = bottom = boardsize - sizeY; 258 left = right = boardsize - sizeX; 259 259 } else if (type == CORNER_SW_PATTERN) { 260 top = bottom = boardsize - 1 -sizeY;260 top = bottom = boardsize - sizeY; 261 261 left = right = 0; 262 262 } else if (type == SIDE_N_PATTERN) { … … 265 265 right = boardsize -1 - sizeX; 266 266 } else if (type == SIDE_E_PATTERN) { 267 left = right = boardsize - 1 -sizeX;267 left = right = boardsize - sizeX; 268 268 top = 1; 269 269 bottom = boardsize -1 - sizeY; … … 273 273 bottom = boardsize -1 - sizeY; 274 274 } else if (type == SIDE_S_PATTERN) { 275 top = bottom = boardsize - 1 -sizeY;275 top = bottom = boardsize - sizeY; 276 276 left = 1; 277 277 right = boardsize -1 - sizeX; 06/libkombilo/testsearch.py
r215 r216 11 11 print gl.size(), 'games in the database' 12 12 print 'Opening the db took %.2f seconds.' % (end - start) 13 gl.gisearch("pw = 'Cho Chikun'")14 print gl.size(), 'games in the database'13 # gl.gisearch("pw = 'Cho Chikun'") 14 # print gl.size(), 'games in the database' 15 15 16 p = Pattern(CENTER_PATTERN, 19, 3, 3, '.X.XXXXOX') 16 p = Pattern(CORNER_SW_PATTERN, 19, 7, 7, '........................X........................') 17 # p = Pattern(CENTER_PATTERN, 19, 3, 3, '.X.XXXXOX') 17 18 # p = Pattern(CENTER_PATTERN, 19, 3, 5, '.X.' + '.OX' + '.OX' + '.OX' + 'OXO') 18 19 # p = Pattern(CENTER_PATTERN, 19, 5, 4, '..XOO'+ '...XX'+ '.....'+ '..X..') 19 20 so = SearchOptions() 20 21 # so.fixedColor = True 21 so.nextMove = 222 # so.nextMove = 2 22 23 start = time.time() 23 24 gl.search(p, so) … … 47 48 print 'This search took %.2f seconds.' % (end - start) 48 49 49 p = Pattern(CENTER_PATTERN, 19, 2, 2, 'XO' + 'OX')50 start = time.time()51 gl.search(p)52 end = time.time()50 # p = Pattern(CENTER_PATTERN, 19, 2, 2, 'XO' + 'OX') 51 # start = time.time() 52 # gl.search(p) 53 # end = time.time() 53 54 # print '\n'.join(gl.currentEntriesAsStrings()) 54 print gl.size(), 'games, ', gl.numHits(), 'hits.'55 print 'This search took %.2f seconds.' % (end - start)55 # print gl.size(), 'games, ', gl.numHits(), 'hits.' 56 # print 'This search took %.2f seconds.' % (end - start) 56 57 57 print gl.currentEntryAsString(gl.size()-1)58 print gl.getCurrentProperty(gl.size()-1, 'PW'), gl.getSGF(gl.size()-1)58 # print gl.currentEntryAsString(gl.size()-1) 59 # print gl.getCurrentProperty(gl.size()-1, 'PW'), gl.getSGF(gl.size()-1) 59 60 60 gl.reset()61 gl.tagsearch(HANDI_TAG)62 print gl.size(), 'handicap games'61 # gl.reset() 62 # gl.tagsearch(HANDI_TAG) 63 # print gl.size(), 'handicap games' 63 64 64 print gl.plSize(), 'players in the whole database.'65 for i in range(100,110):66 print 'Player %d: %s' % (i, gl.plEntry(i))65 # print gl.plSize(), 'players in the whole database.' 66 # for i in range(100,110): 67 # print 'Player %d: %s' % (i, gl.plEntry(i)) 67 68 68 for sig in ['cfcgjbbeckjc', 'aaaaaaaaaaaa', 'dfcnfmepgkjo', 'dfcn________', 'dfcn%']:69 # SQL-wildcards are allowed: _ for a single character, % for an arbitrary number of characters70 gl.reset()71 gl.sigsearch(sig)72 print gl.size(), 'games with signature', sig73 gl.reset()74 print gl.currentEntryAsString(200)75 print 'signature of game 200: ', gl.getSignature(200)69 # for sig in ['cfcgjbbeckjc', 'aaaaaaaaaaaa', 'dfcnfmepgkjo', 'dfcn________', 'dfcn%']: 70 # # SQL-wildcards are allowed: _ for a single character, % for an arbitrary number of characters 71 # gl.reset() 72 # gl.sigsearch(sig) 73 # print gl.size(), 'games with signature', sig 74 # gl.reset() 75 # print gl.currentEntryAsString(200) 76 # print 'signature of game 200: ', gl.getSignature(200) 76 77 77 78
