function applyMove now applies moves to a given board