From 751f351c93ae19742914c793cb6e0b4e4a76ca37 Mon Sep 17 00:00:00 2001 From: Benjamin G Carlisle Date: Fri, 5 Feb 2021 13:18:18 +0100 Subject: [PATCH] Fixed problem with logic --- shantybot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shantybot.py b/shantybot.py index 0cddba9..949df18 100644 --- a/shantybot.py +++ b/shantybot.py @@ -20,7 +20,7 @@ while len(shanty.strip().split("\n")) < 9: first_line_rhymes_n = 0 first_line_syllables = 0 - while first_line_rhymes_n < 4 and (first_line_syllables == 0 or first_line_syllables > 10): + while first_line_rhymes_n < 4 or first_line_syllables == 0 or first_line_syllables > 10: first_line = re.sub(r'[,;]$', '', mmodel.make_sentence(tries=10000)) @@ -39,7 +39,7 @@ while len(shanty.strip().split("\n")) < 9: second_line_rhymes_n = 0 second_line_syllables = 0 - while second_line_rhymes_n < 4 and (second_line_syllables == 0 or second_line_syllables > 10): + while second_line_rhymes_n < 4 or second_line_syllables == 0 or second_line_syllables > 10: second_line = re.sub(r'[,;]$', '', mmodel.make_sentence(tries=10000)) @@ -59,7 +59,7 @@ while len(shanty.strip().split("\n")) < 9: third_line_syllables = 0 third_line_tries = 0 - while (third_line_syllables != first_line_syllables or first_and_third_dont_rhyme) and third_line_tries < 1000: + while (third_line_syllables != first_line_syllables or first_and_third_dont_rhyme) and third_line_tries < 2000: third_line = re.sub(r'[,;]$', '', mmodel.make_sentence(tries=10000)) @@ -79,7 +79,7 @@ while len(shanty.strip().split("\n")) < 9: fourth_line_syllables = 0 fourth_line_tries = 0 - while (fourth_line_syllables != second_line_syllables or second_and_fourth_dont_rhyme) and fourth_line_tries < 1000: + while (fourth_line_syllables != second_line_syllables or second_and_fourth_dont_rhyme) and fourth_line_tries < 2000: fourth_line = re.sub(r'[,;]$', '', mmodel.make_sentence(tries=10000))