mirror of
https://github.com/Xevion/fusion-fission-choices.git
synced 2025-12-07 11:15:13 -06:00
showScore configuration
This commit is contained in:
12
README.md
12
README.md
@@ -28,7 +28,7 @@ The `elements` portion refers to the scores of each element, each being the atom
|
||||
|
||||
---
|
||||
|
||||
`reverseIndividualOrder` refers to whether or not the program should reverse the output of the lists so that individual list printouts should have elements with higher scores
|
||||
`reverseIndividualOrder` refers to whether or not the program should reverse the output of the lists so that individual list printouts should have elements with higher scores.
|
||||
|
||||
---
|
||||
|
||||
@@ -37,14 +37,20 @@ The `elements` portion refers to the scores of each element, each being the atom
|
||||
---
|
||||
|
||||
|
||||
`noNegatives` refers to whether it should filter out elements that have a negative score (ie. while using default configs, filter out elements without a score set)
|
||||
`noNegatives` refers to whether it should filter out elements that have a negative score (ie. while using default configs, filter out elements without a score set).
|
||||
|
||||
A set of elements with the score (-1, 5) would get filtered out, while a set with the scores (78, 12) would not.
|
||||
|
||||
---
|
||||
|
||||
`fullPrint` refers to whether it should print out the Symbol or the Name of the Element
|
||||
`fullPrint` refers to whether it should print out the Symbol or the Name of the Element.
|
||||
|
||||
---
|
||||
|
||||
`eliminateEmpty` refers to whether the program should remove specified elements if they contained no matching tuples.
|
||||
|
||||
---
|
||||
|
||||
`showScore` refers to whether or not the program shows the score calculated alongside each element.
|
||||
|
||||
`showScoreZFill` refers to whether or not to apply applicable ZFill arguments to the score display.
|
||||
@@ -92,7 +92,7 @@
|
||||
"90": -1,
|
||||
"91": -1,
|
||||
"92": -1,
|
||||
"93": -1,
|
||||
"93": 9999,
|
||||
"94": -1,
|
||||
"95": -1,
|
||||
"96": -1,
|
||||
@@ -124,5 +124,7 @@
|
||||
"reverseOrder" : false,
|
||||
"noNegatives" : true,
|
||||
"fullPrint" : true,
|
||||
"eliminateEmpty" : false
|
||||
"eliminateEmpty" : false,
|
||||
"showScore" : true,
|
||||
"showScoreZFill" : true
|
||||
}
|
||||
11
fusion.py
11
fusion.py
@@ -12,10 +12,19 @@ score = lambda element : config['elements'][str(element)]
|
||||
scoreSum = lambda item : ((score(item[0]) + score(item[1])), item)
|
||||
hasNegatives = lambda item : score(item[0]) < 0 or score(item[1]) < 0
|
||||
|
||||
def getScoreFormat(item):
|
||||
score = str(scoreSum(item)[0])
|
||||
if config['showScoreZFill']:
|
||||
largest = len(str(max(config['elements'].values())))
|
||||
score = score.zfill(largest)
|
||||
return '{{{}}} '.format(score)
|
||||
|
||||
# Formatting for a single element report line
|
||||
def formatting(e1, e2):
|
||||
e1, e2 = mdv.element(e1), mdv.element(e2)
|
||||
return '\t[{} {}] + [{} {}]'.format(e1.symbol if not config['fullPrint'] else e1.name,
|
||||
return '\t{}[{} {}] + [{} {}]'.format(
|
||||
getScoreFormat((e1.atomic_number, e2.atomic_number)) if config['showScore'] else '',
|
||||
e1.symbol if not config['fullPrint'] else e1.name,
|
||||
e1.atomic_number,
|
||||
e2.symbol if not config['fullPrint'] else e2.name,
|
||||
e2.atomic_number)
|
||||
|
||||
Reference in New Issue
Block a user