• Published on | Mar 12, 2008 | by FozzTexx

Roman numerals and back again

Remember way way way way back in the days of the Apple ][, one of the magazines used to have a contest to write one and two line programs in Applesoft BASIC that did neat things? I think it was Nibble, but I'm not positive. Well anyways, here's a program that I wrote that I should have entered, but never did.

The reason I wrote it was because at the time, one of the Apple ][ magazines had included a sample program listing that would convert decimal numbers to roman numerals, as well do the opposite, convert roman to decimal. I was appalled by how long the program was, it went on for page after page after page. It seemed to me it could have been much much shorter. And so there was the challenge.

It turns out I was able to condense the whole thing down into two lines. Yes two! And it still accepts either a roman numeral or a decimal number, and converts it to the other. Sorry about the listing, it was a struggle to get the emulator to even cooperate enough to get the file transferred and get a listing.

I dug this program out because I need a quick & dirty converter for a new program and I thought I'd take a look to see how I did it and how I got it so small. Unfortunately it looks like I used a lot of dirty Applesoft tricks so the code isn't all that re-usable. Oh well, it's still cool.

Join The Discussion