BounceFuck: Simple Addition

The following BounceFuck code makes a very simple addition-only calculator. It can add numbers between 0 and 9 as long as the sum is less than 10. The two numbers are taken as arguments.

1
2
3
4
5
6
7
8
9
10
/+|+!,O!O!}+|
}/+{  \O/\/\/\/\
+}O$,!+-----\+++\
!\/ --/-----/+++/
O! /}}\-----\+++\
+\<-/+/-----/+++/
+/\ {\\-----\+++\
+++^\{ \/\/\/+++/
++\+O\!\! |\/\/ 
\/   Q    /.+++/

The first part takes the two arguments and subtracts 48 (the ASCII number for 0) from both of them. This leaves us with their numerical values in the first and second cells. After this, two loops transfer first the second cell and then the first cell to the third cell. 48 is added again to the third cell, and the result is printed.

Maybe Related?

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

FireStats iconAnvänder FireStats