it will make some mistakes sometimes (e.g. out of bounds, skipping a wall to get to goal) but its not that serious space to spawn a clone of the player and m to turn off the sound wait for a new round for TILE SIZE to apply.
tutorial by @griffpatch