By Guest

ideas.skystuff.games

Python 1.22 KiB 55 3 months ago
from aiohttp import web from random import choice things = [ "a machine", "a generator", "a creature", "a game", "a place", "an object", "a robot", ] actions = [ "builds", "destroys", "crafts", "generates", "kills", "cooks", "melts", ] adjectives = [ "red", "blue", "green", "beautiful", "ugly", "amazing", "disturbing", "fantastic", "flying", "walking", "living", "dead", "angry", "happy", "giant", "microscopic", ] objects = [ "cats", "houses", "ideas", "people", "generators", "robots", "giraffes", "animals", "speakers", "machines", "cities", "countries", "boxes", "nukes", ] template = "Create {thing} that {action} {adjective} {object}" tmpl = template.format(thing=choice(things),action=choice(actions),adjective=choice(adjectives),object=choice(objects)) def basic(request): tmpl = template.format(thing=choice(things),action=choice(actions),adjective=choice(adjectives),object=choice(objects)) print("Got request, returning idea:",tmpl) return web.Response(text=tmpl) app = web.Application() app.add_routes([web.get("/",basic)]) print("ready") web.run_app(app,port=36001)