Easy data structure and algorithm practice puzzle.
Screen wrap turns the world into a loop: fly off the right edge and you come back on the left, as in Asteroids. Given a ship's position and the world's width and height, return [x, y] wrapped back into the world. That's the remainder after dividing by the size, but in many languages the remainder of a negative number is negative, so -1 would stay -1 instead of becoming width - 1. Add the size and take the remainder again to fix it.
Solve it three ways: snap the jigsaw pieces together, fill in the blanks, or type it from scratch against the tests. This one is free.
Every line of the solution comes with a note explaining why it is there, and a step by step replay shows the code running. At level 3, where you type it yourself, you can ask for an AI mock interview on this problem that ends with a hiring manager's scorecard.
Then grow it into a real project with the Software Engineer button: this puzzle becomes the Entity Smoothing Rig, a pipeline you can run and download. See every Software Engineer project.
Browse all 576 puzzles