From 0d07fcc471b788a38641c5094921989852a8230a Mon Sep 17 00:00:00 2001 From: Johan Vandegriff Date: Mon, 11 Oct 2021 15:38:22 -0400 Subject: [PATCH] added "Dr. Hornswiggle's Trancendental Ideations Generator" --- games.py | 16 +++ hornswiggle.py | 216 +++++++++++++++++++++++++++++++++++++ nav.py | 3 +- requirements.txt | 3 +- static/boggle.css | 40 ------- static/style.css | 39 +++++++ templates/hornswiggle.html | 26 +++++ templates/index.html | 1 + 8 files changed, 302 insertions(+), 42 deletions(-) create mode 100644 hornswiggle.py create mode 100644 templates/hornswiggle.html diff --git a/games.py b/games.py index 69d526b..e5d8d8a 100644 --- a/games.py +++ b/games.py @@ -6,6 +6,7 @@ from flask import Flask, request, render_template, url_for import os, re, sys import CARL, boggle, boggle_old +import hornswiggle from nav import nav import profanity_test @@ -150,6 +151,21 @@ def carl_page(): ) #END CARL +#START HORNSWIGGLE +@app.route("/hornswiggle_api", methods=["GET", "POST"]) +def hornswiggle_api(): + return hornswiggle.generate() + +@app.route("/hornswiggle", methods=["GET", "POST"]) +def hornswiggle_page(): + return render_template( + "hornswiggle.html", + nav=nav, + active="Dr. H", + item=hornswiggle.generate() + ) +#END HORNSWIGGLE + if __name__ == "__main__": # app.run() app.run(host= '0.0.0.0') # for local testing diff --git a/hornswiggle.py b/hornswiggle.py new file mode 100644 index 0000000..6ba6472 --- /dev/null +++ b/hornswiggle.py @@ -0,0 +1,216 @@ +#!/usr/bin/python +import random + +""" +Dr. Hornswiggle's Trancendental Ideation Generator + +person's X +person's X with X +person's X without X +person's X and X +X = noun +X = adj noun +X = adv adj noun +X = adv adj (and) adj noun +X = adv adj (and) adj descriptor +X = adv adj (and) adj noun descriptor +""" + +raw = { + "possessives":""" +Dr. Hornswiggle's +Dr. Hornswoggle's +Prof. Boomquaggle's +Sir Birdzobble's +Madam Drumdrooble's +Mr. Lensfoggle's +Mrs. Cangrooble's +Ms. Rocktobble's +Mx. Ferntibble's +""", + "adverbs":""" +Aesthetically +Dimensionally +Intergalactically +Organically +Entirely +Absolutely +Magnificently +Aesthetically +Superficially +Seldom +Periodically +Pragmatically +Fully +Very +Extremely +Extraordinarily +""", + "prefixes":""" +Anti- +Non- +Pre- +Post- +Semi- +Super- +""", + "adjectives":""" +Fantabulous +Quintessential +Hypothetical +Pre-Owned +Alchemical +Null-Terminated +Skull-Shaped +Automagical +Forgettable +Non-Fungible +Inflammible +Inedible +5-Wheeled +Vacuum-Packed +Benign +Terrible +Supernatural +Quizzical +Cantankerous +Spontaneous +Maritime +Extraordinary +Royal +Alphabetical +Dapper +Dubious +Devious +Non-Binary +Grayscale +Momentous +Trancendental +Additional +Namby-Pamby +Solemn +""", + "nouns":""" +Calvacade +Cavalcade +Wibblewobble +Album +Albatross +Bean +Artifact +Pantaloon +Composure +Zeitgeist +Object of Interest +Meal Concept +Tincture +Acid +Abomination +Submarine +Telegraph +Vessel +Potion +Butter +Consciousness +Bounty Hunter +Swag +Cumquat +Ringtone +Ideation +Superposition +Machination +Cacophony +Brouhaha +Flibbertigibbet +Malarkey +Codswallop +Rigmarole +Shenanigan +Technobabble +Pandemonium +Tardigrade +Phantasm +""", + "descriptors":""" +Box +Generator +Sweeper +Transmogrifier +Grafter +Defragmenter +Governor +Facility +Game +Sandwich +Simulator +Parade +Festival +Contraption +Prototype +""", + "conjunctions":""" +, and +, Containing +, Lacking One +, Sans One +, Fused with +, with Part of One +, with Optional +, with Bonus +""", + "rare postfix":""" +& Knuckles +, Featuring Dante from the Devil May Cry Series +""" +} + +lists = {} +for category in raw: + lists[category] = [item for item in raw[category].split("\n") if item != ""] + +def automagicalSuperposition(chance): + return random.random() > 1-chance/100 + +class TrancendentalIdeationGenerator(): + def __init__(self): + self.words = [] + def add(self, category): + self.words.append(random.choice(lists[category])) + def getStr(self): + return " ".join(self.words).replace("- ", "-").replace(" ,", ",") + + def addDimensionallyHypotheticalObjectOfInterest(self): + if automagicalSuperposition(95): + if automagicalSuperposition(40): + self.add("adverbs") + if automagicalSuperposition(25): + self.add("adjectives") + if automagicalSuperposition(80): + self.words.append("and") + if automagicalSuperposition(15): + self.add("prefixes") + self.add("adjectives") + if automagicalSuperposition(80): + self.add("nouns") + if automagicalSuperposition(20): + self.add("descriptors") + if automagicalSuperposition(25): + self.add("descriptors") + else: + self.add("descriptors") + if automagicalSuperposition(15): + self.add("conjunctions") + self.addDimensionallyHypotheticalObjectOfInterest() + + def generate(self): + self.add("possessives") + self.addDimensionallyHypotheticalObjectOfInterest() + if automagicalSuperposition(2): + self.add("rare postfix") + if automagicalSuperposition(5): + self.add("rare postfix") + +def generate(): + words = TrancendentalIdeationGenerator() + words.generate() + return words.getStr() diff --git a/nav.py b/nav.py index 0f4c9cb..b0c02d7 100644 --- a/nav.py +++ b/nav.py @@ -6,5 +6,6 @@ nav = [ ["maze", "/maze"], ["whack", "/whack.pl"], ["math", "/math"], - ["chem", "/chem"] + ["chem", "/chem"], + ["Dr. H", "/hornswiggle"] ] diff --git a/requirements.txt b/requirements.txt index 0f22539..bae7efd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,4 +17,5 @@ scipy==1.6.0 numpy~=1.19.2 #tensorflow==2.4.1 #https://git.sr.ht/~johanvandegriff/tensorflow-custom-build/blob/master/tensorflow-2.4.1-cp36-cp36m-linux_x86_64.whl -https://git.sr.ht/~johanvandegriff/tensorflow-custom-build/blob/master/tensorflow-2.4.1-cp38-cp38-linux_x86_64.whl +#https://git.sr.ht/~johanvandegriff/tensorflow-custom-build/blob/master/tensorflow-2.4.1-cp38-cp38-linux_x86_64.whl +tensorflow==2.6.0 \ No newline at end of file diff --git a/static/boggle.css b/static/boggle.css index d26629c..7e6eba4 100644 --- a/static/boggle.css +++ b/static/boggle.css @@ -73,46 +73,6 @@ p.scale { } -.greenButton, .purpleButton, .redButton, .blueButton, .grayButton { - font-size: 1em; - height: 2em; - /* background: #10ee10; */ - /* text-align: center; */ - /* margin: 0 auto; */ - border-radius: 0.3em; - border: 2px solid black; - /* display: inline-block; */ -} - -.bigButton { - font-size: 1.2em; - margin: 3px; -} - -input[type="submit"].greenButton{ - background: #10ee10; -} - -input[type="submit"].purpleButton { - background: #631fa3; - color: white; -} - -input[type="submit"].redButton { - background: #f00; - color: white; -} - -input[type="submit"].blueButton { - background: #9af; - /* color: white; */ -} - -input[type="submit"].grayButton { - background: #ccc; -} - - .underlineText { font-size: 0.8em; margin: 1em auto; diff --git a/static/style.css b/static/style.css index 90b360b..b635cd3 100644 --- a/static/style.css +++ b/static/style.css @@ -195,6 +195,45 @@ footer { font-family: 'Monospace', sans-serif; } +.greenButton, .purpleButton, .redButton, .blueButton, .grayButton { + font-size: 1em; + height: 2em; + /* background: #10ee10; */ + /* text-align: center; */ + /* margin: 0 auto; */ + border-radius: 0.3em; + border: 2px solid black; + /* display: inline-block; */ +} + +.bigButton { + font-size: 1.2em; + margin: 3px; +} + +input[type="submit"].greenButton{ + background: #10ee10; +} + +input[type="submit"].purpleButton { + background: #631fa3; + color: white; +} + +input[type="submit"].redButton { + background: #f00; + color: white; +} + +input[type="submit"].blueButton { + background: #9af; + /* color: white; */ +} + +input[type="submit"].grayButton { + background: #ccc; +} + #navToggle { position: absolute; left: 0; diff --git a/templates/hornswiggle.html b/templates/hornswiggle.html new file mode 100644 index 0000000..add8c75 --- /dev/null +++ b/templates/hornswiggle.html @@ -0,0 +1,26 @@ +{% include 'header.html' %} + + + +

Dr. Hornswiggle's Trancendental Ideations Generator

+ + + + +{% include 'footer.html' %} diff --git a/templates/index.html b/templates/index.html index e2ca733..ece108d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8,6 +8,7 @@
  • Whack-A-Mole - another perl game
  • Math - a math worksheet (also perl)
  • Stoichiometry - a chemical equation solver (written in Java)
  • +
  • Dr. Hornswiggle's Trancendental Ideations Generator - hmmm... You'd better just see for yourself.

  • -- 2.34.2