Skip to content

Instantly share code, notes, and snippets.

@RocketRace
Created July 29, 2020 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RocketRace/9e090babcf04e44597ce2326536eaadf to your computer and use it in GitHub Desktop.
Save RocketRace/9e090babcf04e44597ce2326536eaadf to your computer and use it in GitHub Desktop.
"99 bottles of beer on the wall" written in Babalang. Courtesy of FLeckami#3853 (@691193184251805774) on Discord!
// 99 bottles of beer in babalang
//define variables and create some sentences
// string numbers
0_str is you and move and more and move and more and more and more and more
1_str is 0_str and move
2_str is 1_str and move
3_str is 2_str and move
4_str is 3_str and move
5_str is 4_str and move
6_str is 5_str and move
7_str is 6_str and move
8_str is 7_str and move
9_str is 8_str and move
// numbers
1 is you and move
2 is 1 and 1
3 is 2 and 1
4 is 2 and 2
5 is 3 and 2
6 is 3 and 3
7 is 4 and 3
8 is 4 and 4
9 is 5 and 4
10 is 5 and 5
20 is 10 and 10
30 is 20 and 10
40 is 20 and 20
50 is 30 and 20
60 is 30 and 30
70 is 40 and 30
80 is 40 and 40
90 is 50 and 40
99 is 90 and 9
//letters
a is 99 and not 2
b is a and move
d is b and move and move
e is d and move
f is e and move
h is f and move and move
i is h and move
k is i and move and move
l is k and move
m is l and move
n is m and move
o is n and move
p is o and move
r is p and move and move
s is r and move
t is s and move
u is t and move
w is u and move and move
y is w and move and move
ug is 70 and 1
un is ug and move and move and move and move and move and move and move
ut is un and move and move and move and move and move and move
comma is 40 and 4
point is comma and move and move
space is 30 and 2
newline is 10
// words
bottles is group
bottles has b and o and t and t and l and e and s
of is group
of has o and f
beer is group
beer has b and e and e and r
s_on is group
s_on has o and n
the is group
the has t and h and e
wall is group
wall has w and a and l and l
take is group
take has t and a and k and e
one is group
one has o and n and e
s_down is group
s_down has d and o and w and n
pass is group
pass has p and a and s and s
it is group
it has i and t
around is group
around has a and r and o and u and n and d
no_more is group
no_more has n and o and space and m and o and r and e
go_to is group
go_to has ug and o and space and t and o
store is group
store has s and t and o and r and e
buy is group
buy has b and u and y
some is group
some has s and o and m and e
s_more is group
s_more has m and o and r and e
s_and is group
s_and has a and n and d
// sentences
bottles_of_beer is group
bottles_of_beer has bottles and space and of and space and beer
on_the_wall is group
on_the_wall has s_on and space and the and space and wall
take_one_down is group
take_one_down has take and space and one and space and s_down
pass_it_around is group
pass_it_around has pass and space and it and space and around
go_to_the_store is group
go_to_the_store has go_to and space and the and space and store
buy_some_more is group
buy_some_more has buy and space and some and space and s_more
// ord function (number -> string)
ord is level and has input
print_zero is you
input is right
is0 is tele
not lonely input fear is0
no_more is text
ord make empty
is0 is done
match_10s is tele
// input >= 90 => print "9"
case_90 is tele
input facing 90 fear case_90
9_str is text
input is input and not 90
print_zero is move
input fear match_10s
case_90 is done
// input >= 80 => print "8"
case_80 is tele
input facing 80 fear case_80
8_str is text
input is input and not 80
print_zero is move
input fear match_10s
case_80 is done
// input >= 70 => print "7"
case_70 is tele
input facing 70 fear case_70
7_str is text
input is input and not 70
print_zero is move
input fear match_10s
case_70 is done
// input >= 60 => print "6"
case_60 is tele
input facing 60 fear case_60
6_str is text
input is input and not 60
print_zero is move
input fear match_10s
case_60 is done
// input >= 50 => print "5"
case_50 is tele
input facing 50 fear case_50
5_str is text
input is input and not 50
print_zero is move
input fear match_10s
case_50 is done
// input >= 40 => print "4"
case_40 is tele
input facing 40 fear case_40
4_str is text
input is input and not 40
print_zero is move
input fear match_10s
case_40 is done
// input >= 30 => print "3"
case_30 is tele
input facing 30 fear case_30
3_str is text
input is input and not 30
print_zero is move
input fear match_10s
case_30 is done
// input >= 20 => print "2"
case_20 is tele
input facing 20 fear case_20
2_str is text
input is input and not 20
print_zero is move
input fear match_10s
case_20 is done
// input >= 10 => print "1"
case_10 is tele
input facing 10 fear case_10
1_str is text
input is input and not 10
input fear match_10s
case_10 is done
// print "0" if print_zero is set
lonely print_zero fear match_10s
0_str is text
input fear match_10s
match_10s is done
// match over the 1s digit
match_1s is tele
// input >= 9 => print "9"
case_9 is tele
input facing 9 fear case_9
9_str is text
input fear match_1s
case_9 is done
// input >= 8 => print "8"
case_8 is tele
input facing 8 fear case_8
8_str is text
input fear match_1s
case_8 is done
// input >= 7 => print "7"
case_7 is tele
input facing 7 fear case_7
7_str is text
input fear match_1s
case_7 is done
// input >= 6 => print "6"
case_6 is tele
input facing 6 fear case_6
6_str is text
input fear match_1s
case_6 is done
// input >= 5 => print "5"
case_5 is tele
input facing 5 fear case_5
5_str is text
input fear match_1s
case_5 is done
// input >= 4 => print "4"
case_4 is tele
input facing 4 fear case_4
4_str is text
input fear match_1s
case_4 is done
// input >= 3 => print "3"
case_3 is tele
input facing 3 fear case_3
3_str is text
input fear match_1s
case_3 is done
// input >= 2 => print "2"
case_2 is tele
input facing 2 fear case_2
2_str is text
input fear match_1s
case_2 is done
// input >= 1 => print "1"
case_1 is tele
input facing 1 fear case_1
1_str is text
input fear match_1s
case_1 is done
0_str is text
input fear match_1s
match_1s is done
// ord implicitly returns empty
ord is done
// main program
baba is 99
ice is tele
is1 is tele // execute this bloc if baba x position is 1
baba is baba and not 1
not lonely baba fear is1
bottles is sink
bottles_of_beer is empty
bottles_of_beer is group
bottles_of_beer has bottles and space and of and space and beer
baba fear is1
is1 is done
baba is baba and 1
num is ord
num has baba and is power
space is text
bottles_of_beer is text
space is text
on_the_wall is text
comma is text
space is text
num is ord
num has baba and is power
space is text
bottles_of_beer is text
point is text
newline is text
take_one_down is text
space is text
s_and is text
space is text
pass_it_around is text
baba is baba and not 1
is0 is tele // execute this bloc if baba x position is 0
not lonely baba fear is0
bottles has s
bottles_of_beer is empty
bottles_of_beer is group
bottles_of_beer has bottles and space and of and space and beer
baba fear is0
is0 is done
comma is text
space is text
num is ord
num has baba and is power
space is text
bottles_of_beer is text
space is text
on_the_wall is text
point is text
newline is text
newline is text
lonely baba fear ice
ice is done
no_more has un
no_more is swap
no_more is sink
num is ord
num has baba and is power
space is text
bottles_of_beer is text
space is text
on_the_wall is text
comma is text
space is text
no_more has n
no_more is swap
no_more is sink
num is ord
num has baba and is power
space is text
bottles_of_beer is text
point is text
newline is text
go_to_the_store is text
space is text
s_and is text
space is text
buy_some_more is text
comma is text
space is text
num is ord
num has 99 and is power
space is text
bottles_of_beer is text
space is text
on_the_wall is text
point is text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment