Package: examplepackageTeam12p3
Python Package Exercise - Team 12DocumentationThis package is a guessing game, where a user can use functions to find hints and guess for an animal or object.A user can import their own guessing object and make a game for others.An example implementation can be foundherein the src folder. This example makes use of the package methods in addition to some additional code to implement an example game.You can run the example usingpython src/example_game.pyafter installing the package.You can also import your own animal object by adding a file path to a JSON as an argument e.gpython src/example_game.py ./example.json.First install the package into your environment:pip3 install -i https://test.pypi.org/simple/examplepackageTeam12p3then put in the header:from examplepackageTeam12p3 import guess_gameand begin using the functions in your program.For the examples in functions this alias will be used:from examplepackageTeam12p3 import guess_game as gameFunctionsimport_file(fpath)Takes as input a json file as string that contains details about interactions and rules so that a user can create their own game.Usegame.import_file(your_file)to import your_file as the animal classinteract(action:str, animal:Animal)Accepts an action as a string and an Animal object. Prints the result of performing the action and lowers the turn count as defined in the Animal object.You can usegame.interact(your_guess, game.Animal())to make guesses using the default animal objectletter_match(letter, animal:Animal)Takes a letter and animal object as input and returns an array of indices indexed starting at 1 of where the input letter can be found in the input animal.Usegame.letter_match(your_letter, game.Animal())to guess letters using the default animal objecthandle_letter_match(animal:Animal, guesses:list)Takes an animal object and a list which stores letter guesses already made as input and prompts the user for a letter guess input with input validation. Callsletter_match(input, animal)to check if input letter is in supplied animal's name, reduce turn count, and receive array of letter match indices to print. The guessed letter is appended to the guesses list when done. ReturnsTruewhen correct input provided orFalsewhen incorrect input provided.Usegame.handle_letter_match(game.Animal(), [])to make a guess with input validation. This method is intended to be used in a loopguess(guess_name, animal:Animal)Accepts a guess string and an animal object to check the guess value against. ReturnsTrueif the names match orFalseif they do not.Usegame.guess(your_guess, game.Animal())to guess the name of the default animal objecthandle_guess(animal:Animal)Function that takes user input, strips input of white space, and converts input to lowercase before passing input toguess(input, animal). Returns what is returned fromguess().Usegame.handle_guess(game.Animal())to make a guess of the name of the default animal object using an input promptstringify(keys)This function takes an iterable and produces an output string that includes each item in the iterable converted to string and prepended with a newline and tab.Usegame.stringify(your_iterable)to convert your iterable to a formatted stringSetupSetup the virtual environmentInstall pipenv withpython3 -m pip install --user pipenvCreate the virtual environment and install this packagepip install -i https://test.pypi.org/simple/examplepackageTeam12p3Activate the environment withpipenv shellExit the virtual environment withexitBuild the package withpython -m buildTest with pytestInstall pytest into your vitural environment withpipenv install pytestRunpython3 -m pytestfrom the main directoryTeam MembersYvonne Wu (Yiyi Wu) :https://github.com/Yvonne511Leah Durrett :https://github.com/howtofly-labAlexander Chen :https://github.com/TheAlexanderChenJohn Kolibachuk :https://github.com/jkolibPyPI:https://test.pypi.org/project/examplepackageTeam12p3/