| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
import time |
|---|
| 4 |
import os |
|---|
| 5 |
import sys |
|---|
| 6 |
import cPickle |
|---|
| 7 |
from copy import copy, deepcopy |
|---|
| 8 |
from string import split, find, join, strip, replace, digits, maketrans, translate, lower, upper |
|---|
| 9 |
import glob |
|---|
| 10 |
import re |
|---|
| 11 |
from array import * |
|---|
| 12 |
import webbrowser |
|---|
| 13 |
|
|---|
| 14 |
from abstractBoard import * |
|---|
| 15 |
from board import * |
|---|
| 16 |
from searchPY import * |
|---|
| 17 |
from aglPY import * |
|---|
| 18 |
from algosPY import * |
|---|
| 19 |
try: |
|---|
| 20 |
from pattern import * |
|---|
| 21 |
except: |
|---|
| 22 |
print "Using patternPY" |
|---|
| 23 |
from patternPY import * |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
agl = abstractGameList() |
|---|
| 39 |
agl.addDB('./testdata', ('./testdata', ''), stdout_message()) |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
p = Pattern(0, 13, 0, 14, |
|---|
| 46 |
5, 4, |
|---|
| 47 |
'..XO.'+ |
|---|
| 48 |
'..OX.'+ |
|---|
| 49 |
'.....'+ |
|---|
| 50 |
'.....', |
|---|
| 51 |
'', 0, 'X') |
|---|
| 52 |
|
|---|
| 53 |
p.printPattern() |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
noMatches, Bwins, Wwins, noSwitched, continuations = \ |
|---|
| 58 |
agl.search(p, {}, 0, {}, ['A', 'B', 'C', 'D', 'E', 'F', 'G']) |
|---|
| 59 |
|
|---|
| 60 |
print |
|---|
| 61 |
print 'Search results' |
|---|
| 62 |
print 'Number of matches: ', noMatches |
|---|
| 63 |
print 'Black wins: ', Bwins |
|---|
| 64 |
print 'White wins: ', Wwins |
|---|
| 65 |
print 'Number of color reversals: ', noSwitched |
|---|
| 66 |
print 'Continuations:' |
|---|
| 67 |
for k in continuations.keys(): print k, ': ', continuations[k] |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|