A lot of you probably know Project Euler.
For those who don't here a short explanation: Project Euler is a collection of mathematical/programming problems.
Most problems consist of finding a single number and are solved by writing a program in the programming language of your choice.
Most people solve these by using normal languages like C, Java, Phyton, Haskell etc. But you can also go a step further and try solving it with a little bit more exotic languages.
So here are my solutions written in Befunge
Note:
Similar to most Befunge content on this site I only used the Befunge-93 instruction-set but ignored the 80x25 size restriction.
Still I tries to keep the programs in the Befunge-93 grid size, but that wasn't possible for all. So I guess some programs are technically Befunge-98.
I have a included javascript runner here, but for one I only enabled it for programs of reasonable sizes (a few soutions had source files in the megabyte range).
And also it's not the fastest interpreter and some solution take quite a while to finish.
I recommend using BefunExec. I specially made that interpreter for this project. It can run befunge code with around 6.5 MHz (on my machine)
Number | Title | Time | Size | Solution (hover to reveal) | '; echo ''; echo $problem['number']; echo ''; echo ' | ' . "\r\n"; echo ''; echo ''; echo htmlspecialchars($problem['title']); echo ''; echo ' | ' . "\r\n"; echo ''; echo ''; echo ' | \r\n"; echo ''; echo ''; echo '' . "\r\n"; echo '';
echo '';
echo $problem['width'] . 'x' . $problem['height'];
echo ' ';
echo ($problem['is93'] ? 'Bef-93' : 'Bef-98');
echo ' ';
echo '';
echo ' | ' . "\r\n";
echo ''; echo number_format($problem['value'], 0, null, ','); echo ' | ' . "\r\n"; echo "\r\n"; } ?>
---|