Wherein I say something

“Something.”  Hah, hah, fooled you!

Seriously though, it’s been a few months since I set this thing up, so I figured I had better post something before they delete the account for inactivity.

What have I been doing all this time?  Getting closer to death, for one.  Hmm, that about sums it up.  No, I have been doing something constructive (for certain small values of “constructive”):  I have been going back and redoing all of my Project Euler problems.

For those of you who don’t know what Project Euler is, I’m not going to bother explaining it.  The rest of you may ask, “Why redo them?”  Because I’ve been playing around with FreeBASIC and I wanted to try out my programming chops using it.  Yeah, yeah, I know BASIC is a toy language and that serious programmers don’t use it.  It’s a good thing, then, that FB is an extended version of QuickBASIC, which itself I don’t really consider a “true” BASIC.  BASIC uses line numbers and GOTOs, people.  FB (and QB) may use the same keywords, but I do not consider either of them (or VisualBASIC) as BASICs.  Having said all of that, and powerful as FB is, it is still crippled by its forced “backwards-compatibility” with its true BASIC ancestors.  In other words, it’s much better than BASIC but still not an ideal programming language.

Why use it then?  For one, it’s free.  As in “Free”-BASIC, get it?  Two, it produces native 32-bit code.  Three, it has a true 64-bit integer type.  Four, it allows the use of inline assembler using Intel syntax.  (See here.)  The Pascal compiler I have been using produces 32-bit code, but that code is in a 16-bit DOS executable with a DOS extender.  I’ve looked at FreePascal, and it’s pretty good, but it has some shortcomings:  even though it is a 32-bit compiler, Integers are still 16-bit by default; there is no native 64-bit integer type; there is no GUI IDE; worst of all, inline assembler requires AT&T syntax!.  (Note:  I haven’t looked at FP in a long time; some of those problems may have gone away since then.)

So along the way I’ve learned quite a bit about how to properly program in FB, although there are still some things which elude me.  Hopefully I’ll be able to pick up those things if I keep at it.

As a historical note, when I first started Project Euler (PE from now on), I used Turbo Pascal 6.  That is a DOS-based 16-bit compiler with a 64KB limit on variables.  That’s total, not each!  You can use the heap to create dynamic variables, but they are all limited to 64K each, and the heap itself only uses base memory so its maximum size is about 600KB.  It was easy enough to solve all of the simple problems with it, but when I started encountering problems that simply required buffers and variables in the multi-megabyte range, I moved on.

Another reason I have been redoing PE problems is that I’ve pretty much gone as far as I can go with it.  I’ve solved 213 out of 556 (as of today) problems, and I don’t think I can solve very many more, if any, without outside help.  In other words, I’ve solved all of the easy and middling problems.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s