Add two example programs that were in the Dipple.
catseye
10 years ago
388 | 388 |
<td>7/10/97</td>
|
389 | 389 |
<td>A real purty 'switch' statement.</td>
|
390 | 390 |
</tr>
|
|
391 |
<tr>
|
|
392 |
<td><a href="testbrdg.bf">testbrdg.bf</a></td>
|
|
393 |
<td>Chris Pressey</td>
|
|
394 |
<td>10/27/11</td>
|
|
395 |
<td>Tests whether the # instruction interacts properly with wrapping.</td>
|
|
396 |
</tr>
|
|
397 |
<tr>
|
|
398 |
<td><a href="testmodu.bf">testmodu.bf</a></td>
|
|
399 |
<td>Chris Pressey</td>
|
|
400 |
<td>8/23/11</td>
|
|
401 |
<td>Tests how your implementation of Befunge-93 calculates modulus
|
|
402 |
(there is no right way.)</td>
|
|
403 |
</tr>
|
391 | 404 |
<tr> <td><a href="toupper.bf">toupper.bf</a></td>
|
392 | 405 |
<td>Chris Pressey</td>
|
393 | 406 |
<td>9/1/93</td>
|
|
0 |
>>>>v
|
|
1 |
@0.v>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
|
|
2 |
#<<< @.1@
|
|
0 |
v The original implementation of Befunge-93 was in ANSI C (a.k.a C89).
|
|
1 |
v The description of Befunge-93 did not describe how modulo should be
|
|
2 |
v implemented for a negative modulus -- it relied on ANSI C's semantics.
|
|
3 |
v
|
|
4 |
v Unfortunately, ANSI C did not define negative modulus either.
|
|
5 |
v
|
|
6 |
v So this program tests what your Befunge-93 implementation does for
|
|
7 |
v modulo by negative numbers. If it outputs:
|
|
8 |
v
|
|
9 |
v 1 -1 : result has same sign as the dividend (like C99)
|
|
10 |
v -2 2 : result has same sign as the divisor (like Python)
|
|
11 |
v
|
|
12 |
v Of course, since it is undefined, other results are possible.
|
|
13 |
v
|
|
14 |
>703-%.07-3%.@
|