Bunny
Descripción del contenido de la página
Conversión de Bunny a varios lenguajes de programación.
Este programa ha sido convertido a 25 lenguajes de programación.
Original
Origin of bunny.bas:
Anonymous, 1978.
Creative Computing's BASIC Games.
- http://vintage-basic.net/games.html
- http://vintage-basic.net/bcg/bunny.bas
- http://www.retroarchive.org/cpm/games/ccgames.zip
10 PRINT TAB(33);"BUNNY"
20 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
30 PRINT: PRINT: PRINT
100 REM "BUNNY" FROM AHL'S 'BASIC COMPUTER GAMES'
110 REM
120 FOR I=0 TO 4: READ B(I): NEXT I
130 GOSUB 260
140 L=64: REM ASCII LETTER CODE...
150 REM
160 PRINT
170 READ X: IF X<0 THEN 160
175 IF X>128 THEN 240
180 PRINT TAB(X);: READ Y
190 FOR I=X TO Y: J=I-5*INT(I/5)
200 PRINT CHR$(L+B(J));
210 NEXT I
220 GOTO 170
230 REM
240 GOSUB 260: GOTO 450
250 REM
260 FOR I=1 TO 6: PRINT CHR$(10);: NEXT I
270 RETURN
280 REM
290 DATA 2,21,14,14,25
300 DATA 1,2,-1,0,2,45,50,-1,0,5,43,52,-1,0,7,41,52,-1
310 DATA 1,9,37,50,-1,2,11,36,50,-1,3,13,34,49,-1,4,14,32,48,-1
320 DATA 5,15,31,47,-1,6,16,30,45,-1,7,17,29,44,-1,8,19,28,43,-1
330 DATA 9,20,27,41,-1,10,21,26,40,-1,11,22,25,38,-1,12,22,24,36,-1
340 DATA 13,34,-1,14,33,-1,15,31,-1,17,29,-1,18,27,-1
350 DATA 19,26,-1,16,28,-1,13,30,-1,11,31,-1,10,32,-1
360 DATA 8,33,-1,7,34,-1,6,13,16,34,-1,5,12,16,35,-1
370 DATA 4,12,16,35,-1,3,12,15,35,-1,2,35,-1,1,35,-1
380 DATA 2,34,-1,3,34,-1,4,33,-1,6,33,-1,10,32,34,34,-1
390 DATA 14,17,19,25,28,31,35,35,-1,15,19,23,30,36,36,-1
400 DATA 14,18,21,21,24,30,37,37,-1,13,18,23,29,33,38,-1
410 DATA 12,29,31,33,-1,11,13,17,17,19,19,22,22,24,31,-1
420 DATA 10,11,17,18,22,22,24,24,29,29,-1
430 DATA 22,23,26,29,-1,27,29,-1,28,29,-1,4096
440 REM
450 END
Salida
UN
BUN BUNNYB
BUNNYB NYBUNNYBUN
BUNNYBUN UNNYBUNNYBUN
UNNYBUNNY NNYBUNNYBUNNYB
NNYBUNNYBU UNNYBUNNYBUNNYB
NYBUNNYBUNN YBUNNYBUNNYBUNNY
YBUNNYBUNNY NNYBUNNYBUNNYBUNN
BUNNYBUNNYB UNNYBUNNYBUNNYBUN
UNNYBUNNYBU BUNNYBUNNYBUNNYB
NNYBUNNYBUN YBUNNYBUNNYBUNNY
NYBUNNYBUNNY NYBUNNYBUNNYBUNN
YBUNNYBUNNYB NNYBUNNYBUNNYBU
BUNNYBUNNYBU UNNYBUNNYBUNNYB
UNNYBUNNYBUN BUNNYBUNNYBUNN
NNYBUNNYBUN YBUNNYBUNNYBU
NYBUNNYBUNNYBUNNYBUNNY
YBUNNYBUNNYBUNNYBUNN
BUNNYBUNNYBUNNYBU
NNYBUNNYBUNNY
NYBUNNYBUN
YBUNNYBU
UNNYBUNNYBUNN
NYBUNNYBUNNYBUNNYB
UNNYBUNNYBUNNYBUNNYBU
BUNNYBUNNYBUNNYBUNNYBUN
NYBUNNYBUNNYBUNNYBUNNYBUNN
NNYBUNNYBUNNYBUNNYBUNNYBUNNY
UNNYBUNN UNNYBUNNYBUNNYBUNNY
BUNNYBUN UNNYBUNNYBUNNYBUNNYB
YBUNNYBUN UNNYBUNNYBUNNYBUNNYB
NYBUNNYBUN BUNNYBUNNYBUNNYBUNNYB
NNYBUNNYBUNNYBUNNYBUNNYBUNNYBUNNYB
UNNYBUNNYBUNNYBUNNYBUNNYBUNNYBUNNYB
NNYBUNNYBUNNYBUNNYBUNNYBUNNYBUNNY
NYBUNNYBUNNYBUNNYBUNNYBUNNYBUNNY
YBUNNYBUNNYBUNNYBUNNYBUNNYBUNN
UNNYBUNNYBUNNYBUNNYBUNNYBUNN
BUNNYBUNNYBUNNYBUNNYBUN Y
YBUN YBUNNYB NYBU B
BUNNY NYBUNNYB U
YBUNN U YBUNNYB N
NYBUNN NYBUNNY NYBUNN
NNYBUNNYBUNNYBUNNY UNN
UNN N Y N YBUNNYBU
BU NN N Y Y
NN UNNY
NNY
NY
En 8th
\ Bunny
\ Original version in BASIC:
\ Anonymous, 1978.
\ Creative Computing's BASIC Games.
\ - http://vintage-basic.net/games.html
\ - http://vintage-basic.net/bcg/bunny.bas
\ - http://www.retroarchive.org/cpm/games/ccgames.zip
\ This version in 8th:
\ Copyright (c) 2023, Marcos Cruz (programandala.net)
\ SPDX-License-Identifier: Fair
\ Written in 2023-03-11/12, 2023-08-31.
\ Last modified 20251204T2247+0100.
13 constant enter_key_code
: press_enter \ --
repeat con:key enter_key_code n:= until! ;
\ Wait for the Enter key be pressed.
: print_credits \ --
con:cls
"Bunny\n\n" .
"Original version in BASIC:\n" .
" Creative Computing (Morristown, New Jersey, USA), 1978.\n\n" .
"This version in 8th:\n" .
" Copyright (c) 2023, Marcos Cruz (programandala.net)\n" .
" SPDX-License-Identifier: Fair\n\n" .
"Press Enter to start the program.\n" .
press_enter ;
\ Clear the screen, print the credits and wait for a keypress.
"BUNNY" constant letter
letter s:len constant letters
-1 constant EOL
depth >r
1 2 EOL 0 2 45 50 EOL 0 5 43 52 EOL 0 7 41 52 EOL 1 9 37 50
EOL 2 11 36 50 EOL 3 13 34 49 EOL 4 14 32 48 EOL 5 15 31 47 EOL
6 16 30 45 EOL 7 17 29 44 EOL 8 19 28 43 EOL 9 20 27 41 EOL 10
21 26 40 EOL 11 22 25 38 EOL 12 22 24 36 EOL 13 34 EOL 14 33 EOL
15 31 EOL 17 29 EOL 18 27 EOL 19 26 EOL 16 28 EOL 13 30 EOL 11 31
EOL 10 32 EOL 8 33 EOL 7 34 EOL 6 13 16 34 EOL 5 12 16 35 EOL 4
12 16 35 EOL 3 12 15 35 EOL 2 35 EOL 1 35 EOL 2 34 EOL 3 34 EOL
4 33 EOL 6 33 EOL 10 32 34 34 EOL 14 17 19 25 28 31 35 35 EOL
15 19 23 30 36 36 EOL 14 18 21 21 24 30 37 37 EOL 13 18 23 29
33 38 EOL 12 29 31 33 EOL 11 13 17 17 19 19 22 22 24 31 EOL 10
11 17 18 22 22 24 24 29 29 EOL 22 23 26 29 EOL 27 29 EOL 28 29 EOL
depth r> - dup constant data_len \ number of data
a:close var, data \ make array out of data in stack
0 var, d \ data index
: next_datum \ -- n|null
data @ d @ a:@ nip
d @ n:1+ d ! ;
\ Return the next element _n_ from the `data` array;
\ if there are no elements left, return `null` instead.
: tab \ col --
con:getxy drop swap con:gotoxy ;
\ Set the console cursor position to column _col_ of the current row.
: print_letter \ col --
letters n:mod letter swap s:@ putc drop ;
\ Print the letter from the `letter` string correspondent to column _col_.
: draw \ --
con:cls
repeat
next_datum null? if
2drop break
else
dup EOL n:= if
drop cr
else
n:1+ dup >r tab \ set column position
r> next_datum n:1+ ' print_letter -rot loop \ print letters
then
then
again ;
\ Draw the graphic out of the `data` array and the `letter` string.
: app:main \ --
print_credits draw ;
En Ada
-- Bunny
--
-- Original version in BASIC:
-- Anonymous, 1978.
-- Creative Computing's BASIC Games.
-- - http://vintage-basic.net/games.html
-- - http://vintage-basic.net/bcg/bunny.bas
-- - http://www.retroarchive.org/cpm/games/ccgames.zip
--
-- This version in Ada:
-- Copyright (c) 2025, Marcos Cruz (programandala.net)
-- SPDX-License-Identifier: Fair
--
-- Written on 2025-03-29, 2025-03-31, 2025-04-17.
--
-- Last modified: 20251204T2258+0100.
with ada.text_io;
use ada.text_io;
procedure bunny is
width : constant integer := 53;
type line_index is range 1 .. width;
type line_array is array (line_index) of character;
-- Clear the terminal and move the cursor to the top left position.
procedure clear_screen is
escape : constant character := character'val (16#1B#); -- 0x1B
begin
put (escape & "[0;0H" & escape & "[2J");
end clear_screen;
procedure wait_for_a_keypress is
char : character;
available : boolean := false;
begin
while not available loop
get_immediate (char, available);
end loop;
end wait_for_a_keypress;
procedure print_credits is
begin
put_line ("Bunny");
new_line;
put_line ("Original version in BASIC:");
put_line (" Creative Computing (Morristown, New Jersey, USA), 1978.");
new_line;
put_line ("This version in Ada:");
put_line (" Copyright (c) 2025, Marcos Cruz (programandala.net)");
put_line (" SPDX-License-Identifier: Fair");
new_line;
put ("Press Enter to start the program. ");
wait_for_a_keypress;
end print_credits;
procedure clear_line (line : in out line_array) is
begin
for i in line'range loop
line (i) := ' ';
end loop;
end clear_line;
procedure print_line (line : line_array) is
begin
for i in line'range loop
put (line (i));
end loop;
new_line;
end print_line;
procedure draw is
letters : constant integer := 5;
type letters_range is range 1 .. letters;
letter : constant array (letters_range) of character :=
('B', 'U', 'N', 'N', 'Y');
EOL : constant integer := -1; -- end of line identifier
data : array (0 .. 226) of integer := (
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41,
52, EOL, 1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34,
49, EOL, 4, 14, 32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30,
45, EOL, 7, 17, 29, 44, EOL, 8, 19, 28, 43, EOL, 9, 20, 27,
41, EOL, 10, 21, 26, 40, EOL, 11, 22, 25, 38, EOL, 12, 22,
24, 36, EOL, 13, 34, EOL, 14, 33, EOL, 15, 31, EOL, 17, 29,
EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL, 13, 30, EOL, 11,
31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6, 13, 16, 34,
EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15, 35,
EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28,
31, 35, 35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21,
21, 24, 30, 37, 37, EOL, 13, 18, 23, 29, 33, 38, EOL, 12,
29, 31, 33, EOL, 11, 13, 17, 17, 19, 19, 22, 22, 24, 31,
EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29, 29, EOL, 22, 23,
26, 29, EOL, 27, 29, EOL, 28, 29, EOL );
line : line_array;
data_index : integer;
first_column : integer;
last_column : integer;
begin
clear_line (line);
data_index := 0;
while data_index < data'length loop
first_column := data (data_index);
data_index := data_index + 1;
if first_column = EOL then
print_line (line);
clear_line (line);
else
last_column := data (data_index);
data_index := data_index + 1;
for column in first_column .. last_column loop
line (line_index (column + 1)) := letter (
letters_range (column mod letters + 1)
);
end loop;
end if;
end loop;
end draw;
begin
clear_screen;
print_credits;
clear_screen;
draw;
end bunny;
En Arturo
; Bunny
; Original version in BASIC:
; Anonymous, 1978.
; Creative Computing's BASIC Games.
; - http://vintage-basic.net/games.html
; - http://vintage-basic.net/bcg/bunny.bas
; - http://www.retroarchive.org/cpm/games/ccgames.zip
; This version in Arturo:
; Copyright (c) 2023, Marcos Cruz (programandala.net)
; SPDX-License-Identifier: Fair
;
; Written on 2023-10-17.
;
; Last modified: 20251205T0046+0100.
printCredits: function [] [
print "Bunny\n"
print "Original version in BASIC:"
print " Creative Computing (Morristown, New Jersey, USA), 1978.\n"
print "This version in Arturo:"
print " Copyright (c) 2023, Marcos Cruz (programandala.net)"
print " SPDX-License-Identifier: Fair\n"
input "Press Enter to start the program. "
]
SPACE: ` `
WIDTH: 53
; Line buffer.
line: array.of: WIDTH SPACE
letter: array [`B` `U` `N` `N` `Y`]
letters: size letter
; End of line identifier.
EOL: neg 1
data: array [
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL ]
dataSize: size data
; Index of the current datum in the `data` array.
dataIndex: 0
; Retun the current datum.
datum: function [] [
add 'dataIndex 1
return data\[sub dataIndex 1]
]
; Draw the graphic out of `data` and `letter`.
draw: function [] [
while [ less? dataIndex dataSize ] [
firstColumn: datum
if? equal? firstColumn EOL [
loop 0 .. (sub WIDTH 1) 'pos [
prints line\[pos]
]
print ""
'line: array.of: WIDTH SPACE
] else [
lastColumn: datum
loop firstColumn .. lastColumn 'column [
line\[column]: letter\[mod column letters]
]
]
]
]
clear
printCredits
clear
draw
En C#
// Bunny
// Original version in BASIC:
// Anonymous, 1978.
// Creative Computing's BASIC Games.
// - http://vintage-basic.net/games.html
// - http://vintage-basic.net/bcg/bunny.bas
// - http://www.retroarchive.org/cpm/games/ccgames.zip
// This version in C#:
// Copyright (c) 2024, Marcos Cruz (programandala.net)
// SPDX-License-Identifier: Fair
//
// Written on 2024-12-20.
//
// Last modified: 20251205T1532+0100.
using System;
class Bunny
{
static void PrintCredits()
{
Console.WriteLine("Bunny\n");
Console.WriteLine("Original version in BASIC:");
Console.WriteLine(" Creative Computing (Morristown, New Jersey, USA), 1978.\n");
Console.WriteLine("This version in C#:");
Console.WriteLine(" Copyright (c) 2024, Marcos Cruz (programandala.net)");
Console.WriteLine(" SPDX-License-Identifier: Fair\n");
Console.Write("Press Enter to start. ");
Console.ReadKey();
}
const int WIDTH = 53;
static char[] line = new char[WIDTH]; // buffer
static void clearLine()
{
for (int c = 0; c < WIDTH; c++)
{
line[c] = ' ';
}
}
static char[] letter = {'B', 'U', 'N', 'N', 'Y'};
const int EOL = -1; // end of line identifier
static int[] data =
{
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL };
static int dataIndex = 0;
static int datum()
{
dataIndex += 1;
return data[dataIndex - 1];
}
static void Draw()
{
clearLine();
while (dataIndex < data.Length)
{
int firstColumn = datum();
if (firstColumn == EOL)
{
Console.WriteLine(line);
clearLine();
}
else
{
int lastColumn = datum();
for (int c = firstColumn; c <= lastColumn; c++)
{
line[c] = letter[c % letter.Length];
}
}
}
}
static void Main()
{
Console.Clear();
PrintCredits();
Console.Clear();
Draw();
}
}
En Chapel
/*
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in Chapel:
Copyright (c) 2025, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written on 2025-04-05.
Last modified 20250405T2255+0200.
*/
import IO;
// Erase the screen, reset the attributes and move the cursor to the home
// position.
proc clearScreen() {
write("\x1B[2J\x1B[0m\x1B[H");
}
// Clear the screen, print the credits and wait for a keypress.
proc printCredits() {
writeln("Bunny\n");
writeln("Original version in BASIC:");
writeln(" Creative Computing (Morristown, New Jersey, USA), 1978.\n");
writeln("This version in Chapel:");
writeln(" Copyright (c) 2025, Marcos Cruz (programandala.net)");
writeln(" SPDX-License-Identifier: Fair\n");
writeln("Press Enter to start the program.");
IO.readLine();
}
param Width = 53;
var line: [0 ..< Width] string; // buffer
var col: int; // first col to print from
proc clearLine() {
for c in 0 ..< Width {
line[c] = " ";
}
col = 0;
}
const letter: string = "BUNNY";
param EOL: uint(8) = 127; // end of line identifier
const data = [
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL ];
// Draw the graphic out of `data` and `letter`.
proc draw() {
const dataLen: int = data.size;
const letters: int = letter.size;
var toCol: int; // last col to print to
var d: int = 0; // data pointer
clearLine();
while d < dataLen {
col = data[d];
d += 1;
if col == EOL {
for c in line {
write(c);
}
writeln();
clearLine();
}
else {
toCol = data[d];
d += 1;
for c in col .. toCol {
line[c] = letter[c - letters * (c / letters)];
}
}
}
}
proc main() {
clearScreen();
printCredits();
clearScreen();
draw();
}
En Crystal
# Bunny
# Original version in BASIC:
# Creative Computing (Morristown, New Jersey, USA), 1978.
# This version in Crystal:
# Copyright (c) 2023, 2024, Marcos Cruz (programandala.net)
# SPDX-License-Identifier: Fair
#
# Written in 2023-09, 2024-09.
#
# Last modified: 20250731T1954+0200.
# Clears the terminal and moves the cursor to the top left position.
def clear_screen
print "\e[0;0H\e[2J"
end
# Prints the credits and waits for the Enter key.
def print_credits
puts "Bunny\n"
puts "Original version in BASIC:"
puts " Creative Computing (Morristown, New Jersey, USA), 1978.\n"
puts "This version in Crystal:"
puts " Copyright (c) 2023, 2024, Marcos Cruz (programandala.net)"
puts " SPDX-License-Identifier: Fair\n"
puts "Press Enter to start the program."
gets
end
WIDTH = 53
# Clears the given line buffer array with spaces.
def clear_line(line)
(0...WIDTH).each do |n|
line[n] = ' '
end
end
# Prints the given line buffer array.
def print_line(line)
line.each do |item|
print item
end
puts
end
END_OF_LINE = -1 # end of row identifier
# Draws the graphic.
def draw
letter = ['B', 'U', 'N', 'N', 'Y']
letters = letter.size
data = [
1, 2, END_OF_LINE, 0, 2, 45, 50, END_OF_LINE, 0, 5, 43, 52, END_OF_LINE, 0, 7, 41, 52, END_OF_LINE,
1, 9, 37, 50, END_OF_LINE, 2, 11, 36, 50, END_OF_LINE, 3, 13, 34, 49, END_OF_LINE, 4, 14,
32, 48, END_OF_LINE, 5, 15, 31, 47, END_OF_LINE, 6, 16, 30, 45, END_OF_LINE, 7, 17, 29, 44,
END_OF_LINE, 8, 19, 28, 43, END_OF_LINE, 9, 20, 27, 41, END_OF_LINE, 10, 21, 26, 40, END_OF_LINE,
11, 22, 25, 38, END_OF_LINE, 12, 22, 24, 36, END_OF_LINE, 13, 34, END_OF_LINE, 14, 33, END_OF_LINE,
15, 31, END_OF_LINE, 17, 29, END_OF_LINE, 18, 27, END_OF_LINE, 19, 26, END_OF_LINE, 16, 28, END_OF_LINE,
13, 30, END_OF_LINE, 11, 31, END_OF_LINE, 10, 32, END_OF_LINE, 8, 33, END_OF_LINE, 7, 34, END_OF_LINE, 6,
13, 16, 34, END_OF_LINE, 5, 12, 16, 35, END_OF_LINE, 4, 12, 16, 35, END_OF_LINE, 3, 12, 15,
35, END_OF_LINE, 2, 35, END_OF_LINE, 1, 35, END_OF_LINE, 2, 34, END_OF_LINE, 3, 34, END_OF_LINE, 4, 33,
END_OF_LINE, 6, 33, END_OF_LINE, 10, 32, 34, 34, END_OF_LINE, 14, 17, 19, 25, 28, 31, 35,
35, END_OF_LINE, 15, 19, 23, 30, 36, 36, END_OF_LINE, 14, 18, 21, 21, 24, 30, 37, 37,
END_OF_LINE, 13, 18, 23, 29, 33, 38, END_OF_LINE, 12, 29, 31, 33, END_OF_LINE, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, END_OF_LINE, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, END_OF_LINE, 22, 23, 26, 29, END_OF_LINE, 27, 29, END_OF_LINE, 28, 29, END_OF_LINE,
]
line = [] of Char # line buffer
(0...WIDTH).each do
line << ' '
end
data_index = 0
while data_index < data.size
first_column = data[data_index]
data_index += 1
if first_column == END_OF_LINE
print_line line
clear_line line
else
last_column = data[data_index]
data_index += 1
(first_column..last_column).each do |column|
line[column] = letter[column % letters]
end
end
end
end
clear_screen
print_credits
clear_screen
draw
En D
/*
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in D:
Copyright (c) 2023, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written in 2023-03-23/26, 2023-08-29/31.
Last modified 20251219T2132+0100.
*/
module bunny;
// Erase the screen, reset the attributes and move the cursor to the home position.
void clearScreen()
{
import std.stdio : write;
write("\033[2J\033[0m\033[H");
}
// Clear the screen, print the credits and wait for a keypress.
void printCredits()
{
import std.stdio : readln;
import std.stdio : writeln;
writeln("Bunny\n");
writeln("Original version in BASIC:");
writeln(" Creative Computing (Morristown, New Jersey, USA), 1978.\n");
writeln("This version in D:");
writeln(" Copyright (c) 2023, Marcos Cruz (programandala.net)");
writeln(" SPDX-License-Identifier: Fair\n");
writeln("Press Enter to start the program.");
readln();
}
enum Width = 53;
ubyte[Width] line; // buffer
int col; // first col to print from
// Clear the line buffer with spaces.
void clearLine()
{
foreach (c; 0 .. Width)
{
line[c] = ' ';
}
col = 0;
}
string letter = "BUNNY";
enum EOL = 127; // end of line identifier
ubyte[] data = [
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL ];
// Draw the graphic out of `data` and `letter`.
void draw()
{
import std.stdio : writef;
int dataLen = cast(int)data.length;
int letters = cast(int)letter.length;
int toCol; // last col to print to
int d = 0; // data pointer
clearLine();
while (d < dataLen)
{
col = data[d];
d += 1;
if (col == EOL)
{
writef("%s\n", cast(string)line);
clearLine();
}
else
{
toCol = data[d];
d += 1;
foreach (int c; col .. toCol + 1)
{
line[c] = letter[c % letters];
}
}
}
}
void main()
{
clearScreen();
printCredits();
clearScreen();
draw();
}
En FreeBASIC
/'
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in FreeBASIC:
Copyright (c) 2024, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written on 2024-11-21.
Last modified: 20250505T2350+0200.
'/
sub print_credits()
dim void as string
print !"Bunny\n"
print "Original version in BASIC:"
print !" Creative Computing (Morristown, New Jersey, USA), 1978.\n"
print "This version in FreeBASIC:"
print " Copyright (c) 2024, Marcos Cruz (programandala.net)"
print !" SPDX-License-Identifier: Fair\n"
input "Press Enter to start the program. ", void
end sub
sub do_draw()
const EOL as integer = -1 ' end of line identifier
const picture_data_count as integer = 226
const letters as integer = 5
dim letter(1 to letters) as string = {"B", "U", "N", "N", "Y"}
dim picture_data(picture_data_count) as integer = { _
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL, _
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14, _
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44, _
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL, _
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL, _
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL, _
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6, _
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15, _
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33, _
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35, _
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37, _
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17, _
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29, _
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL }
const line_buffer_size as integer = 53
dim line_buffer(1 to line_buffer_size) as string
for i as integer = 1 to line_buffer_size
line_buffer(i) = " "
next
dim picture_data_index as integer = 0
do while picture_data_index <= picture_data_count
var first_column = picture_data(picture_data_index)
picture_data_index += 1
if first_column = EOL then
for i as integer = 1 to line_buffer_size
print line_buffer(i);
line_buffer(i) = " "
next
print
else
var last_column = picture_data(picture_data_index)
picture_data_index += 1
for column as integer = first_column to last_column
line_buffer(column + 1) = letter(column mod letters + 1)
next
end if
loop
end sub
cls
print_credits()
cls
do_draw()
' vim: filetype=freebasic
En Go
/*
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in Go:
Copyright (c) 2024, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written on 2024-12-29.
Last modified: 20250105T1151+0100.
*/
package main
import "fmt"
func clearScreen() {
fmt.Print("\x1B[0;0H\x1B[2J")
}
func input(prompt string) string {
fmt.Print(prompt)
var s = ""
fmt.Scanf("%s", &s)
return s
}
// Print the credits and wait for a keypress.
func printCredits() {
fmt.Println("Bunny\n")
fmt.Println("Original version in BASIC:")
fmt.Println(" Creative Computing (Morristown, New Jersey, USA), 1978.\n")
fmt.Println("This version in Go:")
fmt.Println(" Copyright (c) 2024, Marcos Cruz (programandala.net)")
fmt.Println(" SPDX-License-Identifier: Fair\n")
input("Press Enter to start the program. ")
}
const width int = 53
var line [width]uint8 // buffer
// Clear the line buffer with spaces.
func clearLine() {
for column := 0; column < len(line); column++ {
line[column] = ' '
}
}
var letter = []uint8{'B', 'U', 'N', 'N', 'Y'}
var letters = int8(len(letter))
const end = -1 // end of line identifier
var data = []int8{
1, 2, end, 0, 2, 45, 50, end, 0, 5, 43, 52, end, 0, 7, 41, 52, end,
1, 9, 37, 50, end, 2, 11, 36, 50, end, 3, 13, 34, 49, end, 4, 14,
32, 48, end, 5, 15, 31, 47, end, 6, 16, 30, 45, end, 7, 17, 29, 44,
end, 8, 19, 28, 43, end, 9, 20, 27, 41, end, 10, 21, 26, 40, end,
11, 22, 25, 38, end, 12, 22, 24, 36, end, 13, 34, end, 14, 33, end,
15, 31, end, 17, 29, end, 18, 27, end, 19, 26, end, 16, 28, end,
13, 30, end, 11, 31, end, 10, 32, end, 8, 33, end, 7, 34, end, 6,
13, 16, 34, end, 5, 12, 16, 35, end, 4, 12, 16, 35, end, 3, 12, 15,
35, end, 2, 35, end, 1, 35, end, 2, 34, end, 3, 34, end, 4, 33,
end, 6, 33, end, 10, 32, 34, 34, end, 14, 17, 19, 25, 28, 31, 35,
35, end, 15, 19, 23, 30, 36, 36, end, 14, 18, 21, 21, 24, 30, 37, 37,
end, 13, 18, 23, 29, 33, 38, end, 12, 29, 31, 33, end, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, end, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, end, 22, 23, 26, 29, end, 27, 29, end, 28, 29, end}
var dataLen = len(data)
var dataIndex = 0 // data pointer
func datum() int8 {
dataIndex += 1
return data[dataIndex-1]
}
// Draw the graphic out of `data` and `letter`.
func draw() {
clearLine()
for dataIndex < dataLen {
var firstColumn = datum()
if firstColumn == end {
fmt.Printf("%s\n", line)
clearLine()
} else {
var lastColumn = datum()
for column := firstColumn; column <= lastColumn; column++ {
line[column] = letter[column%letters]
}
}
}
}
func main() {
clearScreen()
printCredits()
clearScreen()
draw()
}
En Hare
// Bunny
//
// Original version in BASIC:
// Creative Computing (Morristown, New Jersey, USA), 1978.
//
// This version in Hare:
// Copyright (c) 2025, Marcos Cruz (programandala.net)
// SPDX-License-Identifier: Fair
//
// Written on 2025-02-12, 2025-02-15.
//
// Last modified: 20260213T1645+0100.
use bufio;
use fmt;
use os;
use strings;
fn clear_screen() void = {
fmt::print("\x1B[0;0H\x1B[2J")!;
};
fn print_prompt(prompt: str = "") void = {
fmt::print(prompt)!;
bufio::flush(os::stdout)!;
};
fn accept_string(prompt: str = "") str = {
print_prompt(prompt);
const buffer = match (bufio::read_line(os::stdin)!) {
case let buffer: []u8 =>
yield buffer;
case =>
return "";
};
defer free(buffer);
return strings::dup(strings::fromutf8(buffer)!)!;
};
fn press_enter(prompt: str = "") void = {
free(accept_string(prompt));
};
fn print_credits() void = {
fmt::println("Bunny\n")!;
fmt::println("Original version in BASIC:")!;
fmt::println(" Creative Computing (Morristown, New Jersey, USA), 1978.\n")!;
fmt::println("This version in Hare:")!;
fmt::println(" Copyright (c) 2025, Marcos Cruz (programandala.net)")!;
fmt::println(" SPDX-License-Identifier: Fair\n")!;
press_enter("Press Enter to start the program. ");
};
def WIDTH = 53;
let line: [WIDTH]rune = [' '...]; // buffer
// Clear the line buffer with spaces.
//
fn clear_line() void = {
for (let column: int = 0; column < WIDTH; column += 1) {
line[column] = ' ';
};
};
let letter: [_]rune = ['B', 'U', 'N', 'N', 'Y'];
def LETTERS = len(letter): int;
def EOL = -1; // end of line identifier
let data: [_]int = [
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL ];
def DATA_LEN = len(data): int;
let data_index = 0;
fn datum() int = {
defer data_index += 1;
return data[data_index];
};
fn draw() void = {
clear_line();
for (data_index < DATA_LEN) {
let first_column = datum();
if (first_column == EOL) {
for (let c .. line) {
fmt::print(c)!;
};
fmt::println()!;
clear_line();
} else {
let last_column = datum();
for (let column = first_column; column <= last_column; column += 1) {
line[column] = letter[column % LETTERS];
};
};
};
};
export fn main() void = {
clear_screen();
print_credits();
clear_screen();
draw();
};
En Icon
# Bunny
#
# Original version in BASIC:
# Creative Computing (Morristown, New Jersey, USA), 1978.
#
# This version in Icon:
# Copyright (c) 2023, Marcos Cruz (programandala.net)
# SPDX-License-Identifier: Fair
#
# Written in 2023-09.
#
# Last modified 20231103T2341+0100.
link iscreen # clear()
# Print the credits and wait for a keypress.
procedure print_credits()
write("Bunny\n")
write("Original version in BASIC:")
write(" Creative Computing (Morristown, New Jersey, USA), 1978.\n")
write("This version in Icon:")
write(" Copyright (c) 2023, Marcos Cruz (programandala.net)")
write(" SPDX-License-Identifier: Fair\n")
write("Press Enter to start the program.")
read()
end
$define width 53
$define EOL -1 # end of line identifier
global data
global data_index
procedure next_datum()
data_index +:= 1
return data[data_index]
end
# Draw the graphic out of `data` and `letter`.
procedure draw()
letter := ["B", "U", "N", "N", "Y"]
data := [
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL ]
line_buffer := list(width, " ")
data_index := 0
while data_index <= *data do {
first_column := next_datum()
if first_column == EOL then {
every column := 1 to width do
writes(line_buffer[column])
write()
line_buffer := list(width, " ")
} else {
last_column := next_datum()
every column := first_column to last_column do
line_buffer[column + 1] := letter[column % *letter + 1]
}
}
end
procedure main()
clear()
print_credits()
clear()
draw()
end
En Janet
# Bunny
# Original version in BASIC:
# Anonymous, 1978.
# Creative Computing (Morristown, New Jersey, USA), ca. 1980.
# This version in Janet:
# Copyright (c) 2025, Marcos Cruz (programandala.net)
# SPDX-License-Identifier: Fair
#
# Written on 2025-12-23.
#
# Last modified 20251225T1944+0100.
(defn move-cursor-home []
(prin "\x1B[H"))
(defn clear-screen []
(prin "\x1B[2J")
(move-cursor-home))
(defn print-credits []
(print "Bunny\n")
(print "Original version in BASIC:")
(print " Anonymous, 1978.")
(print " Creative Computing (Morristown, New Jersey, USA), 1978.\n")
(print "This version in Janet:")
(print " Copyright (c) 2025, Marcos Cruz (programandala.net)")
(print " SPDX-License-Identifier: Fair\n")
(prin "Press Enter to start the program. ")
(getline))
(def width 53)
(def space (chr " "))
(def line (buffer/new-filled width space))
(def EOL 127) # end of line identifier
(def data
[1 2 EOL 0 2 45 50 EOL 0 5 43 52 EOL 0 7 41 52 EOL
1 9 37 50 EOL 2 11 36 50 EOL 3 13 34 49 EOL 4 14
32 48 EOL 5 15 31 47 EOL 6 16 30 45 EOL 7 17 29 44
EOL 8 19 28 43 EOL 9 20 27 41 EOL 10 21 26 40 EOL
11 22 25 38 EOL 12 22 24 36 EOL 13 34 EOL 14 33 EOL
15 31 EOL 17 29 EOL 18 27 EOL 19 26 EOL 16 28 EOL
13 30 EOL 11 31 EOL 10 32 EOL 8 33 EOL 7 34 EOL 6
13 16 34 EOL 5 12 16 35 EOL 4 12 16 35 EOL 3 12 15
35 EOL 2 35 EOL 1 35 EOL 2 34 EOL 3 34 EOL 4 33
EOL 6 33 EOL 10 32 34 34 EOL 14 17 19 25 28 31 35
35 EOL 15 19 23 30 36 36 EOL 14 18 21 21 24 30 37 37
EOL 13 18 23 29 33 38 EOL 12 29 31 33 EOL 11 13 17
17 19 19 22 22 24 31 EOL 10 11 17 18 22 22 24 24 29
29 EOL 22 23 26 29 EOL 27 29 EOL 28 29 EOL])
(defn letter [column]
(def letters ["B" "U" "N" "N" "Y"])
(get letters (% column (length letters))))
(defn print-line []
(print line)
(buffer/fill line space))
(defn draw []
(var data-index 0)
(var first-column 0)
(while (< data-index (length data))
(set first-column (get data data-index))
(if (= first-column EOL)
(print-line)
(do
(+= data-index 1)
(def last-column (get data data-index))
(for column first-column (+ last-column 1)
(buffer/push-at line column (letter column)))))
(+= data-index 1)))
(defn main [& args]
(clear-screen)
(print-credits)
(clear-screen)
(draw))
En Julia
# Bunny
#
# Original version in BASIC:
# Creative Computing (Morristown, New Jersey, USA), 1978.
#
# This version in Julia:
# Copyright (c) 2023, Marcos Cruz (programandala.net)
# SPDX-License-Identifier: Fair
# Written in 2023-09.
#
# Last modified: 20240704T1050+0200.
# Clear the terminal and move the cursor to the top left position.
function clear_screen()
print("\e[0;0H\e[2J")
end
# Clear the screen, print the credits and wait for the Enter key.
function print_credits()
println("Bunny\n")
println("Original version in BASIC:")
println(" Creative Computing (Morristown, New Jersey, USA), 1978.\n")
println("This version in Julia:")
println(" Copyright (c) 2023, Marcos Cruz (programandala.net)")
println(" SPDX-License-Identifier: Fair\n")
println("Press Enter to start the program.")
readline()
end
const width = 53
# Print the given line buffer array.
function print_line(line)
for item in line
print(item)
end
println()
end
const EOL = -1 # end of line identifier
# Draw the graphic.
function draw()
letter = ['B', 'U', 'N', 'N', 'Y']
letters = length(letter)
data = [
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL ]
line = Char[] # line buffer
# Init the line buffer with spaces.
for _ in (1 : width)
push!(line, ' ')
end
data_index = 1
while data_index <= length(data)
first_column = data[data_index]
data_index += 1
if first_column == EOL
print_line(line)
fill!(line, ' ')
else
last_column = data[data_index]
data_index += 1
for column in (first_column : last_column)
line[column + 1] = letter[column % letters + 1]
end
end
end
end
clear_screen()
print_credits()
clear_screen()
draw()
En Kotlin
/*
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in Kotlin:
Copyright (c) 2023, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written in 2023-08, 2023-10.
Last modified: 20250518T2359+0200.
*/
// Move the cursor to the top left position of the terminal.
fun home() {
print("\u001B\u005B\u0048")
}
// Clear the terminal and move the cursor to the top left position.
fun clearScreen() {
print("\u001B\u005B\u0032\u004A")
home()
}
// Clear the screen, print the credits and wait for the Enter key.
fun printCredits() {
println("Bunny\n")
println("Original version in BASIC:")
println(" Creative Computing (Morristown, New Jersey, USA), 1978.\n")
println("This version in Kotlin:")
println(" Copyright (c) 2023, Marcos Cruz (programandala.net)")
println(" SPDX-License-Identifier: Fair\n")
println("Press Enter to start the program.")
readln()
}
const val WIDTH = 53
var line = IntArray(WIDTH) // buffer
// Clear the line buffer with spaces.
fun clearLine() {
for (column in 0..<WIDTH) {
line[column] = ' '.code
}
}
val letter = arrayOf<Char>('B', 'U', 'N', 'N', 'Y')
var letters = letter.size
const val EOL: Int = -1 // end of line identifier
var data = arrayOf<Int>(
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL)
fun printLine() {
for (i in line) {
print(i.toChar())
}
println()
}
// Draw the graphic out of `data` and `letter`.
fun draw() {
clearLine()
var dataIndex = 0
while (dataIndex < data.size) {
val firstColumn = data[dataIndex++]
if (firstColumn == EOL) {
printLine()
clearLine()
} else {
val lastColumn = data[dataIndex++]
for (column in firstColumn..lastColumn) {
line[column] = letter[column % letters].code
}
}
}
}
fun main() {
clearScreen()
printCredits()
clearScreen()
draw()
}
En Nim
#[
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in Nim:
Copyright (c) 2023, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written in 2023-08.
Last modified: 20250405T0304+0200.
]#
import std/algorithm
import std/terminal
proc cursorHome() =
setCursorPos 0, 0
proc clearScreen() =
eraseScreen()
cursorHome()
proc showCredits() =
echo "Bunny\n"
echo "Original version in BASIC:"
echo " Creative computing (Morristown, New Jersey, USA), ca. 1978.\n"
echo "This version in Nim:"
echo " Copyright (c) 2023, Marcos Cruz (programandala.net)"
echo " SPDX-License-Identifier: Fair\n"
echo "Press any key to start the program."
discard getch()
const Width = 53
const space = ' '
var line: array[Width, char] # buffer
# Print the line buffer.
proc printLine() =
for col in 0 ..< Width:
write(stdout, line[col])
echo ""
const letter: array[5, char] = ['B', 'U', 'N', 'N', 'Y']
const EOL = -1 # end of line identifier
const data = [
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL ]
# Draw the graphic out of `data` and `letter`.
proc draw() =
var d = 0 # pointer in `data`
var col: int # col to draw from
var toCol: int # col to draw to
fill(line, space)
while d < data.len:
col = data[d]
d += 1
if col == EOL:
printLine()
fill(line, space)
else:
toCol = data[d]
d += 1
for c in col .. toCol:
line[c] = letter[c mod letter.len]
clearScreen()
showCredits()
clearScreen()
draw()
En Odin
/*
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in Odin:
Copyright (c) 2023, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written in 2023-03, 2023-08/09, 2023-11, 2023-12.
Last modified: 20250101T2036+0100.
*/
package bunny
import "../lib/anodino/src/read"
import "../lib/anodino/src/term"
import "core:fmt"
// Print the credits and wait for a keypress.
//
print_credits :: proc() {
fmt.println("Bunny\n")
fmt.println("Original version in BASIC:")
fmt.println(" Creative Computing (Morristown, New Jersey, USA), 1978.\n")
fmt.println("This version in Odin:")
fmt.println(" Copyright (c) 2023, Marcos Cruz (programandala.net)")
fmt.println(" SPDX-License-Identifier: Fair\n")
read.a_prompted_string("Press Enter to start the program. ")
}
WIDTH :: 53
line : [WIDTH]u8 // buffer
// Clear the line buffer with spaces.
//
clear_line :: proc() {
for column in 0 ..< len(line) {
line[column] = ' '
}
}
letter : []u8 = {'B', 'U', 'N', 'N', 'Y'}
letters : i8 = i8(len(letter))
EOL :: -1 // end of line identifier
data : []i8 = {
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL }
data_len := len(data)
data_index := 0 // data pointer
datum :: proc() -> i8 {
data_index += 1
return data[data_index - 1]
}
// Draw the graphic out of `data` and `letter`.
//
draw :: proc() {
clear_line()
for data_index < data_len {
first_column := datum()
if first_column == EOL {
fmt.printfln("%s", line)
clear_line()
} else {
last_column := datum()
for column in first_column ..= last_column {
line[column] = letter[column % letters]
}
}
}
}
main :: proc() {
term.clear_screen()
print_credits()
term.clear_screen()
draw()
}
En Pike
#! /usr/bin/env pike
// Bunny
// Original version in BASIC:
// Creative Computing (Morristown, New Jersey, USA), 1978.
// This version in Pike:
// Copyright (c) 2025, Marcos Cruz (programandala.net)
// SPDX-License-Identifier: Fair
//
// Written on 2025-03-08.
//
// Last modified: 20250310T0301+0100.
void clear_screen() {
write("\x1B[0;0H\x1B[2J");
}
void press_enter(string prompt) {
write(prompt);
Stdio.stdin->gets();
}
void print_credits() {
write("Bunny\n\n");
write("Original version in BASIC:\n");
write(" Creative Computing (Morristown, New Jersey, USA), 1978.\n\n");
write("This version in Pike:\n");
write(" Copyright (c) 2025, Marcos Cruz (programandala.net)\n");
write(" SPDX-License-Identifier: Fair\n\n");
press_enter("Press Enter to start the program. ");
}
constant WIDTH = 53; // size of the line buffer
array(string) line = ({}); // line buffer
// Init the line buffer.
//
void init_line() {
for (int column = 0; column < WIDTH; column += 1) {
line += ({" "});
}
}
// Clear the line buffer with spaces.
//
void clear_line() {
for (int column = 0; column < WIDTH; column += 1) {
line[column] = " ";
}
}
array(string) letter = ({"B", "U", "N", "N", "Y"});
int LETTERS = sizeof(letter);
constant EOL = -1; // end of line identifier
array(int) data = ({
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL });
int data_index = 0;
int datum() {
return data[data_index++];
}
void draw() {
init_line();
while (data_index < sizeof(data)) {
int first_column = datum();
if (first_column == EOL) {
foreach(line, string c) {
write("%s", c);
}
write("\n");
clear_line();
} else {
int last_column = datum();
for (int column = first_column; column <= last_column; column += 1) {
line[column] = letter[column % LETTERS];
}
}
}
}
void main() {
clear_screen();
print_credits();
clear_screen();
draw();
}
En Python
# Bunny
# Original version in BASIC:
# Creative Computing (Morristown, New Jersey, USA), 1978.
# This version in Python:
# Copyright (c) 2024, Marcos Cruz (programandala.net)
# SPDX-License-Identifier: Fair
#
# Written on 2024-10-29.
#
# Last modified: 20241203T2229+0100.
import os
# Clear the terminal and move the cursor to the top left position.
def clear_screen():
if os.name == 'nt':
_ = os.system('cls')
else:
# on mac and linux, `os.name` is 'posix'
_ = os.system('clear')
# Clear the screen, print the credits and wait for the Enter key.
def print_credits():
print("Bunny\n")
print("Original version in BASIC:")
print(" Creative Computing (Morristown, New Jersey, USA), 1978.\n")
print("This version in Python:")
print(" Copyright (c) 2024, Marcos Cruz (programandala.net)")
print(" SPDX-License-Identifier: Fair\n")
print("Press Enter to start the program.")
input()
WIDTH = 53
# Print the given line buffer array.
def print_line(line):
for item in line:
print(item, end = "")
print()
EOL = -1 # end of line identifier
line = [] # line buffer
def init_line():
global line
line = []
for _ in range(0, WIDTH):
line.append(" ")
# Draw the graphic.
def draw():
global line
letter = ['B', 'U', 'N', 'N', 'Y']
LETTERS = len(letter)
data = [
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL ]
init_line()
data_index = 0
while data_index < len(data):
first_column = data[data_index]
data_index += 1
if first_column == EOL:
print_line(line)
init_line()
else:
last_column = data[data_index]
data_index += 1
for column in range(first_column, last_column + 1):
line[column] = letter[column % LETTERS]
clear_screen()
print_credits()
clear_screen()
draw()
En Raku
# Bunny
#
# Original version in BASIC:
# Creative Computing (Morristown, New Jersey, USA), 1978.
#
# This version in Raku:
# Copyright (c) 2024, Marcos Cruz (programandala.net)
# SPDX-License-Identifier: Fair
#
# Written on 2024-12-03.
#
# Last modified: 20241211T1235+0100.
sub clear_screen {
print "\e[0;0H\e[2J";
}
sub print_credits {
put "Bunny\n";
put 'Original version in BASIC:';
put " Creative Computing (Morristown, New Jersey, USA), 1978.\n";
put 'This version in Raku:';
put ' Copyright (c) 2024, Marcos Cruz (programandala.net)';
put " SPDX-License-Identifier: Fair\n";
prompt 'Press Enter to start the program. ';
}
constant $WIDTH = 53;
my $line = ' ' x $WIDTH;
constant LETTER = 'B', 'U', 'N', 'N', 'Y';
constant LETTERS = LETTER.elems;
constant EOL = -1; # end of line identifier;
constant DATA =
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL;
constant DATA_LEN = DATA.elems;
my $data_pointer = 0;
sub datum(--> Int) {
$data_pointer += 1;
return DATA[$data_pointer - 1];
}
sub draw {
while $data_pointer < DATA_LEN {
my $first_column = datum;
if $first_column == EOL {
put $line;
$line = ' ' x $WIDTH;
} else {
my $last_column = datum;
for $first_column .. $last_column -> $column {
$line.substr-rw($column, 1) = LETTER[$column % LETTERS];
}
}
}
}
clear_screen;
print_credits;
clear_screen;
draw;
En Ring
/*
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in Ring:
Copyright (c) 2024, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written on 2024-03-15.
Last modified: 20240318T1302+0100.
*/
EOL = -1 # end of line identifier
WIDTH = 53
SPACE = ' '
# Clear the terminal and move the cursor to the top left position.
func clearScreen()
system("clear")
end
# Clear the screen, print the credits and wait for the Enter key.
func printCredits()
print("Bunny\n\n")
print("Original version in BASIC:\n")
print(" Creative Computing (Morristown, New Jersey, USA), 1978.\n\n")
print("This version in Ring:\n")
print(" Copyright (c) 2024, Marcos Cruz (programandala.net)\n")
print(" SPDX-License-Identifier: Fair\n\n")
print("Press Enter to start the program.\n")
getString()
end
# Draw the graphic.
func draw()
letter = ['B', 'U', 'N', 'N', 'Y']
letters = len(letter)
data = [
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL ]
line = list(WIDTH) # line buffer
for x = 1 to WIDTH
line[x] = SPACE
end
dataIndex = 1
while dataIndex <= len(data)
firstColumn = data[dataIndex]
dataIndex += 1
if firstColumn = EOL
for x = 1 to WIDTH
print(line[x])
line[x] = SPACE
end
print(nl)
else
lastColumn = data[dataIndex]
dataIndex += 1
for column = firstColumn to lastColumn
line[column + 1] = letter[column % letters + 1]
end
end
end
end
func main
clearScreen()
printCredits()
clearScreen()
draw()
end
En Scala
/*
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in Scala:
Copyright (c) 2023, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written in 2023-08, 2023-09.
Last modified: 20231209T2009+0100.
*/
// Move the cursor to the top left position of the terminal.
def home() =
print("\u001B[H")
// Clear the terminal and move the cursor to the top left position.
def clearScreen() =
print("\u001B[2J")
home()
// Clear the screen, print the credits and wait for the Enter key.
def printCredits() =
clearScreen()
println("Bunny\n")
println("Original version in BASIC:")
println(" Creative Computing (Morristown, New Jersey, USA), 1978.\n")
println("This version in Scala:")
println(" Copyright (c) 2023, Marcos Cruz (programandala.net)")
println(" SPDX-License-Identifier: Fair\n")
println("Press Enter to start the program.")
io.StdIn.readLine("")
val Width = 53
var line = new Array[Int](Width) // buffer
// Clear the line buffer with spaces.
def clearLine() =
var column = 0
for column <- 0 until Width do
line(column) = ' '.toInt
val letter = Array('B', 'U', 'N', 'N', 'Y')
var letters = letter.length
val EOL : Int = -1 // end of line identifier
var data : Array[Int] = Array(
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL)
def printLine() =
for i <- line do
print(i.toChar)
println()
var dataIndex = 0
def datum() =
dataIndex += 1
data(dataIndex - 1)
// Draw the graphic out of `data` and `letter`.
def draw() =
clearScreen()
clearLine()
while dataIndex < data.length do
val firstColumn = datum()
if firstColumn == EOL then
printLine()
clearLine()
else
val lastColumn = datum()
for column <- firstColumn to lastColumn do
line(column) = letter(column % letters).toInt
@main def main() =
printCredits()
draw()
En Scheme
; Bunny
; Original version in BASIC:
; Creative Computing (Morristown, New Jersey, USA), ca. 1980.
; This version in Scheme (Bigloo):
; Copyright (c) 2025, Marcos Cruz (programandala.net)
; SPDX-License-Identifier: Fair
;
; Written on 2025-12-04.
;
; Last modified 20251224T1229+0100.
(module bunny)
(define (move-cursor-home)
(display "\x1B[H"))
(define (clear-screen)
(display "\x1B[2J")
(move-cursor-home))
(define (print-credits)
(display "Bunny\n\n")
(display "Original version in BASIC:\n")
(display " Creative Computing (Morristown, New Jersey, USA), 1978.\n\n")
(display "This version in Scheme (Bigloo):\n")
(display " Copyright (c) 2025, Marcos Cruz (programandala.net)\n")
(display " SPDX-License-Identifier: Fair\n\n")
(display "Press Enter to start the program.\n")
(read-line))
(define WIDTH 53)
(define line (make-string WIDTH #\space))
(define letters (list #\B #\U #\N #\N #\Y))
(define EOL 127) ; end of line identifier
(define DATA (list
1 2 EOL 0 2 45 50 EOL 0 5 43 52 EOL 0 7 41 52 EOL
1 9 37 50 EOL 2 11 36 50 EOL 3 13 34 49 EOL 4 14
32 48 EOL 5 15 31 47 EOL 6 16 30 45 EOL 7 17 29 44
EOL 8 19 28 43 EOL 9 20 27 41 EOL 10 21 26 40 EOL
11 22 25 38 EOL 12 22 24 36 EOL 13 34 EOL 14 33 EOL
15 31 EOL 17 29 EOL 18 27 EOL 19 26 EOL 16 28 EOL
13 30 EOL 11 31 EOL 10 32 EOL 8 33 EOL 7 34 EOL 6
13 16 34 EOL 5 12 16 35 EOL 4 12 16 35 EOL 3 12 15
35 EOL 2 35 EOL 1 35 EOL 2 34 EOL 3 34 EOL 4 33
EOL 6 33 EOL 10 32 34 34 EOL 14 17 19 25 28 31 35
35 EOL 15 19 23 30 36 36 EOL 14 18 21 21 24 30 37 37
EOL 13 18 23 29 33 38 EOL 12 29 31 33 EOL 11 13 17
17 19 19 22 22 24 31 EOL 10 11 17 18 22 22 24 24 29
29 EOL 22 23 26 29 EOL 27 29 EOL 28 29 EOL))
(define (string-with-replaced-char s position new-char)
(call-with-output-string
(lambda (out)
(display (substring s 0 position) out)
(display new-char out)
(display (substring s (+ position 1) (string-length s)) out))))
(define (letter column)
(list-ref letters (modulo column (length letters))))
(define (display-line)
(display line)
(newline)
(string-fill! line #\space))
(define (draw)
(let loop ((data-index 0))
(let ((first-column (list-ref DATA data-index)))
(if (= first-column EOL)
(display-line)
(begin
(set! data-index (+ data-index 1))
(let ((last-column (list-ref DATA data-index)))
(do ((column first-column (+ column 1))) ((>= column (+ last-column 1)))
(set! line (string-with-replaced-char line column (letter column)))))))
(when (< data-index (- (length DATA) 1))
(loop (+ data-index 1))))))
(clear-screen)
(print-credits)
(clear-screen)
(draw)
En Swift
/*
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in Swift:
Copyright (c) 2023, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written on 2023-11-03.
Last modified 20231103T1711+0100.
*/
// Move the cursor to the top left position of the terminal.
func home() {
print("\u{001B}[H", terminator: "")
}
// Clear the terminal and move the cursor to the top left position.
func clearScreen() {
print("\u{001B}[2J", terminator: "")
home()
}
// Print the credits and wait for a keypress.
func printCredits() {
print("Bunny\n")
print("Original version in BASIC:")
print(" Creative Computing (Morristown, New Jersey, USA), 1978.\n")
print("This version in Swift:")
print(" Copyright (c) 2023, Marcos Cruz (programandala.net)")
print(" SPDX-License-Identifier: Fair\n")
print("Press Enter to start the program.")
let _ = readLine()
}
let WIDTH = 53
let SPACE : Unicode.Scalar = " "
var line = Array<Unicode.Scalar>(repeating: SPACE, count: WIDTH)
// Clear the line buffer with spaces.
func clearLine() {
for column in 0 ..< line.count {
line[column] = SPACE
}
}
let letter : [Unicode.Scalar] = ["B", "U", "N", "N", "Y"]
let EOL : Int = -1 // end of line identifier
let data : [Int] = [
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL ]
var dataIndex = 0 // data pointer
func datum() -> Int {
dataIndex += 1
return data[dataIndex - 1]
}
func printLine() {
for character in line {
print(character, terminator: "")
}
print()
}
// Draw the graphic out of `data` and `letter`.
func draw() {
clearLine()
while dataIndex < data.count {
let firstColumn = datum()
if firstColumn == EOL {
printLine()
clearLine()
} else {
let lastColumn = datum()
for column in firstColumn ... lastColumn {
line[column] = letter[Int(column) % letter.count]
}
}
}
}
clearScreen()
printCredits()
clearScreen()
draw()
En V
/*
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in V:
Copyright (c) 2025, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written on 2025-01-03.
Last modified: 20250406T0130+0200.
*/
import os
import term
fn print_credits() {
println('Bunny\n')
println('Original version in BASIC:')
println(' Creative Computing (Morristown, New Jersey, USA), 1978.\n')
println('This version in V:')
println(' Copyright (c) 2025, Marcos Cruz (programandala.net)')
println(' SPDX-License-Identifier: Fair\n')
print('Press Enter to start the program. ')
os.input('')
}
const width = 53
const letter = [`B`, `U`, `N`, `N`, `Y`]
const eol = -1 // end of line identifier
// vfmt off
const data = [
1, 2, eol, 0, 2, 45, 50, eol, 0, 5, 43, 52, eol, 0, 7, 41, 52, eol, 1, 9,
37, 50, eol, 2, 11, 36, 50, eol, 3, 13, 34, 49, eol, 4, 14, 32, 48, eol, 5,
15, 31, 47, eol, 6, 16, 30, 45, eol, 7, 17, 29, 44, eol, 8, 19, 28, 43,
eol, 9, 20, 27, 41, eol, 10, 21, 26, 40, eol, 11, 22, 25, 38, eol, 12, 22,
24, 36, eol, 13, 34, eol, 14, 33, eol, 15, 31, eol, 17, 29, eol, 18, 27,
eol, 19, 26, eol, 16, 28, eol, 13, 30, eol, 11, 31, eol, 10, 32, eol, 8,
33, eol, 7, 34, eol, 6, 13, 16, 34, eol, 5, 12, 16, 35, eol, 4, 12, 16, 35,
eol, 3, 12, 15, 35, eol, 2, 35, eol, 1, 35, eol, 2, 34, eol, 3, 34, eol, 4,
33, eol, 6, 33, eol, 10, 32, 34, 34, eol, 14, 17, 19, 25, 28, 31, 35, 35,
eol, 15, 19, 23, 30, 36, 36, eol, 14, 18, 21, 21, 24, 30, 37, 37, eol, 13,
18, 23, 29, 33, 38, eol, 12, 29, 31, 33, eol, 11, 13, 17, 17, 19, 19, 22,
22, 24, 31, eol, 10, 11, 17, 18, 22, 22, 24, 24, 29, 29, eol, 22, 23, 26,
29, eol, 27, 29, eol, 28, 29, eol, ]
// vfmt on
fn clear_line(mut line []int) {
for column in 0 .. line.len {
line[column] = int(` `)
}
}
fn draw() {
mut data_index := 0
mut line := []int{len: width}
clear_line(mut line)
for data_index < data.len {
first_column := data[data_index]
data_index += 1
if first_column == eol {
for i in line {
print(rune(i))
}
println('')
clear_line(mut line)
} else {
last_column := data[data_index]
data_index += 1
for column := first_column; column <= last_column; column++ {
line[column] = int(letter[column % letter.len])
}
}
}
}
fn main() {
term.clear()
print_credits()
term.clear()
draw()
}
En Vala
/*
Bunny
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), 1978.
This version in Vala:
Copyright (c) 2023, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written in 2023-08-31.
Last modified 20231103T2132+0100.
*/
// Erase the screen, reset the attributes and move the cursor to the home position.
void clear_screen() {
print("\x1B[2J\x1B[0m\x1B[H");
}
// Print the credits and wait for a keypress.
void print_credits() {
print("Bunny\n\n");
print("Original version in BASIC:\n");
print(" Creative Computing (Morristown, New Jersey, USA), 1978.\n\n");
print("This version in Vala:\n");
print(" Copyright (c) 2023, Marcos Cruz (programandala.net)\n");
print(" SPDX-License-Identifier: Fair\n\n");
print("Press Enter to start the program.\n");
stdin.read_line();
}
const int WIDTH = 53;
unichar line[WIDTH]; // buffer
int col; // `line` index
// Clear the line buffer with spaces.
void clear_line() {
for (int c = 0; c < WIDTH; c++) {
line[c] = ' ';
}
col = 0;
}
// Print the line buffer.
void print_line() {
for (int c = 0; c < WIDTH; c++) {
print(line[c].to_string());
}
print("\n");
}
const string LETTER = "BUNNY"; // letters pattern
const int EOL = -1; // end of line identifier
const int[] data = {
1, 2, EOL, 0, 2, 45, 50, EOL, 0, 5, 43, 52, EOL, 0, 7, 41, 52, EOL,
1, 9, 37, 50, EOL, 2, 11, 36, 50, EOL, 3, 13, 34, 49, EOL, 4, 14,
32, 48, EOL, 5, 15, 31, 47, EOL, 6, 16, 30, 45, EOL, 7, 17, 29, 44,
EOL, 8, 19, 28, 43, EOL, 9, 20, 27, 41, EOL, 10, 21, 26, 40, EOL,
11, 22, 25, 38, EOL, 12, 22, 24, 36, EOL, 13, 34, EOL, 14, 33, EOL,
15, 31, EOL, 17, 29, EOL, 18, 27, EOL, 19, 26, EOL, 16, 28, EOL,
13, 30, EOL, 11, 31, EOL, 10, 32, EOL, 8, 33, EOL, 7, 34, EOL, 6,
13, 16, 34, EOL, 5, 12, 16, 35, EOL, 4, 12, 16, 35, EOL, 3, 12, 15,
35, EOL, 2, 35, EOL, 1, 35, EOL, 2, 34, EOL, 3, 34, EOL, 4, 33,
EOL, 6, 33, EOL, 10, 32, 34, 34, EOL, 14, 17, 19, 25, 28, 31, 35,
35, EOL, 15, 19, 23, 30, 36, 36, EOL, 14, 18, 21, 21, 24, 30, 37, 37,
EOL, 13, 18, 23, 29, 33, 38, EOL, 12, 29, 31, 33, EOL, 11, 13, 17,
17, 19, 19, 22, 22, 24, 31, EOL, 10, 11, 17, 18, 22, 22, 24, 24, 29,
29, EOL, 22, 23, 26, 29, EOL, 27, 29, EOL, 28, 29, EOL };
const uint DATA_LEN = data.length;
// Draw the graphic out of `data` and `LETTER`.
void draw() {
uint letters = LETTER.length;
int to_col; // last col to print to
uint d = 0; // data pointer
clear_line();
while (d < DATA_LEN) {
col = data[d];
d += 1;
if (col == EOL) {
print_line();
clear_line();
} else {
to_col = data[d];
d += 1;
for (int c = col; c <= to_col; c++) {
line[c] = LETTER[c % letters];
}
}
}
}
void main() {
clear_screen();
print_credits();
clear_screen();
draw();
}
