Refactor js in adventure game and use validation form