Update hw2.js

Added an end to the game