Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Example stored info
- allEdges = [[['test', 50], [['pCube1', ['x'], 50], ['pCube2', ['y', 'y2'], 50]]], [['test2', 50], [['pCube1', ['x', 'y', 'y2'], 50]]], [['test3', 50], [['pCube1', ['x'], 50], ['pCube2', ['y'], 50], ['pCube3', ['x', 'x2', 'y', 'y2'], 50]]]]
- #calculate probability
- totalProbability = 0
- for i in range( len( allEdges ) ):
- totalProbability += float(allEdges[i][0][1])
- #display text
- if debugInfo == True:
- for i in range( len( allEdges ) ):
- edgeInfo = allEdges[i][0]
- objInfo = allEdges[i][1]
- outputText = "'" + str(edgeInfo[0]) + "' (" + str( round( edgeInfo[1]/totalProbability, 2 ) ) + "% probability, chance of " + str( edgeInfo[1] ) + ") is applied to '"
- for j in range( len( objInfo ) ):
- outputText += objInfo[j][0] + "' for side"
- objSides = objInfo[j][1]
- if len( objSides ) > 1:
- outputText += "s"
- for m in range( len( objSides ) ):
- outputText += " " + str( objSides[m] ).replace( "x2", "-x" ).replace( "y2", "-y" )
- if m == len( objSides )-2:
- outputText += " and"
- if m < len( objSides )-2:
- outputText += ","
- if j == len( objInfo )-2:
- outputText += " and '"
- if j < len( objInfo )-2:
- outputText += ", '"
- print outputText
- #output:
- #'test' (0.33% probability, chance of 50) is applied to 'pCube1' for side x and 'pCube2' for sides y and -y
- #'test2' (0.33% probability, chance of 50) is applied to 'pCube1' for sides x, y and -y
- #'test3' (0.33% probability, chance of 50) is applied to 'pCube1' for side x, 'pCube2' for side y and 'pCube3' for sides x, -x, y and -y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement