@@ -1,3 +1,4 @@
|
||||
# 16 quadrillion
|
||||
MAX_NUM = 16_000_000_000_000_000
|
||||
DEFAULT_COUNTING_SPEED = 57_000 // 2
|
||||
MAX_RUNNING_TIME_SECONDS = 5 * 60
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# (c) 2020 Simon Averbach and Zev Averbach
|
||||
from time import sleep
|
||||
|
||||
from config import MAX_NUM, DEFAULT_COUNTING_SPEED
|
||||
from config import MAX_NUM, DEFAULT_COUNTING_SPEED, MAX_RUNNING_TIME_SECONDS
|
||||
|
||||
|
||||
def math_game():
|
||||
@@ -24,6 +24,20 @@ def math_game():
|
||||
else:
|
||||
num_counts_per_second = int(num_counts_per_second_string)
|
||||
|
||||
predicted_running_time_seconds = int((number / each) / num_counts_per_second)
|
||||
while predicted_running_time_seconds > MAX_RUNNING_TIME_SECONDS:
|
||||
print(f"Sorry, that would run for {predicted_running_time_seconds:,} seconds, which is greater than "
|
||||
f"the maximum allowed of {MAX_RUNNING_TIME_SECONDS:,} seconds.")
|
||||
suggested_num_counts_per_second = int((number / each) / MAX_RUNNING_TIME_SECONDS)
|
||||
print(f"I suggest you run a minimum of {suggested_num_counts_per_second:,} counts per second.")
|
||||
print(f"How many counts do you want to do per second? [{suggested_num_counts_per_second:,}]")
|
||||
num_counts_per_second_string = input("> ")
|
||||
if num_counts_per_second_string == '':
|
||||
num_counts_per_second = suggested_num_counts_per_second
|
||||
else:
|
||||
num_counts_per_second = int(num_counts_per_second_string)
|
||||
predicted_running_time_seconds = (number / each) / num_counts_per_second
|
||||
|
||||
print(f"Okay, here we go! We're going to count from zero to {number}, "
|
||||
f"adding {each} {num_counts_per_second} times per second.")
|
||||
sleep(3)
|
||||
|
||||
Reference in New Issue
Block a user