aroberge / reeborg

Enhanced Karel-the-robot clone
http://reeborg.ca/reeborg.html
Other
47 stars 36 forks source link

PERMALINK's don't update code when opened via URL #293

Closed dz0 closed 7 years ago

dz0 commented 8 years ago

Hi,

I updated my tasks to point to new reborg reeborg.html http://codeintro.popo.lt/2015/07/14/robotuko-klajones-praktinis-programavimo-ivadas/

but when I click links, they open new world with old code :/ example : http://reeborg.ca/reeborg.html?proglang=python-en&world=%7B%0A%20%20%22robots%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22x%22%3A%201%2C%0A%20%20%20%20%20%20%22y%22%3A%201%2C%0A%20%20%20%20%20%20%22_prev_x%22%3A%201%2C%0A%20%20%20%20%20%20%22_prev_y%22%3A%201%2C%0A%20%20%20%20%20%20%22_prev_orientation%22%3A%200%2C%0A%20%20%20%20%20%20%22start_positions%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%201%2C%0A%20%20%20%20%20%20%20%20%20%201%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%22objects%22%3A%20%7B%7D%2C%0A%20%20%20%20%20%20%22_orientation%22%3A%200%0A%20%20%20%20%7D%0A%20%20%5D%2C%0A%20%20%22walls%22%3A%20%7B%0A%20%20%20%20%2211%2C1%22%3A%20%5B%0A%20%20%20%20%20%20%22east%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%2211%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%2C%0A%20%20%20%20%20%20%22east%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%2210%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%229%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%228%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%227%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%226%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%225%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%224%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%223%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%222%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%221%2C9%22%3A%20%5B%0A%20%20%20%20%20%20%22north%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%2211%2C8%22%3A%20%5B%0A%20%20%20%20%20%20%22east%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%2211%2C7%22%3A%20%5B%0A%20%20%20%20%20%20%22east%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%2211%2C6%22%3A%20%5B%0A%20%20%20%20%20%20%22east%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%2211%2C5%22%3A%20%5B%0A%20%20%20%20%20%20%22east%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%2211%2C4%22%3A%20%5B%0A%20%20%20%20%20%20%22east%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%2211%2C3%22%3A%20%5B%0A%20%20%20%20%20%20%22east%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%2211%2C2%22%3A%20%5B%0A%20%20%20%20%20%20%22east%22%0A%20%20%20%20%5D%0A%20%20%7D%2C%0A%20%20%22goal%22%3A%20%7B%0A%20%20%20%20%22possible_positions%22%3A%20%5B%0A%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%206%2C%0A%20%20%20%20%20%20%20%206%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%5D%2C%0A%20%20%20%20%22position%22%3A%20%7B%0A%20%20%20%20%20%20%22x%22%3A%206%2C%0A%20%20%20%20%20%20%22y%22%3A%206%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22objects%22%3A%20%7B%0A%20%20%20%20%20%20%226%2C5%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22token%22%3A%201%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22objects%22%3A%20%7B%0A%20%20%20%20%226%2C1%22%3A%20%7B%0A%20%20%20%20%20%20%22token%22%3A%201%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22small_tiles%22%3A%20false%2C%0A%20%20%22rows%22%3A%2012%2C%0A%20%20%22cols%22%3A%2014%0A%7D&editor=%23%20jei%20ka%C5%BEkur%20stringate%2C%20vykdykite%20program%C4%85%20po%20%C5%BEingsn%C4%AF%20(%20%E2%96%BA%E2%96%8C)%0A%0A%22%22%22%20Komandos%3A%0Amove()%20%20%20%20%20%20%20%20-%20%20paeina%20langel%C4%AF%20%0Aturn_left()%20%20%20-%20pasisuka%20kair%C4%97n%20(de%C5%A1in%C4%97n%20nemoka)%0Atake()%20%20%20%20%20%20%20%20-%20paima%20objekt%C4%85%20i%C5%A1%20langelio%0Aput()%20%20%20%20%20%20%20%20%20-%20padeda%20objekt%C4%85%0A%22%22%22%0A%0A%23%20U%C5%BEduotis%3A%20%0A%23%20perne%C5%A1t%20%22kapeik%C4%85%22%20%C4%AF%20tu%C5%A1%C4%8Di%C4%85%20apskritim%C4%85%20%0A%23%20ir%20atsistoti%20%C4%AF%20fini%C5%A1o%20viet%C4%85%20(melsv%C4%85%20langel).%20%0A%0A%23%20pataisykite%2Fpabaikite%20program%C4%85%3A%0Amove()%0Aturn_left()%0Amove()&library=%23%20%27from%20my_lib%20import%20*%27%20in%20Python%20Code%20is%20required%20to%20use%0A%23%20the%20code%20in%20this%20library.%20%0A%0A

(but world.html seems to update stuff ok..)

aroberge commented 8 years ago

Sorry about this, it is a known issue ... I have not fully implemented the permalink in the new version. Until then, my best advice would be to, either use the old version OR perhaps to use World(http://your_site/some_world.jsonl) instead to load up from a file instead of from a permalink.

dz0 commented 8 years ago

But updating via PERMALINK dialog "Replace" button works, so maybe you can just call RUR.permalink.update(...) ?

dz0 commented 8 years ago

TYPO: I was in a hurry, and swapped pagenames in initial report. Correction: reeborg.html doesn't do the job (automatically), and world.html does it.

aroberge commented 8 years ago

Yes, that is correct and is, unfortunately, a known issue. I left the new version in an incomplete state when I stopped working on it. I will try to resume working soon, and do my best to ensure that the new permalink handling is also compatible with the old one.

aroberge commented 8 years ago

In the new version, I am thinking of supporting only the programming mode, the human language, and a single instruction that points to a URL where a given world can be found. This would accomplish two things:

The disadvantage of this approach is that it requires a world to be hosted somewhere on some server. I may experiment and see if something like pastebin can be used.

aroberge commented 7 years ago

Closing this issue as it is now implemented by custom worlds loaded from URLs.