mxenabled / mxcpu

Arecibo / MXCPU Billboard Puzzle
3 stars 2 forks source link

mxcpu.js misses formatting error if it is deep in the program #6

Open jj-12 opened 5 years ago

jj-12 commented 5 years ago

I referenced 0F in one part of some code I was messing around with, but I accidentally put the letter O instead of zero. While both the tests on mx.com/cpu as well as when running through Rhino locally caught other issues similar to this, it missed this issue for some reason. When running locally, it succeeded, and then when running against tests online, the program goes into an infinite loop, blocks the UI, and eventually crashes the page.

I don't want to post the actual code here, since it's pretty close to a working solution, but it was when I used the B2 op code. Also, when using the B2 op code earlier in the code with the same format issue, it breaks as expected and throws an error on Rhino and shows a message on the webpage that I need to match the requested format. It's only later, with the B2 op that's in a for loop that it swallows the error or goes into an infinite loop.

Feel free to reach out to me personally if you want the full code for reference. I submitted a working solution, so you should have my contact info. I'm probably the only person so far who has the initials JJ, and I submitted this morning, so it should be pretty easy to track me down :).

tempoc commented 5 years ago

Solution could be as simple as running the OP codes and params in string form through a validating RegEx before parsing them to feed them numerically into the execution loop.