"Playable Quotes for Game Boy Games" - https://www.youtube.com/watch?v=z9JYOZWLMlo
142 karma · joined August 21, 2018
"Playable Quotes for Game Boy Games" - https://www.youtube.com/watch?v=z9JYOZWLMlo
Python version: https://github.com/python/cpython/blob/master/Lib/bisect.py
C version: https://github.com/python/cpython/blob/master/Modules/_bisec...
Thanks for catching the mistake, @dmurray. I'll fix that.
* * *
My inspiration for writing this came from watching 3Blue1Brown's YouTube video, "Simulating an epidemic":
https://www.youtube.com/watch?v=gxAaO2rsdIs
His simulations cover several scenarios:
- Simulating social distancing.
- Having people travel to a central location (e.g. a grocery store).
- What if the government is able to identify and isolate cases?
- Simulating multiple communities with travel, that put quarantine measures in place.
- What happens when people get tired of social distancing.
* * *
Thanks for sharing your code.
I see that you are using gnuplot to visualize the output of the script. Have you considered using the csv module (https://docs.python.org/3/library/csv.html) to output the data, instead of using the print() function? That way, you wouldn't have to manually add in spaces around the data and stringify the numeric data.
>>> import csv, sys
>>> writer = csv.writer(sys.stdout, delimiter=" ")
>>> writer.writerow(["#", "T", "S", "I", "R"])
# T S I R
In the script, usage would look something like this: import csv
import sys
...
writer = csv.writer(sys.stdout, delimiter=" ")
writer.writerow(["#", "T", "S", "I", "R"])
writer.writerow([T, S, I, R])
while I > 1000:
...
writer.writerow([T, S, I, R])