completed playGame function - end of problem set for week 4