refactored guessing to create new instances of Code
added test to check that guesses are added to history