Skip to content

Instantly share code, notes, and snippets.

@Kantoros1
Last active August 18, 2021 10:04
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 Kantoros1/0b15df3a84efe7adfd33aa7bfce60b11 to your computer and use it in GitHub Desktop.
Save Kantoros1/0b15df3a84efe7adfd33aa7bfce60b11 to your computer and use it in GitHub Desktop.
99 bottles of beer program written in NDBall. 445 Instructions, 4 Dimensions.
/ Writing phase
/ - 9 Strings are created and saved into string memories
/
(0) >0
(1) +
(2) Y[31,<0,>0]
(3) +
(4) >1
(4,1) <0
(3,1) n
/ " bottle"
(2,1) St[1]
(1,1) p
(0,1) >1
(0,2) >0
(1,2) +
(2,2) Y[97,<0,>0]
(3,2) +
(4,2) >1
(4,3) <0
(3,3) p
(2,3) <0
(1,3) +
(0,3) Y[111,>0,>1]
(0,4) >0
(1,4) p
(2,4) >0
(3,4) +
(4,4) Y[116,<0,>2]
(4,4,1) <0
(3,4,1) p
(2,4,1) p
(1,4,1) -
(0,4,1) <1
(0,3,1) >0
(1,3,1) -
(2,3,1) Y[109,>0,<0]
(3,3,1) p
(4,3,1) <1
(4,2,1) <0
(3,2,1) -
(2,2,1) Y[102,<0,>0]
(1,2,1) p
(0,2,1) <1
(0,1,1) >0
(1,1,1) +
(2,1,1) Y[114,<0,>0]
/ "s"
(3,1,1) St[2]
(4,1,1) <1
(4,0,1) <0
(3,0,1) +
(2,0,1) p
(1,0,1) H
(0,0,1) >2
(0,0,2) >0
/ " of beer"
(1,0,2) St[3]
(2,0,2) p
/ (3,0,2) Is empty
(4,0,2) >1
(4,1,2) <0
(3,1,2) +
(2,1,2) Y[111,>0,<0]
(1,1,2) p
(0,1,2) >1
(0,2,2) >0
(1,2,2) -
(2,2,2) Y[103,>0,<0]
(3,2,2) p
(4,2,2) >1
(4,3,2) <0
(3,3,2) H
(2,3,2) p
(1,3,2) +
(0,3,2) >1
(0,4,2) >0
(1,4,2) +
(2,4,2) Y[98,<0,>0]
(3,4,2) p
(4,4,2) >2
(4,4,3) <0
(3,4,3) +
(2,4,3) Y[101,>0,<0]
(1,4,3) p
(0,4,3) <1
(0,3,3) >0
(1,3,3) p
(2,3,3) >0
(3,3,3) +
(4,3,3) Y[114,<0,<1]
(4,2,3) <0
(3,2,3) p
/ " on the wall"
(2,2,3) St[4]
(1,2,3) H
(0,2,3) <1
(0,1,3) >0
(1,1,3) p
(2,1,3) >0
(3,1,3) +
(4,1,3) Y[111,<0,<1]
(4,0,3) <0
(3,0,3) p
(2,0,3) -
(1,0,3) p
(0,0,3) >2
(0,0,4) >0
(1,0,4) H
(2,0,4) p
(3,0,4) +
(4,0,4) >1
(4,1,4) <0
(3,1,4) +
(2,1,4) Y[116,>0,<0]
(1,1,4) p
(0,1,4) >1
(0,2,4) >0
(1,2,4) -
(2,2,4) Y[106,>0,<0]
(3,2,4) -
(4,2,4) >1
(4,3,4) <0
(3,3,4) p
(2,3,4) <0
(1,3,4) -
(0,3,4) Y[102,>1,>0]
(0,4,4) >0
(1,4,4) p
(2,4,4) H
(3,4,4) p
(4,4,4) >3
(4,4,4,1) <0
(3,4,4,1) +
(2,4,4,1) Y[119,>0,<0]
(1,4,4,1) p
(0,4,4,1) <1
(0,3,4,1) >0
(1,3,4,1) -
(2,3,4,1) Y[99,>0,<0]
(3,3,4,1) -
(4,3,4,1) <1
(4,2,4,1) <0
(3,2,4,1) p
(2,2,4,1) <0
(1,2,4,1) +
(0,2,4,1) Y[108,>0,<1]
(0,1,4,1) >0
(1,1,4,1) p
(2,1,4,1) p
/ ", "
(3,1,4,1) St[5]
(4,1,4,1) <1
(4,0,4,1) <0
(3,0,4,1) -
(2,0,4,1) <0
(1,0,4,1) -
(0,0,4,1) Y[46,<2,>0]
(0,0,3,1) >0
(1,0,3,1) p
(2,0,3,1) H
(3,0,3,1) p
(4,0,3,1) >1
(4,1,3,1) <0
(3,1,3,1) +
(2,1,3,1) Y[45,>0,<0]
(1,1,3,1) +
(0,1,3,1) >1
(0,2,3,1) >0
/ ".\n"
(1,2,3,1) St[6]
(2,2,3,1) p
(3,2,3,1) -
(4,2,3,1) >1
(4,3,3,1) <0
(3,3,3,1) -
(2,3,3,1) Y[11,<0,>0]
(1,3,3,1) p
(0,3,3,1) >1
(0,4,3,1) >0
/ "\n"
(1,4,3,1) St[7]
(2,4,3,1) p
(3,4,3,1) +
(4,4,3,1) <2
(4,4,2,1) <0
(3,4,2,1) +
(2,4,2,1) Y[84,>0,<0]
/ "Take one down and pass it around, "
(1,4,2,1) St[8]
(0,4,2,1) <1
(0,3,2,1) >0
(1,3,2,1) p
(2,3,2,1) >0
(3,3,2,1) +
(4,3,2,1) Y[97,<0,<1]
(4,2,2,1) <0
(3,2,2,1) p
(2,2,2,1) <0
(1,2,2,1) +
(0,2,2,1) Y[105,>0,<1]
(0,1,2,1) >0
(1,1,2,1) +
(2,1,2,1) p
(3,1,2,1) -
(4,1,2,1) <1
(4,0,2,1) <0
(3,0,2,1) -
(2,0,2,1) Y[102,<0,>0]
(1,0,2,1) p
(0,0,2,1) <2
(0,0,1,1) >0
(1,0,1,1) H
(2,0,1,1) p
/ (3,0,1,1) Is empty
(4,0,1,1) >1
(4,1,1,1) <0
(3,1,1,1) +
(2,1,1,1) Y[111,>0,<0]
(1,1,1,1) p
(0,1,1,1) >1
(0,2,1,1) >0
(1,2,1,1) -
(2,2,1,1) p
/ (3,2,1,1) Is empty
(4,2,1,1) >1
(4,3,1,1) <0
(3,3,1,1) -
(2,3,1,1) Y[102,<0,>0]
(1,3,1,1) p
(0,3,1,1) >1
(0,4,1,1) >0
(1,4,1,1) H
(2,4,1,1) p
(3,4,1,1) +
(4,4,1,1) <2
(4,4,0,1) <0
(3,4,0,1) +
(2,4,0,1) Y[100,>0,<0]
(1,4,0,1) p
(0,4,0,1) <1
(0,3,0,1) >0
(1,3,0,1) +
(2,3,0,1) Y[111,<0,>0]
(3,3,0,1) p
(4,3,0,1) <1
(4,2,0,1) <0
(3,2,0,1) +
(2,2,0,1) Y[118,>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0,4,3) +
/ (2,0,4,3) Is empty
/ (1,0,4,3) Is empty
(0,0,4,3) <2
/
/ Printing phase
/ - Strings are printed in order:
/ - n 1 (2) 3 4 5 n 1 (2) 3 6 8 [n-1/9] 1 (2) 2 4 6 7
/
(0,0,3,3) >0
(1,0,3,3) P
(2,0,3,3) PSt[1]
(3,0,3,3) Y[2,>1,>0]
(4,0,3,3) >1
(4,1,3,3) PSt[2]
/ (3,1,3,3) Is empty
(3,2,3,3) >0
(4,2,3,3) >1
(4,3,3,3) PSt[3]
(4,4,3,3) <0
(3,4,3,3) PSt[4]
(2,4,3,3) PSt[5]
(1,4,3,3) P
(0,4,3,3) <1
(0,3,3,3) PSt[1]
(0,2,3,3) Y[2,>0,<1]
(0,1,3,3) >0
(1,1,3,3) PSt[2]
/ (1,2,3,3) Is empty
(2,2,3,3) <1
(2,1,3,3) <2
(2,1,2,3) >0
(3,1,2,3) PSt[3]
(4,1,2,3) >1
(4,2,2,3) PSt[6]
(4,3,2,3) PSt[8]
(4,4,2,3) <0
(3,4,2,3) -
(2,4,2,3) Y[1,<1,<0]
(1,4,2,3) P
(0,4,2,3) <1
(2,3,2,3) <0
(1,3,2,3) PSt[9]
(0,3,2,3) <1
(0,2,2,3) PSt[1]
(0,1,2,3) <2
(0,1,1,3) Y[2,>0,>1]
(0,2,1,3) >0
(1,1,1,3) Y[1,>1,>0]
(1,2,1,3) >0
/ (2,1,1,3) Is empty
(2,2,1,3) PSt[2]
(3,1,1,3) PSt[3]
(3,2,1,3) PSt[3]
(4,1,1,3) <1
(4,2,1,3) <1
(4,0,1,3) <0
(3,0,1,3) PSt[4]
(2,0,1,3) PSt[6]
(1,0,1,3) Y[1,>2,<0]
(0,0,1,3) >2
(0,0,2,3) PSt[7]
(1,0,2,3) E
@david-prv
Copy link

just awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment