File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,17 +36,21 @@ def main():
3636 rolls = [random .randint (1 , 6 ) for _ in range (num_dice )]
3737
3838 print (f"\n Rolling { num_dice } dice..." )
39- print ("~" * (num_dice * 11 ))
4039
4140 # Retrieve ASCII art for each rolled die
4241 dice_arts = [get_die_art (val ) for val in rolls ]
4342
43+ separator = " "
44+ die_width = len (dice_arts [0 ][0 ])
45+ divider = "~" * (num_dice * die_width + (num_dice - 1 ) * len (separator ))
46+ print (divider )
47+
4448 # Print dice side-by-side by iterating line by line (0 to 4)
4549 for line_index in range (5 ):
46- row_line = " " .join (dice_art [line_index ] for dice_art in dice_arts )
50+ row_line = separator .join (dice_art [line_index ] for dice_art in dice_arts )
4751 print (row_line )
4852
49- print ("~" * ( num_dice * 11 ) )
53+ print (divider )
5054
5155 # Output results and total sum
5256 print (f"Individual Rolls: { rolls } " )
You can’t perform that action at this time.
0 commit comments