Jump to content
Sign in to follow this  
TheHoboInYourRoom

Basic Programming curiosities

Recommended Posts

There have been quite a few Basic Programming threads in this forum, but the last one hasn't been updated for about half a year and there's no point in bumping it.

 

Anyway, I'm curious to know what sorts of simple but interesting routines some of you have written for this cartridge. I'm not asking for games or music; Dave Britten has those pretty well covered. Rather, I'm more interested in algorithms of a more mathematical or computer science flavor. I'm certainly not expecting an implementation of quicksort, but if it can be done in 63 bytes or fewer in a mangled language, somehow, I'm interested.

 

For example, I've implemented the Collatz algorithm (single-digit input only, unfortunately):

 

1 If S>0 Then Goto 3

2 S<-Key Goto 1

3 If S Mod 2=0 Then S<-S/2 Goto 3

4 If S=1 Then Goto 4

5 S<-S*3+1 Goto 3

 

Let's see what you've got. :)

Share this post


Link to post
Share on other sites

There have been quite a few Basic Programming threads in this forum, but the last one hasn't been updated for about half a year and there's no point in bumping it.

 

Anyway, I'm curious to know what sorts of simple but interesting routines some of you have written for this cartridge. I'm not asking for games or music; Dave Britten has those pretty well covered. Rather, I'm more interested in algorithms of a more mathematical or computer science flavor. I'm certainly not expecting an implementation of quicksort, but if it can be done in 63 bytes or fewer in a mangled language, somehow, I'm interested.

 

For example, I've implemented the Collatz algorithm (single-digit input only, unfortunately):

 

1 If S>0 Then Goto 3

2 S<-Key Goto 1

3 If S Mod 2=0 Then S<-S/2 Goto 3

4 If S=1 Then Goto 4

5 S<-S*3+1 Goto 3

 

Let's see what you've got. :)

Very interesting, I never heard of Collatz algorithm. After a quick google your program makes sense! Now that I have a Harmony, maybe I'ss give it a try since I've never found a Basic cart.

Share this post


Link to post
Share on other sites

Very interesting, I never heard of Collatz algorithm. After a quick google your program makes sense! Now that I have a Harmony, maybe I'ss give it a try since I've never found a Basic cart.

Yeah, give it a go. Basic Programming really is more interesting than a lot of people give it credit for. It's still very limiting, of course.

 

 

 

Oh, and...

I'm certainly not expecting an implementation of quicksort, but if it can be done in 63 bytes or fewer in a mangled language, somehow, I'm interested.

I worded this really badly. The second half of that sentence isn't supposed to refer to quicksort, but to any math or CS routine in general.

Share this post


Link to post
Share on other sites

Seems like anyone interested in the Basic Programming cartridge would quickly lose interest after knowing that they can make better Atari 2600 programs with batari Basic.

 

Do you think that's where most Basic Programming cartridge users ran to?

Share this post


Link to post
Share on other sites

No, they had gone to other computers. bBasic didn't exist. ;)

 

 

Whether you like or dislike BASIC Programming, it was a pretty good trick for it's time. Squeezing the interpreter down to 4k (which is more like 2.5k if you don't count all the bitmaps and the display kernel that much larger BASIC's don't need to worry about), and still ending up with enough native resources to create a running program is a challenge that very few programmers would take.

  • Like 1

Share this post


Link to post
Share on other sites
No, they had gone to other computers. bBasic didn't exist. ;)

You know I meant 21st century users, you stinky-butt doo-doo head. :D

Share this post


Link to post
Share on other sites
No, they had gone to other computers. bBasic didn't exist. ;)

You know I meant 21st century users, you stinky-butt doo-doo head. :D

HEY, I RESEMBLE THAT REMARK. ;)

Aren't we all 21st century users...

And all using a 30+ year old video COMPUTER system!

 

But with bBasic, and/or the harmony cart. It would be neat if you could use "Basic Programming" that would read the program from ROM. You could create the program externally, enter it into a rom, then play that bin on an emulator or harmony. So you could have in a way a method of saving your work, all 63 bytes of it.

Share this post


Link to post
Share on other sites
No, they had gone to other computers. bBasic didn't exist. ;)

You know I meant 21st century users, you stinky-butt doo-doo head. :D

HEY, I RESEMBLE THAT REMARK. ;)

Aren't we all 21st century users...

And all using a 30+ year old video COMPUTER system!

 

But with bBasic, and/or the harmony cart. It would be neat if you could use "Basic Programming" that would read the program from ROM. You could create the program externally, enter it into a rom, then play that bin on an emulator or harmony. So you could have in a way a method of saving your work, all 63 bytes of it.

You can do a savestate in Stella. As for Harmony, savestates are theoretically possible but we haven't implemented them yet. I have done proof-of-concept testing in Harmony's RAM but not committed them to flash so they were lost when power was cycled.

Share this post


Link to post
Share on other sites

For example, I've implemented the Collatz algorithm (single-digit input only, unfortunately):

 

1 If S>0 Then Goto 3

2 S<-Key Goto 1

3 If S Mod 2=0 Then S<-S/2 Goto 3

4 If S=1 Then Goto 4

5 S<-S*3+1 Goto 3

 

Let's see what you've got. :)

 

I see your Collatz and raise you... XKCD.

 

http://xkcd.com/710/

Share this post


Link to post
Share on other sites

For example, I've implemented the Collatz algorithm (single-digit input only, unfortunately):

 

1 If S>0 Then Goto 3

2 S<-Key Goto 1

3 If S Mod 2=0 Then S<-S/2 Goto 3

4 If S=1 Then Goto 4

5 S<-S*3+1 Goto 3

 

Let's see what you've got. :)

 

I see your Collatz and raise you... XKCD.

 

http://xkcd.com/710/

Yeah, that comic was actually my first exposure to the Collatz conjecture. The discussion about it on xkcdsucks inspired me, on a whim, to implement it on Basic Programming.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...