Hacker News new | past | comments | ask | show | jobs | submit login

Wow, thanks for the response, that's really neat. I'm still confused though. Is this VM running every possible program ever (branching N times every step, given an instruction set of size N?) And then the run function just picks the right result? Thanks again.



Think about it like this.

We have a couple of variables: the data pointer, the instruction pointer

The values of these are encrypted BUT we can change them by performing logical operations (AND, OR, XOR, etc) on them.

So a cycle of the VM asks

1. Is the current instruction the correct instruction?

2. Is the current data cell the correct data cell?

Obviously if we knew the value of the instruction pointer we could just go straight to the correct instruction, and if we knew the index of data cell I could go straight to it.

The problem is that we don't know either of these things. So we have to go to every instruction and every data cell and check if it's the correct one. If it is then we can perform the instruction, otherwise we move on.

You can see now why this would be slow too. It's even slower though because in order to do this "check" we have to execute logic gates and the gates can take ~0.8 seconds (on a somewhat modern CPU).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: