1234567891011121314151617181920212223242526272829303132333435 |
- import utils.conf
- import utils.getarray
- # 判断能否摆下组件的贴墙边
- from utils import getarray
- # 判断当前边能否放下指定模块
- def canMatch(wallLength, moduleLengths):
- moduleTotalLength = 0;
- for item in moduleLengths:
- moduleTotalLength = moduleTotalLength + item
- return (moduleTotalLength <= wallLength)
- # matchResult = canMatch(3,(1,1,2))
- # print(matchResult)
- # 获取当前位置的所有摆法
- def matchWalls(roomLengths, moduleLengths):
- m = len(roomLengths)
- n = len(moduleLengths)
- a=getarray.getAllArray(m,n)
- canMatchTop = canMatch(roomLengths[2], moduleLengths)
- if(canMatchTop):
- print("begin to calc top")
- matchWall(roomLengths,moduleLengths,"222")
- else:
- for item in a:
- matchWall(roomLengths,moduleLengths,a[item])
- def matchWall(roomLengths, moduleLengths, positions):
- m = len(roomLengths)
- n = len(moduleLengths)
- a = getarray.getitemIndexArray(positions,m,n)
- pass
- #一字摆法
- def matchTopWall(roomLengths,moduleLengths):
- matchWalls(roomLengths, moduleLengths, "222")
- matchWalls([1,2,3,4],[1,1,1])
|