diff --git a/tdih.ans b/tdih.ans new file mode 100644 index 0000000..dcedd29 --- /dev/null +++ b/tdih.ans @@ -0,0 +1,7 @@ + + + +ßß°°°°ßß °°°° ßß°°°Ü ß°°°°ß °°°° °°°° +±±±± ±±±± ±±±± ±±±± ±±±± Üܱ±±± +²²²² ²²²² ²²²² ²²²² ²²²² ²²²² +ÛÛÛÛ HIS ÛÛÛÛÜÜÜÛÛÛß AY ÜÛÛÛÛÜ N ÛÛÛÛ ÛÛÛÛ ISTORY diff --git a/tdih.mpy b/tdih.mpy new file mode 100644 index 0000000..e4313da --- /dev/null +++ b/tdih.mpy @@ -0,0 +1,53 @@ +import mystic_bbs as bbs +import random +import json + +tdihJSON = '/mystic/tdih.json' + +############################ +# Custom function to pause # +############################ + +def pause(): + bbs.writeln("|PA") + +################################## +# Custom fuction to clear screen # +################################## + +def clear(): + bbs.write('|CL') + +############# +# Line Feed # +############# + +def linefeed(): + bbs.writeln('|CR') + +################### +# Show Title ANSI # +################### + +def showTitle(): + bbs.showfile("tdih.ans", 57600, 0, 0, 0) + +# Import the JSON File with today's history +with open("tdih.json", "r") as f: + tdih = json.load(f) + +# Count the events and generate 5 random numbers within that range +rEventNums = random.sample(range(0,len(tdih["data"]["Events"])-1), 5) + +clear() +showTitle() +linefeed() + +# Sort the random event numbers in numerical order and print each one. +for rEventNum in sorted(rEventNums): + event = tdih["data"]["Events"][rEventNum] + bbs.writeln('|15' + event["year"] + ' |08- |07' + event["text"]) + +linefeed() +pause() +