Revised Abacus Encoder Project in the C Programming Language

Hello World! Today’s date in abacus format is “(🍌🍎🍎🍏🍏)(🍌🍎🍎🍏🍏)(🍍🍎🍏🍏🍏 )(🍌🍎🍎🍏🍏)(🍌🍏🍏🍏🍏)(🍌🍎🍎🍏🍏)(🍌🍎🍎🍏🍏)”. ☺️

Today, I’m celebrating 33.30 years of Computer Programming in the C Programming Language! Currently, I have been programming in C on my iPhone for 2.77 years now using my 3.62 year-old Bluetooth QWERTY keyboard!

Surprisingly, despite I have been totally BLIND since December 2017, I am ABLE to still write “code snippets” in the C programming language.

// Filename: AbacusEncoder.c
// Encodes a whole number up to 15 digits into equivalent abacus rods.
// Output is text-based for console.

// Notice: Compiler errors exist!

#include<stdio.h>

int abacus(long);

int main(){

// For debugging purposes:
int DEBUG = 0;

long number, digit, divider;
int show = 0;

// Number to Encode
number = 2262022;

divider = 10;
for(int z = 1; z < 15; z++) {
divider *= 10;
}

while(divider != 0) {

if(number > divider) {
digit = (int)(number / divider);
number = number - (digit * divider);

if(DEBUG) {
printf("%d, ", (int)digit);
}
else abacus(digit);

show = 1;

}
else if(show) {
digit = 0;

if(DEBUG) {
printf("%d, ", (int)digit);
}
else abacus(digit);

}
divider /= 10;
}

return 0;

}

abacus(long a) {

printf("(");

if(a < 5) printf("🍌");
else {
printf("🍍");
a = a - 5;
}

switch(a) {
case 0:
printf("🍏🍏🍏🍏");
break;

case 1:
printf("🍎🍏🍏🍏 ");
break;

case 2:
printf("🍎🍎🍏🍏");
break;

case 3:
printf("🍎🍎🍎🍏");
break;

case 4:
printf("🍎🍎🍎🍎");
break;

default:
printf("ERROR!");
break;
}

printf(")");

}

The above source code, I’ve coded in the C programming language, is merely a slight revision of my original code on January 8th. This code outputs fruits instead of numbers. ☺️

Interestingly, prior to mid-December 2021, I did not know how an abacus is used for numerical calculations. Since I’m BLIND, and I’ve researched other BLIND persons using the Cranmer Abacus, I decided to “dive” into something I had never used before. Before beginning my abacus project, I researched Bookshare for suitable, accessible books I can, or at least, try to learn from, but I quickly realized, I required the real thing! So I purchased my Cranmer Abacus from the Resources for the Blind, Inc (RBI), here in the Philippines.

After reading, or I mean, listening to a variety of eBooks and web pages, only to confuse me, I had to remember that I am still a computer programmer and computer scientist, despite I no longer have eyesight, so I forced my specialty skills in developing an abacus encoder program, and I successfully did it! This is how I self-learned the abacus! ☺️

Prior to developing my C computer program, I had found abacus apps in the Apple App Store, including one that talks, but all I’ve tested were inaccessible with iOS Voiceover screenreader. Therefore, I had no other choice than to code the computer program I required. ☺️

For those that wish for me to flourish as a totally BLIND computer programmer of the C programming language, I do wish for a desktop or laptop computer, so I would not need to depend on a remotely-networked compiler, however, my purchase of my Apple iPhone 12 mini smartphone keeps me glued to a networked compiler. I could use a Mac Mini with Xcode or Windows PC with Visual Studio or GNU/Linux with GCC, as long as I’m able to take advantage of a talking screenreader, like I’m doing with my mobile devices. I also self-taught myself the basics of the Swift programming language. ☺️

Thanks for reading my latest blog post! Have a Great Day!

🇵🇭🇺🇸👨‍🦯🦽 📱⌨️📻🎧 📚🪀🧮

Leave a Comment