4inaRow
1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

Friday, April 11th, 2008 | Programs

4inarow





For more including Author's Notes download the eBook pages with this program's code listing.

4 in a Row is a fairly well known board game, a sort of tic-tac-toe with gravity. Tokens of different colors are dropped into chutes, the winner is the one who gets 4 in a row, as the name implies. Keeping one step ahead of your opponent can be challenging and this computer opponent is no slouch. But it can be beaten and will prepare you well to beat a human opponent in real life.

4inarow is written by Joseph Larson based on a BASIC game by James L. Murphy as found in ‘More BASIC Computer Games’ by David H. Ahl © 1979.

Share and Enjoy:
  • StumbleUpon
  • Google
  • del.icio.us
  • Facebook
  • Digg
  • Slashdot
  • Fark
  • Live
  • Spurl
  • TwitThis
  • E-mail this story to a friend!
  • Reddit



Tags: , ,

3 Comments to 4inaRow

Michael Wells
April 30, 2008

First comment: The links for the .exe and .c bring up “page not found” errors when I try and open them??? Is it my system, or are the links broken?

Second comment: I really liked finding this port of James L. Murphy’s basic game.
I had been trying to work out the game logic from the BASIC version and while I could understand all the BASIC code, the spaghetti code style of goto/gosub writing has been slow going when it comes to trying to understand what it was really doing. Now I have a C++ version of the same program by someone who seems to have figured out most of the program so that I can compare it to the BASIC version. My complaint with both the original version and the C++ port is that variable naming and the lack of much in the way of any commenting makes it a slow and very labor intensive job to try and figure out the program logic. I like to dabble when I have a little time in computer programming, a little C, a litte VB, a little of this and that, but I often feel like a dummy when it comes to trying to figure out what appears to be a simple program and yet turns out to be far more complex than I imagined as I dig into it — such was the case with Four In a Row by James L. Murphy — so a C++ port holds the promise that I can get a better understanding by putting the two versions side by side. PS Why is a link to the original game buried only in a forum post?

Third Comment: I really liked the concept of the Cymon’s Games site. It appears to be brand new, put up while Joe Larson is looking for a new job, so I do not
know if it will survive the test of time very long as few sites do. Joe’s live journal blog was an interesting insight into the webmaster behind the site. I hope the site manages to keep the author’s interest in maintaining it.

Signed, Michael Wells

Joe
April 30, 2008

Darn case sensitivity. (hah) Fixed now.

Thanks for the kind comments. Re;comments, when I was writing the programs I had the mindset that folks were going to type them in, so I wanted to keep them as streamlined as possible. I see now that was a mistake. However, it’s not likely I’m going to go back and comment all my code. But future programs will be better at it.

As for if the site will stand the test of time, at the moment it’s got a lifespan of a little more than half a year before I run out of programs. And while I’d love to write new programs every week thus far I haven’t been able to and prep them for updates, even while I’m looking for work. That being the case, I need submissions.

sparkes
May 3, 2008

As somebody who translated a little Sinclair game for Joe I can see it from both points of view.

One part of me wanted to remain true and the originals machine limitations meant terrible variable names.
Another part of me wanted it to be as readable as possible so I tried to create self documenting code like I would normally with ‘nice’ variable names
Then there is the evil side of all coders. I wanted to make it fast, I wanted to use as little screen realestate as possible and I wanted it to be the damned best program I’d ever written :) It’s resisting this third element that makes something usable for a newbie. Nice variable names are wonderful and save adding tons of comments to any program but it’s curbing our normal tendancies as coders to make everything look like it should be fast (even when it’s not) or use complicated methods because at some point in 1993 it made sense to do things that way which make things really difficult for new developers to understand.

Keep up the good work, you’ll find your audience.

Leave a comment

Support Cymon's Games

Recent Comments

Search

Sponsored Links

Cymon's Amazon Store