This article talks about a guy who ported some older Sierra computer games to the browser using the CANVAS tag. Thats not whats cool. What is cool is this:
I was able to convert the logic to javascript, but there was one big problem: Sierra’s code used GOTO statements, and those could jump anywhere in the code, even inside a nested “if”-statement. It seemed unsolvable in javascript.
I sat down together with Sjoerd Visscher, one of my collegues at Q42, and we came up with a solution. Using a decompilation approach to get rid of nested “if”-statements and putting the whole shebang inside a huge switch/case statement, we could mimic line numbers and GOTO’s while maintaining performance. World domination was within reach :-D
He is emulating line numbers using a giant SWITCH Case where each "case" statement is a line number! Neat hack!