combined functionality of initial v1 and script-norvig.py