소스 검색

单边墙的摆法

duh 7 년 전
부모
커밋
d7124bb183
1개의 변경된 파일23개의 추가작업 그리고 2개의 파일을 삭제
  1. 23 2
      phxb/utils/matchWall.py

+ 23 - 2
phxb/utils/matchWall.py

@@ -24,14 +24,34 @@ def matchWalls(roomLengths, moduleLengths):
         for item in a:
             matchWall(roomLengths,moduleLengths,a[item])
 
+# 获取单边墙的模块摆放顺序
+def changeModuleIndex(wallModules, param):
+    newIndexModules = []
+    print("before changeModuleIndex:",wallModules)
+    for index in range(len(param)):
+        newIndexModules.append(wallModules[param[index]-1])
+    print("after changeModuleIndex:",newIndexModules)
 
+# 摆放带顺序的单边墙
+def matchSingleWallWithIndex(wallLength, wallModules):
+    for item in wallModules:
+        pass
+
+# 摆放单边墙
 def matchSingleWall(wallLength, wallModules,wallIndex):
     print("wallLength",wallLength)
     print("wallModules",wallModules)
     print("wallIndex",wallIndex)
-    pass
+    if(canMatch(wallLength,wallModules)):
+        a = getarray.jiechenarray(len(wallModules))
+        for item in a:
+            changeModuleIndex(wallModules,a[item])
+            matchSingleWallWithIndex(wallLength, wallModules)
+    else:
+        print("this array not match")
 
 
+# 摆放所有墙
 def matchWall(roomLengths, moduleLengths, positions):
     m = len(roomLengths)
     n = len(moduleLengths)
@@ -52,4 +72,5 @@ def matchWall(roomLengths, moduleLengths, positions):
 #一字摆法
 def matchTopWall(roomLengths,moduleLengths):
     matchSingleWall(roomLengths, moduleLengths, "012")
-matchWalls([1,2,3,4],[1,1,1])
+matchWalls([1,2,3,4],[1,2,1])
+# changeModuleIndex([100,200,313],[2,1,3])