Вопрос

Befunge isn't used much outside of code golf, but I wanted to try to learn it. I got a random number generator from Wikipedia and decided to modify it so that it ended. Here's what I have:

v>>>>.v>
      ?^
 12345@
 ^ ^  
> ? ?^
 v?v  
v6789>

And I was wondering why it has a tendency to generate the number 2 a lot, usually repeated. Is it just the interpreter?

Это было полезно?

Решение

You are missing a question mark on line 4, underneath "2".
Your code starts by going to line 5 and then hit the question mark there. If the question mark goes "up" in your sample, it will allways hit "2", so that will happen 25% of the time.
If you add the missing question mark underneath the number 2 you should start seeing more random results.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top