fix trailing spaces in generated score (#266)

This commit is contained in:
tonyspumoni
2022-10-29 16:51:36 -06:00
committed by GitHub
parent 064238629c
commit cb0e975836
3 changed files with 11 additions and 10 deletions
+6 -5
View File
@@ -75,7 +75,7 @@ class ScoreDisplay:
def makeLine(self, char, length, title=None):
if title == None:
return ' ' + (char * length) + ' \n'
return ' ' + (char * length) + '\n'
else:
lineSideLength = (length - len(title) - 2) // 2
leftLength = lineSideLength
@@ -84,11 +84,12 @@ class ScoreDisplay:
rightLength += 1
if leftLength + rightLength <= 0:
if leftLength + rightLength == 0:
return ' ' + title + ' \n'
return ' ' + title + '\n'
else:
return ' ' + title + ' \n'
return ' ' + title + '\n'
else:
return ' ' + (char * leftLength) + ' ' + title + ' ' + (char * rightLength) + ' \n'
return ' ' + (char * leftLength) + ' ' + title + \
(' ' + char * rightLength if char != ' ' else '') + '\n'
def getGameStatusDisplay(self, status, dashLen):
out = ''
@@ -156,4 +157,4 @@ if __name__ == "__main__":
adventureSelect = int(args.adventure)
scoreDisplay = ScoreDisplay()
print(scoreDisplay.getDisplay(float(args.adventureOnePercentage), float(args.adventureTwoPercentage), adventureSelect))