From 9e034c38b15f4e0c27ac1c2d685f8826603508b6 Mon Sep 17 00:00:00 2001 From: Benjamin Bay Date: Fri, 20 Dec 2019 17:23:52 -0800 Subject: [PATCH 1/8] grammar additions --- story/grammars/fantasy_rules.json | 38 ++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/story/grammars/fantasy_rules.json b/story/grammars/fantasy_rules.json index c090484d..cfd33424 100644 --- a/story/grammars/fantasy_rules.json +++ b/story/grammars/fantasy_rules.json @@ -25,6 +25,9 @@ "artist" : ["artist", "artisan", "fresco painter", "glasspainter", "limner", "painter", "sculptor"], "writer" : ["composer", "illuminator", "limner", "playwright", "poet", "writer"], "profession" : ["#writer#", "#artist#", "#fisher#", "#hunter#", "#farmer#"], + "color" : ["black", "white", "red", "gray", "blue", "#uncommon_color#"], + "uncommon_color" : ["green", "brown", "green", "brown", "golden", "silver", "scarlet"], + "weapon" : ["staff", "sword", "spear", "flail", "mace", "dagger", "bow", "arrow", "lance"], @@ -42,7 +45,8 @@ "celestial" : ["the sun", "the moon", "the stars"], "domain" : ["#element#", "#more_element#", "#celestial#", "harvest", "fertility", "war", "good fortune", "thresholds", "love", "wisdom", "#profession.s#"], "god" : ["god", "deity", "goddess"], - "deity" : ["#god# of #domain#"], + "god_adj" : ["just", "cruel", "omniscient", "all-knowing", "mischevious", "wise", "reckless", "omnipotent", "#color#", "prudent", "jealous", "kind", "graceful", "magnificent", "traditional", "famous", "new", "old", "ancient", "wrathful", "fruitful", "gracious"], + "deity" : ["#god# of #domain#", "patron #god# of #domain#", "#god_adj# #god# #fantasy_name#"], "group" : ["group", "bunch", "delegation", "host"], "humanoid" : ["elf", "dwarf", "gnome", "halfling", "hobbit", "goblin"], "noble_class" : ["trader", "noble", "merchant", "soldier", "captain", "aristocrat", "duke", "count", "lord", "priest"], @@ -53,20 +57,23 @@ "grand_home_adj" : ["great", "grand", "large", "spacious"], "grand_home_adj_opt" : ["#grand_home_adj# ", ""], "noble_location" : ["with a #group# of #character.s#", "in a #grand_home_adj_opt##nice_home#"], - "festival" : ["#season# festival", "festival of the #deity#", "festival of the year of the #animal#"], + "festival" : ["#season# festival", "festival of the #deity#", "festival of the #animal#", "festival of the year of the #animal#"], "season_opt" : ["#season# ", ""], "noble_two" : "Throughout the #realm# it is the #festival#. To celebrate, you are feasting #noble_location#. #subordinate.s.capitalize# bustle #to_fro#.\n\nAs a #character# #toast#, you #action#", "week_month" : ["week", "fortnight", "month"], "week_months" : ["weeks", "fortnights", "months"], "time_periods" : ["#week_month#", "#two_to_ten# #week_months#"], - "speak" : ["speak", "chat", "talk", "converse", "discuss"], + "chat" : ["speak", "chat", "talk", "converse"], "ask" : ["ask", "request", "demand"], "noble_organization" : ["organization", "delegation", "guild", "league", "faction"], - "matter" : ["about a matter of importance to the #realm#", "on behalf of a foreign #noble_organization# of #humanoid.s#", "with information regarding a rival house", "with demands from your #subordinate.s#"], - "noble_three" : "Every day for the past #week_month#, a certain #character# has come to your #grand_home_adj_opt##nice_home# #ask#ing to #speak# with you, apparently #matter#. Unsure if #he_she# is trustworthy, you finally agree to meet.\n\nAt the meeting, you #action#" , + "matter" : ["about a matter of importance to the #realm#", "on behalf of a foreign #noble_organization# of #humanoid.s#", "with information regarding a rival house", "with demands from some #professioe.s#"], + "trustworthy" : ["trustworthy", "reliable", "dependable", "well-intentioned", "worth your time"], + "noble_three" : "Every day for the past #week_month#, a certain #character# has come to your #grand_home_adj_opt##nice_home# #ask#ing to #chat# with you, apparently #matter#. Unsure if #he_she# is #trustworthy#, you finally agree to meet.\n\nAt the meeting, you #action#" , - "noble_prompt": ["#noble_one#", "#noble_two#", "#noble_three#"], + "noble_four" : "You and your bodyguards are #on_the_way# #towards# #village_full# to celebrate the #festival# with your subjects. You #road_encounter#.\n\nYou #action#", + + "noble_prompt": ["#noble_one#", "#noble_two#", "#noble_three#", "#noble_four##"], "noble_context1" : "You are , a noble #from_fantasy#. You have a #noble_item1# and a #noble_item2#.", "noble_context" : ["#[noble_item1:#noble_item#][noble_item2:#noble_item#]noble_context1#"], @@ -95,8 +102,8 @@ "place" : ["valley", "forest", "plain", "mountain", "swamp", "river", "cave", "cavern", "lake", "expanse", "cliff"], "monster_quest" : ["#kill# the #evil_adj# #monster# of Larion. #you_ve.capitalize# heard #he_she_it# lives to the #cardinal_dir# of #the_your# #realm#"], - "artifact_adj" : ["lost", "holy", "gold", "fabled", "mythic", "legendary", "blessed", "cursed", "forgotten"], - "artifact" : ["grail", "fleece", "gauntlet", "banner", "stone", "sword", "helmet", "ring", "book", "chalice", "tome", "gem", "bow"], + "artifact_adj" : ["lost", "holy", "gold", "fabled", "mythic", "legendary", "blessed", "cursed", "forgotten", "#color#"], + "artifact" : ["grail", "fleece", "gauntlet", "banner", "stone", "sword", "helmet", "ring", "book", "chalice", "tome", "gem", "bow", "scepter", "staff"], "whole_artifact" : "#artifact_adj# #artifact# of #fantasy_name#", "find" : ["find", "discover", "recover"], "rumored" : ["is rumored to", "is said to", "was prophesied to"], @@ -173,8 +180,9 @@ "go_near" : ["#stare# at", "#sneak# towards", "approach"], "private" : ["private", "restricted", "forbidden", "confidential", "secure", "secret", "personal"], "chamber" : ["chamber", "study", "office", "antechamber", "room", "basement", "attic"], + "great_wizard" : ["#great# #magical_role# #fantasy_name#", "#fantasy_name# the #color#"], "order" : ["order", "command", "remind", "direct", "demand"], - "wizard_three" : "You are apprentice to the #great# #magical_role# #fantasy_name#. Before leaving on an errand, they #order.ed# you to never enter their #private# #chamber#... but your curiosity has gotten the best of you.\n\nAs you #go_near# the door, you #action#", + "wizard_three" : "You are apprentice to the #great_wizard#. Before leaving on an errand, they #order.ed# you to never enter their #private# #chamber#... but your curiosity has gotten the best of you.\n\nAs you #go_near# the door, you #action#", "wizard_prompt" : ["#wizard_one#", "#wizard_two#", "#wizard_three#"], "wizard_context" : "You are , a wizard #from_fantasy#. You have a #wizard_item# and a #wizard_item#.", @@ -188,9 +196,9 @@ "working" : ["working", "toiling", "laboring", "sweating"], "morning_time" : ["at the break of dawn", "at daybreak", "early", "early in the morning"], "field_verb" : ["plowing", "tilling", "cultivating", "caring for"], - "peasant_work" : ["feeding the #farm_animal_type#", "#field_verb# the fields", "harvesting the crops", "planting new crops", "#working# in the fields", "shearing the #woolen#", "milking the #milky#"], + "peasant_work" : ["feeding the #farm_animal_type#", "#field_verb# the fields", "harvesting the crops", "planting new crops", "#working# in the fields", "shearing the #woolen#", "milking the #milky#", "shoveling dung"], "begin" : ["begin", "go about", "start", "get to", "get about"], - "second_thing" : ["For a while, you have wanted to run away.", "In the distance, your master is yelling at some other workers.", "The sun beats down upon you.", "This has been your daily routine since you were young."], + "second_thing" : ["For a while, you have wanted to run away.", "In the distance, your master is yelling at some other workers.", "The sun beats down upon you.", "This has been your daily routine since you were young.", "You mutter a prayer to the #deity#."], "peasant_prompt" : "You wake up #morning_time# and #begin# #peasant_work#. #second_thing# You #action#", "peasant_context" : "You are , a peasant #from_fantasy#. You have #peasant_item# and #peasant_item#.", @@ -202,7 +210,7 @@ "city" : ["city", "town", "village", "market"], "steal" : ["steal from", "shoplift", "burgle", "break into"], "rob" : ["steal from", "rob", "jump", "pickpocket", "con"], - "target" : ["someplace to #steal#", "someone to #rob#"], + "target" : ["someplace to #steal#", "someone to #rob#", "a #profession# to #rob#"], "along" : ["along", "down"], "townsfolk" : ["townsfolk", "local vendors", "people", "crowd", "populace"], "amongst" : ["amongst", "in the midst of", "among"], @@ -217,7 +225,11 @@ "stealing" : ["stealing", "mischief", "pickpocketing"], "inn_adj" : ["your favorite", "a nearby", "a crowded", "a busy", "a cheap"], "rogue_two" : "After a #day# of #stealing#, you head towards #inn_adj# inn to stay for the night. #position.capitalize# you #action#", - "rogue_three" : "Today you decided that simple #stealing# isn't enough anymore. You long for a more ambitious goal: taking for yourself #whole_artifact#. You #action#", + "isnt" : ["isn't", "is not"], + "enough" : ["enough", "sufficient", "good enough"], + "not_enough" : ["#isnt# #enough#", "#isnt# #enough# anymore"], + "simple" : ["simple", "basic", "general", "standard"], + "rogue_three" : "This #time# you decided that #simple# #stealing# #not_enough#. You long for a more ambitious goal: taking for yourself #whole_artifact#.\n\nYou #action#", "rogue_prompt" : ["#rogue_one#","#rogue_two#", "#rogue_three#"], "rogue_context" : "You are , a rogue #from_fantasy#. You have #rogue_item# and #rogue_item#." } From afb9414d8d3b66bafa56349e193efc5f2ea4c8a1 Mon Sep 17 00:00:00 2001 From: Benjamin Bay Date: Fri, 20 Dec 2019 17:50:39 -0800 Subject: [PATCH 2/8] grammar additions --- story/grammars/fantasy_rules.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/story/grammars/fantasy_rules.json b/story/grammars/fantasy_rules.json index cfd33424..bdee7876 100644 --- a/story/grammars/fantasy_rules.json +++ b/story/grammars/fantasy_rules.json @@ -28,6 +28,7 @@ "color" : ["black", "white", "red", "gray", "blue", "#uncommon_color#"], "uncommon_color" : ["green", "brown", "green", "brown", "golden", "silver", "scarlet"], "weapon" : ["staff", "sword", "spear", "flail", "mace", "dagger", "bow", "arrow", "lance"], + "relative" : ["father", "mother", "brother", "sister", "cousin", "uncle", "aunt"], @@ -180,7 +181,7 @@ "go_near" : ["#stare# at", "#sneak# towards", "approach"], "private" : ["private", "restricted", "forbidden", "confidential", "secure", "secret", "personal"], "chamber" : ["chamber", "study", "office", "antechamber", "room", "basement", "attic"], - "great_wizard" : ["#great# #magical_role# #fantasy_name#", "#fantasy_name# the #color#"], + "great_wizard" : ["#great# #magical_role# #fantasy_name#", "#fantasy_name# the #color.capitalize#"], "order" : ["order", "command", "remind", "direct", "demand"], "wizard_three" : "You are apprentice to the #great_wizard#. Before leaving on an errand, they #order.ed# you to never enter their #private# #chamber#... but your curiosity has gotten the best of you.\n\nAs you #go_near# the door, you #action#", "wizard_prompt" : ["#wizard_one#", "#wizard_two#", "#wizard_three#"], @@ -194,7 +195,7 @@ "woolen" : ["sheep", "goats", "llamas"], "milky" : ["cows", "goats"], "working" : ["working", "toiling", "laboring", "sweating"], - "morning_time" : ["at the break of dawn", "at daybreak", "early", "early in the morning"], + "morning_time" : ["at the break of dawn", "at daybreak", "early", "early in the morning", "at the cock's crow"], "field_verb" : ["plowing", "tilling", "cultivating", "caring for"], "peasant_work" : ["feeding the #farm_animal_type#", "#field_verb# the fields", "harvesting the crops", "planting new crops", "#working# in the fields", "shearing the #woolen#", "milking the #milky#", "shoveling dung"], "begin" : ["begin", "go about", "start", "get to", "get about"], @@ -210,7 +211,7 @@ "city" : ["city", "town", "village", "market"], "steal" : ["steal from", "shoplift", "burgle", "break into"], "rob" : ["steal from", "rob", "jump", "pickpocket", "con"], - "target" : ["someplace to #steal#", "someone to #rob#", "a #profession# to #rob#"], + "target" : ["someplace to #steal#", "someone to #rob#", "some #profession# to #rob#"], "along" : ["along", "down"], "townsfolk" : ["townsfolk", "local vendors", "people", "crowd", "populace"], "amongst" : ["amongst", "in the midst of", "among"], From 18e9301a5979416a57d4019c82a449d335bee0a5 Mon Sep 17 00:00:00 2001 From: Chris Mazzullo Date: Fri, 20 Dec 2019 21:36:38 -0500 Subject: [PATCH 3/8] Removed all f-strings, replacing them with `format` calls The file install.sh specifies a minimum python version of 3.4.0. However, there are several f-strings in the code, which require a python version of 3.6.0. This commit removes those, which allows users to play the game using python 3.4 or 3.5. --- play.py | 7 ++++--- story/grammars/__init__.py | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/play.py b/play.py index 5d6fcdd2..41883165 100755 --- a/play.py +++ b/play.py @@ -267,14 +267,15 @@ def play_aidungeon_2(): console_print("Censor is now enabled.") else: - console_print(f"Invalid argument: {args[0]}") + console_print("Invalid argument: {}".format(args[0])) elif command == "save": if upload_story: id = story_manager.story.save_to_storage() console_print("Game saved.") console_print( - f"To load the game, type 'load' and enter the following ID: {id}" + "To load the game, type 'load' and enter the " + "following ID: {}".format(id) ) else: console_print("Saving has been turned off. Cannot save.") @@ -307,7 +308,7 @@ def play_aidungeon_2(): continue else: - console_print(f"Unknown command: {command}") + console_print("Unknown command: {}".format(command)) else: if action == "": diff --git a/story/grammars/__init__.py b/story/grammars/__init__.py index 187fba9d..7a71317b 100644 --- a/story/grammars/__init__.py +++ b/story/grammars/__init__.py @@ -8,13 +8,13 @@ def apply_grammar(key, rules): grammar = tracery.Grammar(rules) grammar.add_modifiers(base_english) - return grammar.flatten(f"#{key}#") + return grammar.flatten("#{}#".format(key)) def load_rules(setting): with open( os.path.join( - os.path.dirname(os.path.abspath(__file__)), f"{setting}_rules.json" + os.path.dirname(os.path.abspath(__file__)), "{}_rules.json".format(setting) ), "r", ) as f: @@ -27,7 +27,7 @@ def generate(setting, character_type, key): Provides a randomized prompt according to the grammar rules in _rules.json """ rules = load_rules(setting) - artefact = apply_grammar(f"{character_type}_{key}", rules) + artefact = apply_grammar("{}_{}".format(character_type, key), rules) return artefact From b3fc7abd2796f595ec5195ca329d3bc7a3be1a7b Mon Sep 17 00:00:00 2001 From: Chris Mazzullo Date: Fri, 20 Dec 2019 21:45:47 -0500 Subject: [PATCH 4/8] Removed trailing comma in function arguments This prevented the game from running with python3.5. --- generator/gpt2/src/sample.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator/gpt2/src/sample.py b/generator/gpt2/src/sample.py index d5d4983b..0ad3c87d 100644 --- a/generator/gpt2/src/sample.py +++ b/generator/gpt2/src/sample.py @@ -62,7 +62,7 @@ def sample_sequence( context=None, temperature=1, top_k=0, - top_p=1, + top_p=1 ): if start_token is None: assert context is not None, "Specify exactly one of start_token and context!" From 8ca4aea6e80065f721cbe33d024ffd4791f9605d Mon Sep 17 00:00:00 2001 From: Chris Mazzullo Date: Fri, 20 Dec 2019 21:51:00 -0500 Subject: [PATCH 5/8] Updated CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd97e290..2a85db20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [[Unreleased]](https://github.com/AIDungeon/AIDungeon/compare/master...develop) +- Removed f-strings for python 3.4 and 3.5 compatibility +- Removed trailing comma in function args for 3.5 compatibility + ### Added - `/reset` is a new command with the same functionality as the From c5280f9827aa857bc8bc03ded964043f2e36b99c Mon Sep 17 00:00:00 2001 From: Benjamin Bay Date: Sat, 21 Dec 2019 14:08:10 -0700 Subject: [PATCH 6/8] added tracery indefinite article support --- story/grammars/fantasy_rules.json | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/story/grammars/fantasy_rules.json b/story/grammars/fantasy_rules.json index bdee7876..54600f2c 100644 --- a/story/grammars/fantasy_rules.json +++ b/story/grammars/fantasy_rules.json @@ -57,10 +57,10 @@ "toast" : ["offers a toast", "gives a speech", "recites a prayer", "announces future plans", "loudly argues", "sings a ballad"], "grand_home_adj" : ["great", "grand", "large", "spacious"], "grand_home_adj_opt" : ["#grand_home_adj# ", ""], - "noble_location" : ["with a #group# of #character.s#", "in a #grand_home_adj_opt##nice_home#"], + "noble_location" : ["with #group.a# of #character.s#", "in a #grand_home_adj_opt##nice_home#"], "festival" : ["#season# festival", "festival of the #deity#", "festival of the #animal#", "festival of the year of the #animal#"], "season_opt" : ["#season# ", ""], - "noble_two" : "Throughout the #realm# it is the #festival#. To celebrate, you are feasting #noble_location#. #subordinate.s.capitalize# bustle #to_fro#.\n\nAs a #character# #toast#, you #action#", + "noble_two" : "Throughout the #realm# it is the #festival#. To celebrate, you are feasting #noble_location#. #subordinate.s.capitalize# bustle #to_fro#.\n\nAs #character.a# #toast#, you #action#", "week_month" : ["week", "fortnight", "month"], "week_months" : ["weeks", "fortnights", "months"], @@ -76,8 +76,7 @@ "noble_prompt": ["#noble_one#", "#noble_two#", "#noble_three#", "#noble_four##"], - "noble_context1" : "You are , a noble #from_fantasy#. You have a #noble_item1# and a #noble_item2#.", - "noble_context" : ["#[noble_item1:#noble_item#][noble_item2:#noble_item#]noble_context1#"], + "noble_context" : "You are , a noble #from_fantasy#. You have #noble_item.a# and #noble_item.a#.", @@ -125,11 +124,11 @@ "quest_type" : ["#monster_quest#", "#artifact_quest#", "#rescue_quest#"], "could" : ["will", "may", "should", "could"], - "adventure" : ["an adventure", "a quest", "a journey", "a crusade"], + "adventure" : ["adventure", "quest", "journey", "crusade"], "beginning" : ["going on", "beginning", "setting out on"], - "quest" : ["You are #beginning# #adventure# to #quest_type#. You set out #towards# a #place_adj# #place# that #could# take you there.\n\nAs you approach, you #action#"], + "quest" : ["You are #beginning# #adventure.a# to #quest_type#. You set out #towards# #place_adj.a# #place# that #could# take you there.\n\nAs you approach, you #action#"], "knight_prompt" : "#quest#", - "knight_context" : "You are , a knight #from_fantasy#. You have a #knight_item# and a #knight_item#.", + "knight_context" : "You are , a knight #from_fantasy#. You have #knight_item.a# and #knight_item.a#.", @@ -159,7 +158,7 @@ "book" : ["#normal_book#", "#spellbook#", "book", "spellbook"], "magic_discipline" : ["alchemy"], "through" : ["through", "across", "throughout", "about"], - "wizard_drafts" : ["After a #week_month# of travel you arrive at the ruin ", "Your apprentice has done it again; #he_she# has summoned a being "], + "wizard_drafts" : ["After #week_month.a# of travel you arrive at the ruin ", "Your apprentice has done it again; #he_she# has summoned a being "], "road" : ["road", "river", "path"], "wizard_exchange" : ["notes", "spells", "gossip", "goods", "research", "banter", "knowledge"], "wizard_colleage" : ["another wizard", "a fellow wizard", "a sorcerer", "a #evil_role#", "a #attrib# #char#"], @@ -169,12 +168,12 @@ "wandering_opt" : ["#wandering# ", ""], "troupe" : ["group", "band", "troupe", "crew", "gang", "party"], "dancer" : ["dancer", "actor", "entertainer"], - "road_encounter" : ["#encounter# #looks_like_opt#a #creature#", "#encounter# a #wandering_opt#troupe of #profession.s#"], + "road_encounter" : ["#encounter# #looks_like_opt##creature.a#", "#encounter# a #wandering_opt#troupe of #profession.s#"], "wizard_one" : ["You are #on_the_way# #towards# #village_full# to exchange #wizard_exchange# with #wizard_colleage#. You #road_encounter#.\n\nYou #action#"], "old" : ["old", "aged", "experienced", "elderly", "venerable"], "around_opt" : [" about", " around", ""], "wizard_pos" : ["wise", "intelligent", "crafty", "powerful", "magical"], - "wizard_two" : ["You face a #place_adj# #place# as images of #random_object.s# #flicker# #through# your #mind#. What was that? Though #old# and #wizard_pos#, your memory extends only a few #week_months# back. Now you #wander##around_opt#, trying to #remember# what happened.\n\nYou #action#"], + "wizard_two" : ["You face #place_adj.a# #place# as images of #random_object.s# #flicker# #through# your #mind#. What was that? Though #old# and #wizard_pos#, your memory extends only a few #week_months# back. Now you #wander##around_opt#, trying to #remember# what happened.\n\nYou #action#"], "great" : ["great", "renowned", "world-famous", "legendary"], "stare" : ["look", "stare", "gaze"], "sneak" : ["sneak", "creep", "inch", "move", "go"], @@ -185,10 +184,10 @@ "order" : ["order", "command", "remind", "direct", "demand"], "wizard_three" : "You are apprentice to the #great_wizard#. Before leaving on an errand, they #order.ed# you to never enter their #private# #chamber#... but your curiosity has gotten the best of you.\n\nAs you #go_near# the door, you #action#", "wizard_prompt" : ["#wizard_one#", "#wizard_two#", "#wizard_three#"], - "wizard_context" : "You are , a wizard #from_fantasy#. You have a #wizard_item# and a #wizard_item#.", + "wizard_context" : "You are , a wizard #from_fantasy#. You have #wizard_item.a# and #wizard_item.a#.", - "peasant_item" : ["a #metal_adj_opt#pitchfork", "the shirt on your back", "a #metal_adj_opt#shovel", "a dirty rag", "a #metal_adj_opt#spade", "a #metal_adj_opt#sickle", "shears", "a basket", "a plough", "a #metal_adj_opt#scythe", "a dirty hat"], + "peasant_item" : ["#metal_adj_opt#pitchfork", "shirt on your back", "#metal_adj_opt#shovel", "dirty rag", "#metal_adj_opt#spade", "#metal_adj_opt#sickle", "shears", "basket", "plough", "#metal_adj_opt#scythe", "dirty hat"], "farm_animal" : ["pig", "cow", "chicken", "llama", "goat", "horse", "donkey", "rabbit", "hog", "mule", "sow"], "farm_animal_sing" : ["sheep", "livestock", "cattle"], "farm_animal_type" : ["#farm_animal.s#", "#farm_animal_sing#"], @@ -201,11 +200,11 @@ "begin" : ["begin", "go about", "start", "get to", "get about"], "second_thing" : ["For a while, you have wanted to run away.", "In the distance, your master is yelling at some other workers.", "The sun beats down upon you.", "This has been your daily routine since you were young.", "You mutter a prayer to the #deity#."], "peasant_prompt" : "You wake up #morning_time# and #begin# #peasant_work#. #second_thing# You #action#", - "peasant_context" : "You are , a peasant #from_fantasy#. You have #peasant_item# and #peasant_item#.", + "peasant_context" : "You are , a peasant #from_fantasy#. You have #peasant_item.a# and #peasant_item.a#.", - "rogue_item" : ["a pair of gloves", "a cloak", "a deck of cards", "a dagger", "lockpick", "a mask", "a shawl", "a pipe", "a key", "a length of rope", "darts", "a sickle", "a mace"], + "rogue_item" : ["pair of gloves", "cloak", "deck of cards", "dagger", "lockpick", "mask", "shawl", "pipe", "key", "length of rope", "bundle of darts", "sickle", "mace"], "walk" : ["walk","go"], "street" : ["street", "streets", "square", "road"], "city" : ["city", "town", "village", "market"], @@ -232,6 +231,6 @@ "simple" : ["simple", "basic", "general", "standard"], "rogue_three" : "This #time# you decided that #simple# #stealing# #not_enough#. You long for a more ambitious goal: taking for yourself #whole_artifact#.\n\nYou #action#", "rogue_prompt" : ["#rogue_one#","#rogue_two#", "#rogue_three#"], - "rogue_context" : "You are , a rogue #from_fantasy#. You have #rogue_item# and #rogue_item#." + "rogue_context" : "You are , a rogue #from_fantasy#. You have #rogue_item.a# and #rogue_item.a#." } From de610047bc64070e10940bdc3764ed5fb45d3cb6 Mon Sep 17 00:00:00 2001 From: Benjamin Bay <48391872+ben-bay@users.noreply.github.com> Date: Sat, 21 Dec 2019 20:09:44 -0700 Subject: [PATCH 7/8] Delete cacher.py --- other/cacher.py | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 other/cacher.py diff --git a/other/cacher.py b/other/cacher.py deleted file mode 100644 index 3f17a7bb..00000000 --- a/other/cacher.py +++ /dev/null @@ -1,44 +0,0 @@ -import os - -from google.cloud import storage - - -class Cacher: - def __init__(self, credentials_file, bucket_name="dungeon-cache"): - # Model/Cache Info - os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = credentials_file - self.storage_client = storage.Client() - self.bucket = self.storage_client.get_bucket(bucket_name) - pass - - def cache_file(self, seed, choices, response, tag, print_result=False): - prompt_num = 0 - blob_file_name = "prompt" + str(prompt_num) + "/seed" + str(seed) + "/" + tag - for action in choices: - blob_file_name = blob_file_name + str(action) - blob = self.bucket.blob(blob_file_name) - - blob.upload_from_string(response) - - if print_result: - print("File ", blob_file_name, " cached") - - def retrieve_from_cache(self, seed, choices, tag, print_result=False): - prompt_num = 0 - blob_file_name = "prompt" + str(prompt_num) + "/seed" + str(seed) + "/" + tag - - for action in choices: - blob_file_name = blob_file_name + str(action) - - blob = self.bucket.blob(blob_file_name) - - if blob.exists(self.storage_client): - result = blob.download_as_string().decode("utf-8") - if print_result: - print(blob_file_name, " found in cache") - else: - result = None - if print_result: - print(blob_file_name, " not found in cache") - - return result From 61b417f97026b3faed2b8e1f438c615623afefbd Mon Sep 17 00:00:00 2001 From: Benjamin Bay <48391872+ben-bay@users.noreply.github.com> Date: Mon, 23 Dec 2019 10:44:49 -0700 Subject: [PATCH 8/8] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a85db20..a972f7c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 old `/restart`, saving the old and beginning a brand new game. - Ratings after death and winning - `get_rating` function to `Story` objects. -- Some new word to fantasy grammar. +- New content in fantasy grammar. - Formal grammars for peasant and rogue contexts/prompts. ### Fixed