Cleaned up README structure.

This commit is contained in:
Phil Bajsicki 2024-04-20 09:28:03 +02:00
parent 2616e09ec6
commit 74f92c0f8f
2 changed files with 10 additions and 11 deletions

View file

@ -76,11 +76,15 @@ import pprint
from fastapi import FastAPI, Header
#+end_src
** Pretty Print
** Pretty print and usage printer
#+begin_src python
pp = pp.Printer = pprint.PrettyPrinter(indent=2, compact=True)
def print(stuff):
pp.pprint(stuff)
#+end_src
And a usage printe
And a usage printer:
#+begin_src python
def usagequit():
@ -93,6 +97,7 @@ def usagequit():
multi-table prints out the probability of winning for a range between 6 and k if you have the first throw.""")
quit()
#+end_src
** FastAPI
#+begin_src python
app = FastAPI()
@ -199,12 +204,6 @@ def multi_turn_table(k):
result[i] = multi_turn_single(i)
return result
#+end_src
** Print
#+begin_src python
def print(stuff):
pp.pprint(stuff)
#+end_src
** Script
To run as a script.

View file

@ -5,6 +5,9 @@ from fastapi import FastAPI, Header
pp = pp.Printer = pprint.PrettyPrinter(indent=2, compact=True)
def print(stuff):
pp.pprint(stuff)
def usagequit():
print("""Usage: python pydiceprob.py [k] [mode]
k between 6 and 99 (higher numbers are supported, up to however much your memory can handle; given that win probabilities approach 50%, this isn't very useful past about 100.)
@ -82,8 +85,5 @@ def multi_turn_table(k):
result[i] = multi_turn_single(i)
return result
def print(stuff):
pp.pprint(stuff)
if __name__ == "__main__":
main()