Open Entkenntnis opened 1 year ago
I thought about a "skip to end" button before, but that's not feasible to implement as you would need to detect infinite loops which is not possible. Alternatively, you'd need to timeout Angerer x steps/seconds.
On the other hand, a "fast forward" button or slider sounds like a great addition. That's probably the most straight forward solution for this issue.
I am still not sure how the schnell
and langsam
commands from the original Roboter Karol should really work - also I am not sure how they are working at the moment as I wrote that code a while ago. Should these operations only be active for the current block. Should they propagate down? Should leaving the block get to the previous state or reset to langsam
?
A slider would be very nice.
In my understanding, the schnell
command will skip output of all code until the next langsam
command. Currently, they are doing nothing.
In my understanding, the
schnell
command will skip output of all code until the nextlangsam
command.
Not 100% sure about that one. Looking at this official example: https://github.com/andipaetzold/robotkarol.dev/blob/d64719ad42afdd9e981dfa09e7a1714bcb80f1d9/public/examples/steinepflastern.kdp#L43-L51
After calling schnell
in condition, there is no langsam
. I, therefore, assume there is some kind of block-scoping that automatically slows things down again
Currently, they are doing nothing.
I currently parse schnell
and langsam
and also have some kind of block-scoping around that. The initial idea was to make all steps after schnell
instant. But that caused issues with infinite loops. Maybe I can rather make them a very fast speed and not an instant operation. That way the main thread won't get stuck in a loop.
you are right, the documentation is adressing this:
Das Wort schnell schaltet in den schnellen Modus, hierbei unterbleibt jegliche Verzögerung und die Veränderungen in der Karol-Welt werden zur Beschleunigung nicht am Bildschirm angezeigt. Das Wort langsam schaltet wieder in den normalen Modus mit Verzögerung und Bildschirmausgabe um. Innerhalb von selbstdefinierten Anweisungen/Bedingungen ist die Anweisung schnell nur gültig bis zum nächsten langsam bzw. bis zum Ende des selbstdefi- nierten Blocks.
Maybe you can use setTimeout()
after a certain amount of steps, so that the app stays reactive - but I see that it's difficult to detect a loop. Would be interesting to dig through the original robot karol code to find out what they are doing.
I never read the official docs while implementing. I guess this makes life easier. :laughing:
Ideally, this would not even run in the UI thread but a separate worker and you could kill it if it doesn't provide the next update after x seconds.
Some examples are quite long (especially "pascal") and it takes a ton of time to get the end result (> 10 min).
So I would kindly ask for some way of speeding, eihter as skipping to end button or e.g. a slider for the execution speed or a working implementation of
schnell
/langsam
Meanwhile I have to to some other work while waiting for the end result :)
Thanks for tackling this.