This is just the scripts for the opponents I'm making for Galactic Racer, but feel free to use them in your own games!
This actually follows the same concepts as Ray casting, except instead of using the values to draw out something, it takes the earliest value where the stage is at least 50 pixels away, and moves in that direction. This results in not always taking the same path, and can be applied to any level! (as long as the turns aren't too sharp and the path isn't too narrow)