Refactor game logic to board.js