|
@@ -1,11 +1,35 @@
|
|
|
+import utils.conf
|
|
|
+import utils.getarray
|
|
|
# 判断能否摆下组件的贴墙边
|
|
|
-def canMathc(wallLength,moduleLengths):
|
|
|
+from utils import getarray
|
|
|
+
|
|
|
+# 判断当前边能否放下指定模块
|
|
|
+def canMatch(wallLength, moduleLengths):
|
|
|
moduleTotalLength = 0;
|
|
|
for item in moduleLengths:
|
|
|
moduleTotalLength = moduleTotalLength + item
|
|
|
- if(moduleTotalLength <= wallLength):
|
|
|
- return 1
|
|
|
+ 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:
|
|
|
- return 0
|
|
|
-matchResult = canMathc(3,(1,1,2))
|
|
|
-print(matchResult)
|
|
|
+ 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])
|