The original source works on a large static array that is passed as var parameter and where the bytes are used in a bitwise fashion. All in all it does its job in a brute-force native-compiler friendly way, but is quite suboptimal for a JS execution. Anyway I compiled as close as possible to the original (update source zip , 6kB).
Very few changes were required to get it to compile:
- changed the TObjectList to an “array of TCell“
- replaced Random() with RandomInt()
- replaced the FillChar() with nested loops
- mapped TCanvas to TW3Canvas
But the bulk of the code compiled without changes, and runs in Android, Chrome, IE9, etc. (only FireFox has a glitch, which is not related to the Maze code, but to the VJL and a Mozilla event name).