Pages

Tuesday, 7 November 2023

"Lines of Action" by Sol Guber (1985)


The game "Lines of Action" was invented by Canadian born Claude Soucie.  He moved to the United States during the Depression as a young child, and learned to amuse himself, and eventually others, by inventing games, Sol Guber created a two player version of the game in BASIC for the 8-Bit Atari Computers. It was published in ROM Magazine Dec/Jan 1985, which was a short lived Canadian Atari publication. This version is a port to Micro Color BASIC on the TRS-80 MC-10. 

I had to rip out all the complex Atari graphics commands for drawing the board and the round playing pieces.  I created a simple Semigraphics-4 grid in white, and some chunky blue and red pieces to replace the original white and black ones.


I had to fix the subroutine for checking if you were trying to jump on one of your own men. The original program checked for if you clicked on your own selected piece earlier than checking for whether you were trying to actually jump on one of your own. By clicking on your own selected piece the program would abort that move, and allow you to select another piece.  But this prevented the program ever getting to the routine to check if you were trying to jump on one of your own players because it just checked for whether you were clicking on one of your own pieces (any piece). The message about not jumping on your own pieces would never print and the turn would simply end inelegantly without removing the old active piece marker, etc.  So I changed the check to specifically look for whether you were landing back on your starting piece. Then the program could also get to the later check for trying to jump on one of your own men.  I also made the routine print a message that your move in progress was cancelled. Also, the routine for ending the turn seemed overly complicated and created issues with screen cleanup, so I simplified it and standardized the screen cleanup done for all the error messages.

There were lots of poor scan issues and just plain old typos in the original listing from the article.

For example

225 T1PT=TPT: U1=T=UPT: IF UPT>TPT THEN U1PT=TPT+Cl: TAPT=UPT-CA

Should have read
225 T1PT=TPT: U1PT=UPT: IF UPT>TPT THEN U1PT=TPT+Cl: TAPT=UPT-CA

I couldn't get the original win routine to work.  It was an interesting attempt to create what was in a essence simply a case of the "flood fill" algorithm. Basically you find the first piece for a player.  Then flood fill from it.  If after it finishes going through and changing any interconnected piece location connected to that original location, if the final total of pieces is the same as the total pieces the player has, then the game knows you have interconnected all your pieces and are a winner.  I think Guber was trying to create a clever way of doing this but it only worked sometimes, on simple shapes like

OO
OO

But failed on complex chains like:
 O 
  OO
 O  O

Not sure, but he might have just given up or have not tested enough. I just replaced it with a simpler more standard flood-fill routine that seems to work fine and is a little quicker.  One problem with his routine was that it sought to search on the 8 locations around a piece 0-7 and then store where it left off in a string (which holds the whole grid of locations) as an ASCII value of where you are in the search around aa piece added to the value of the player piece code (5=blue 10=red).  But he didn't calculate the values correctly.  The 0 value would leave the stored player piece value unchanged (5 or 10) since the first search value for the array storing the 8 directions is 0 (as in 0-7 for the array storing those direction offsets).  I created a test bed routine and as far as I can discern his method would never really be able to  work on complex chains since its doesn't store unvisited locations on stack, and can "get lost" following down side tracks.

It would be nice if someone could figure out a simple AI routine to add to the program, which is for two human players.  I'll have to see if my son Charlie is game for a programming challenge the next time he's home for an extended visit, such as at Christmas.

How to Play

LINESOFA can be played at my GameJolt site under the "More 8-bit BASIC game ports" menu item.


Just select Play Game, "More 8-bit BASIC game ports", and then select LINESOFA from the Cassette Menu, and type RUN and hit Enter in the Main emulator screen.


No comments:

Post a Comment