Track merges in a set rather than in the grid
Use preconditions for bounds checking on grid operations

Check that the 'next' cell is within the grid before attempting to
perform a grid operation (set, get) on the cell.
Use keys destructuring
Pass position as a pair rather than as independent x and y parameters
Pass direction around rather than vector
Run example game from main