|
@@ -23,6 +23,8 @@ import sys
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -44,6 +46,8 @@ OVERFLOW_PENALTY = 2000
|
|
|
|
|
|
ORPHAN_PENALTY = 10000
|
|
|
|
|
|
+OPENPAREN_PENALTY = 200
|
|
|
+
|
|
|
def generate_wrapping(words, divisions):
|
|
|
lines = []
|
|
|
last = 0
|
|
@@ -65,6 +69,9 @@ def wrapping_quality(words, divisions, width1, width2):
|
|
|
else:
|
|
|
width = width2
|
|
|
|
|
|
+ if line[0:1] == '(':
|
|
|
+ total += OPENPAREN_PENALTY
|
|
|
+
|
|
|
if length > width:
|
|
|
total += OVERFLOW_PENALTY * (
|
|
|
(length - width) ** OVERFLOW_EXPONENT )
|