# -*- coding: utf-8 -*-
import numpy as np
def printP():
global n
global pieces
for i in range(n):
for j in range(n):
print "%d\t"%pieces[i][j],
print ""
def init():
'''
初始化棋盘
'''
global n
global pieces
global point #用于记录剩余的点
pieces = [([0]*100)for j in range(100)]
pieces = np.array(pieces)
point = []
for i in range(n):
for j in range(n):
point.append((i,j))
def checkXY(x,y):
'''
检查点(x,y)是否在棋盘上
'''
global n
if x>=0 and x<n and y>=0 and y<n:
return True
return False
def out1(x,y):
'''
找出所有方向(包括已经被走过的点)
'''
global n
global pieces
global direction
outLine1 = []
for i in range(8):
x1 = x+direction[i][0]
y1 = y+direction[i][1]
if checkXY(x1,y1):
outLine1.append((x1,y1))
return outLine1
def out(x,y):
'''
找出所有可能