In a first step, the idea would be to make the Tk Canvas stateless, i.e. without any implicit, hidden state.
The Tk render function should take a big dict with all necessary attributes that are needed to describe a particular state and should then automatically redraw all elements from that dict that have changed (and keep elements that have not changed).
This is already almost what we are doing but things like the overlay arrows and pacman rotation are currently not properly encoded in the UI state. In addition, the checks that are applied for when to redraw items are not standardised.
In a second step, we could then store all UI state dicts for a game and have history.
In a first step, the idea would be to make the Tk Canvas stateless, i.e. without any implicit, hidden state.
The Tk render function should take a big dict with all necessary attributes that are needed to describe a particular state and should then automatically redraw all elements from that dict that have changed (and keep elements that have not changed).
This is already almost what we are doing but things like the overlay arrows and pacman rotation are currently not properly encoded in the UI state. In addition, the checks that are applied for when to redraw items are not standardised.
In a second step, we could then store all UI state dicts for a game and have history.