Maintaining the Undo/Redo stack for replay functionality.

101 views
Skip to first unread message

Michael Pascuzzi

unread,
Mar 29, 2021, 12:57:33 PM3/29/21
to Blockly
Hi all!

I'm apart of a research group for the University of Florida and I'm apart of a research group researching how kids learn coding. One of the things that we're trying to implement is a replay functionality for students who go through the coding challenge using a Blockly workspace. So the software is as follows:
  1. Student works through Blockly workspace and implements challenge
  2. They have undo and redo capabilities throughout
  3. We have saving capabilities that capture the XML for progress over time.
We can load a save from their prior XML, but the undo and redo stacks aren't preserved on XML load. If I had those I could do a timeout to walkthrough step by step what the students tried for the challenge to see their thought process.

I tried stringifying and saving the stack to try to reinitialize it in the window.Blockly object directly but that doesn't work. Anyone try to do something similar? My next plan of attack is to just save each xml and use it to reconstruct the coding process the student did, but that seems messy. I appreciate any help!

Michael

Coda Highland

unread,
Mar 29, 2021, 3:37:00 PM3/29/21
to blo...@googlegroups.com
I dunno, I think that saving each XML might be the right plan. Trying to track it with the undo stack won't show you when there was an undo or redo. It would also make it easier to seek through the history to find the part you're looking for, because you'll always have the current state of the workspace at any point in time instead of having to replay from the beginning to reconstruct it.

/s/ Adam

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/d2efdabb-3bc0-4e51-a8dd-f51061cc1c30n%40googlegroups.com.

ewpa...@gmail.com

unread,
Mar 29, 2021, 3:46:44 PM3/29/21
to Blockly
In App Inventor, we used the change listener functionality of the workspace to record individual events for the purposes of supporting realtime collaboration. On the server, we can stream the events to a log with receive timestamps that can be used for replay purposes. That might be a workable approach depending on exactly what you're trying to do.

Cheers,
Evan

Michael Pascuzzi

unread,
Mar 29, 2021, 4:05:18 PM3/29/21
to Blockly
Evan,

We have been fleshing out what logs might look like. Do you have anything open source that I could look at to get a gist of what you're doing?

Michael

Beka Westberg

unread,
Mar 29, 2021, 9:15:04 PM3/29/21
to blo...@googlegroups.com
Hello Michael,

I think the relevant code for the auto-saving is around here. But be warned, App Inventor is a little out of the ordinary in that a lot of their code is actually written in Java. So I don't know how helpful it will be :/

Best of luck with your project!
--Beka

Reply all
Reply to author
Forward
0 new messages