赞
踩
- # -*- 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]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。