mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-24 20:10:15 -08:00
STY: Fix Flake8 issues
This commit is contained in:
@@ -27,22 +27,27 @@ k = 0
|
||||
phrase = 1
|
||||
line = ""
|
||||
|
||||
|
||||
def print_centered(msg):
|
||||
spaces = " " * ((PAGE_WIDTH - len(msg)) // 2)
|
||||
print (spaces + msg)
|
||||
print(spaces + msg)
|
||||
|
||||
|
||||
def process_phrase_1():
|
||||
global line
|
||||
|
||||
line_1_options = ["MIDNIGHT DREARY",
|
||||
"FIERY EYES",
|
||||
"BIRD OR FIEND",
|
||||
"THING OF EVIL",
|
||||
"PROPHET"]
|
||||
|
||||
line_1_options = [
|
||||
"MIDNIGHT DREARY",
|
||||
"FIERY EYES",
|
||||
"BIRD OR FIEND",
|
||||
"THING OF EVIL",
|
||||
"PROPHET",
|
||||
]
|
||||
|
||||
line = line + line_1_options[i]
|
||||
return line
|
||||
|
||||
|
||||
def process_phrase_2():
|
||||
global line
|
||||
global u
|
||||
@@ -52,12 +57,14 @@ def process_phrase_2():
|
||||
("THRILLED ME", None),
|
||||
("STILL SITTING....", None),
|
||||
("NEVER FLITTING", 2),
|
||||
("BURNED", None)]
|
||||
("BURNED", None),
|
||||
]
|
||||
words, u_modifier = line_2_options[i]
|
||||
line += words
|
||||
if not (u_modifier is None):
|
||||
u = u_modifier
|
||||
|
||||
|
||||
def process_phrase_3():
|
||||
global line
|
||||
|
||||
@@ -73,6 +80,7 @@ def process_phrase_3():
|
||||
if (not only_if_u) or (u > 0):
|
||||
line = line + words
|
||||
|
||||
|
||||
def process_phrase_4():
|
||||
global line
|
||||
|
||||
@@ -81,10 +89,12 @@ def process_phrase_4():
|
||||
("YET AGAIN"),
|
||||
("SLOWLY CREEPING"),
|
||||
("...EVERMORE"),
|
||||
("NEVERMORE")]
|
||||
("NEVERMORE"),
|
||||
]
|
||||
|
||||
line += phrases[i]
|
||||
|
||||
|
||||
def maybe_comma():
|
||||
# line 210
|
||||
global u
|
||||
@@ -112,7 +122,7 @@ def pick_phrase():
|
||||
global phrase
|
||||
global line
|
||||
global i, j, k
|
||||
|
||||
|
||||
i = random.randint(0, 4)
|
||||
j += 1
|
||||
k += 1
|
||||
@@ -121,7 +131,7 @@ def pick_phrase():
|
||||
# random indentation is fun!
|
||||
line += " " * 5
|
||||
phrase = j + 1
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
print_centered("POETRY")
|
||||
@@ -136,9 +146,9 @@ def main():
|
||||
1: process_phrase_1,
|
||||
2: process_phrase_2,
|
||||
3: process_phrase_3,
|
||||
4: process_phrase_4
|
||||
4: process_phrase_4,
|
||||
}
|
||||
|
||||
|
||||
while True:
|
||||
if phrase >= 1 and phrase <= 4:
|
||||
phrase_processors[phrase]()
|
||||
@@ -155,6 +165,7 @@ def main():
|
||||
phrase = 2
|
||||
continue
|
||||
pick_phrase()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user