implement recursice function
This commit is contained in:
parent
b5a390bce3
commit
ed8118ae08
36
fenetre.py
36
fenetre.py
@ -1,6 +1,6 @@
|
|||||||
# Charger les bibliothèques DesignScript et Standard Python
|
# Charger les bibliothèques DesignScript et Standard Python
|
||||||
import sys
|
import sys
|
||||||
import clr
|
# import clr
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# clr.AddReference('ProtoGeometry')
|
# clr.AddReference('ProtoGeometry')
|
||||||
@ -9,15 +9,18 @@ import re
|
|||||||
|
|
||||||
|
|
||||||
Keylist = [
|
Keylist = [
|
||||||
"RSV12",
|
"rsv12",
|
||||||
"RSV13",
|
"rsv13",
|
||||||
"RSV16",
|
"rsv16",
|
||||||
"RSV19",
|
"rsv19",
|
||||||
"RSV20,RSV21,RSV1",
|
"rsv20",
|
||||||
|
"rsv21",
|
||||||
|
"rsv1",
|
||||||
] # dataEnteringNode[0]
|
] # dataEnteringNode[0]
|
||||||
CollittionList = [
|
CollittionList = [
|
||||||
["rsv13"],
|
["rsv13"],
|
||||||
["rsv12", "rsv16"],
|
["rsv12", "rsv16"],
|
||||||
|
["rsv13"],
|
||||||
["rsv20","rsv21","rsv1"],
|
["rsv20","rsv21","rsv1"],
|
||||||
["rsv19", "rsv1"],
|
["rsv19", "rsv1"],
|
||||||
["rsv19"],
|
["rsv19"],
|
||||||
@ -26,3 +29,24 @@ CollittionList = [
|
|||||||
OUT = []
|
OUT = []
|
||||||
|
|
||||||
|
|
||||||
|
def find_in_out(rsv, out):
|
||||||
|
for arr in OUT:
|
||||||
|
if rsv in arr:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def recurCollition(index, OUTindex):
|
||||||
|
for i in CollittionList[index]:
|
||||||
|
if not find_in_out(i, OUT):
|
||||||
|
OUT[OUTindex].append(i)
|
||||||
|
recurCollition(Keylist.index(i), OUTindex)
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(len(Keylist)):
|
||||||
|
if find_in_out(Keylist[i], OUT):
|
||||||
|
continue
|
||||||
|
OUT.append([Keylist[i]])
|
||||||
|
recurCollition(i, len(OUT) - 1)
|
||||||
|
|
||||||
|
|
||||||
|
print(OUT)
|
||||||
|
Loading…
Reference in New Issue
Block a user