Game Enhancements

Based on the Enhancements Specification, implement the new features in the original codebase.

Before you start work, please accept the invitation of the github classroom below.

http://go.code.cool/pbwp-python-game

Follow the instructions in the readme. As your submission, please enter the URL of your Github repository.

Requirements

For this assignment keep in mind that we’ll grade your Python skills and we’re gonna watch out for the following problems. Try to avoid using these :)

Don’t use global variables.

  • BAD

    • my_list = [‘orange’, ‘cat’, ‘air filter’, ‘bob marley’] def update_list():     my_list.append(‘platon’) # my_list is a global variable defined outside the function

      update_list() print(my_list)

  • GOOD

    • def update_list(param_list):     param_list.append(‘platon’) # param_list is local to the function, not global

      my_list = [‘orange’, ‘cat’, ‘air filter’, ‘bob marley’] update_list(my_list) print(my_list)

Don’t use the global keyword.

  • BAD

    • def change_var(): global my_var my_var += 10 # without ‘global my_var’

      my_var = 5 change_var() print(my_var)

  • GOOD

    • def change_var(var): # parameterize functions to make them reusable var += 10 return var

      my_var = 5 my_var = change_var(my_var) print(my_var)

Generally speaking using global variables or anything that’s global makes the code unmaintainable in long term perspective. Functions using global cannot be reused. Can cause memory leak issues.

This exercise deepens your Python knowledge, your ability to create a stable, bugfree software, and your skill to write clean code.