# GamesCrafters Fall 2008
# Puzzle Team
# @author: Roger Tu

from TriangularPegSolitaire import TriangularPegSolitaire
from UnreverseSolver import *
from Solver import *

print "Triangular Peg Solitaire Tester v0.2"

# make a default board
puz = TriangularPegSolitaire()
print puz
print "testing serialization & unserialization"
print "\tserialization of starting board"
print puz.serialize()
print "\tunserialization of a random board"
print TriangularPegSolitaire.unserialize(None, ".;.o;o.o;o.o.;o.ooo;")

# get some moves
foo = puz.generate_moves()
print foo

# make the first one
puz += foo[0]
print puz
# print [x.count(True) for x in puz.board]

# testing hash
print "testing hash"
print puz.__hash__()
示例#2
0
from Puzzle import Puzzle
from TriangularPegSolitaire import TriangularPegSolitaire
from UnreverseSolver import *
from Solver import *

print 'Solving size 2 start 0'
solv = UnreverseSolver()
tps = TriangularPegSolitaire()
tps = tps.generate_start(2, 0)
solv.solve(tps, True)
solv.save('tps_2_0.txt')

print 'Solving size 3 start 0'
solv = UnreverseSolver()
tps = TriangularPegSolitaire()
tps = tps.generate_start(3, 0)
solv.solve(tps, True)
solv.save('tps_3_0.txt')

print 'Solving size 4 start 0'
solv = UnreverseSolver()
tps = TriangularPegSolitaire()
tps = tps.generate_start(4, 0)
solv.solve(tps, True)
solv.save('tps_4_0.txt')

'''
print 'Solving size 5 start 0'
solv = UnreverseSolver()
tps = TriangularPegSolitaire()
tps = tps.generate_start(5, 0)
# GamesCrafters Fall 2008
# Puzzle Team
# @author: Roger Tu

from TriangularPegSolitaire import TriangularPegSolitaire
from UnreverseSolver import *
from Solver import *

print 'Triangular Peg Solitaire Tester v0.2'

# make a default board
puz = TriangularPegSolitaire()
print puz
print 'testing serialization & unserialization'
print '\tserialization of starting board'
print puz.serialize()
print '\tunserialization of a random board'
print TriangularPegSolitaire.unserialize(None, '.;.o;o.o;o.o.;o.ooo;')

# get some moves
foo = puz.generate_moves()
print foo

# make the first one
puz += foo[0]
print puz
#print [x.count(True) for x in puz.board]

# testing hash
print 'testing hash'
print puz.__hash__()