mirror of
https://github.com/RussellChamp/tilde-projects.git
synced 2026-10-28 00:22:34 +00:00
tildebot | Accept either order of prime factors
This commit is contained in:
1 parent
888b3e871a
commit
3d2af2a72d
1 file changed
+6
-1
+6
-1
@@ -44,7 +44,12 @@ def make_puzzle(obfuscate=True):
|
||||
elif roll == 5:
|
||||
p1 = random.choice(primes)
|
||||
p2 = random.choice(primes)
|
||||
answer = str(min(p1,p2)) + ',' + str(max(p1,p2))
|
||||
def answer(guess):
|
||||
# Check the the numbers entered are correct, regardless of order
|
||||
# or surrounding whitespace.
|
||||
attempt = sorted(word.strip() for word in guess.split(","))
|
||||
correct = sorted([str(p1), str(p2)])
|
||||
return attempt == correct
|
||||
bonus = 1
|
||||
puzzle += p.number_to_words(p1 * p2) + " when factored into its two primes (answer in the form of the two primes with a comma between)"
|
||||
elif roll == 6:
|
||||
|
||||
Reference in new issue
Block a user