Exercise 2 · Chapter: One Moving DotRequired+50 XP
Faster
Speed is not a special feature. It is the size of the step.
Change update so the dot moves 3 columns per frame instead of 1. Leave
draw alone.
This test doesn't check the picture — it checks the numbers. Each frame prints
state["x"], so you should see 3 6 9 12 …. When something moves wrong, look
at the numbers first; they lie less than your eyes do.
Expected output
3 6 9 12 15
Need a hint?
3 available · costs 5 XP each
python
def update(state, keys):
state["x"] = state["x"] + 1
return state
def draw(state):
grid = blank_grid()
grid[6][state["x"]] = "red"
return grid