Tuesday, 30 April 2013

Retrospectiva Win!


Pablo Roldan of the Retrospectiva Contest has e-mailed and informed me that Penguino has won.  I would like to thank all the people on the various forums (Yahoo, Dragon, Alice) who helped out either by voting, or programming advice over the years.  I'm already looking forward to next year's contest, where I hope to submit my WeatherWar and NightBlitz programs that I have sketched out and started working on (a little).  If anyone out there has any other suggestions for classic 8-bit Basic games they think could possibly be done on the MC-10 (or Coco or Dragon) please let me know.

Wednesday, 17 April 2013

Time to Vote for the Retrospectiva Contest

Okay. It's time to vote in the Retrospectiva Basic Games contest. Please consider sending your support to my entries in the contest: Penguino, Romp in the Garden, Crawl, Doctor's Adventure on Scaro, and Battlbots. The link to the voting site is:
http://rsp.retrocomputacion.com/retrospectiva-2012-voting-phase-basic-games/
Thanks to all those who helped along the way.

Sunday, 14 April 2013

The House of Seven Gables Port

Well I've ported yet another of Greg Hassett's classic text adventure programs from TRS-80 Model 1 Basic to the MC-10.  As usual this required sifting out all the ELSE commands and replacing them with calls to subroutines to process the different branches of the IF/THEN/ELSE.

It also required shortening some lines.  I find the best way to process such long lines is to make my Wordpad Window a size that I know when I have roughly passed the 128 character limit.  Then I just make jumps to subroutines (because Hassett had programmed with very tight line numbering I couldn't simply add lines).

Another quirk of TRS-80 Model 1 Basic is the ability to drop the "THEN" command from IF statements.  Hassett did this quite a lot in this program.  I had to systematically go through and put THENs on all the IF statements.

Finally, I had to switch all the PRINT commands with messages longer than 32 characters to put their message into an M$ variable and then GOSUB my word wrap routine (lines 1-4).  If such messages contain numeric variables, these variables have to be put into a STR$() command and these have to be concatenated with the M$ string using a "+" symbols rather than the  ";" symbol normally used in PRINT commands.

I also had to convert the tape cassette save and load routines.  For the MC-10 the only way to save and load to tape is to use the CSAVE* and CLOAD* commands which can only save and load the contents of a numeric array.  So you need to expand one of the arrays (usually the largest one being saved) to accept any other single variables that are also being saved.  In this case the OB array is the bulk of the saved file data, so I simply expanded its size by 6 elements to contain the 6 extra unique variable elements.  The result is that the original load routine which looks like this:

74 CLS:INPUT"PRESS <ENTER> WHEN CASSETTE PREPARATIONS ARE MADE ";XX$
75 FORI=8TOLO:IFOB$(I)=""THEN77
76 INPUT#-1,OB(I,0)
77 NEXTI
78 INPUT#-1,CP,FF,ZZ,T,P(5,0),DF

must be converted for the MC-10 to look like this:

74 CLS:INPUT"PRESS <ENTER> WHEN CASSETTE     IS READY FOR LOADING";XX$
75 CLOAD*OB,"GABLEDAT"
76 CP=OB(41,0):FF=OB(42,0):ZZ=OB(43,0):T=OB(44,0):P(5,0)=OB(45,0):DF=OB(46,0)

For doing saves you simply reverse the process, so for example ZZ=OB(44,0) becomes OB(44,0)=ZZ, which you do for all the single variables before issuing the CSAVE*OB command.

There were also a number of places where Hassett used FOR/NEXT loops with IF statements that would break out of the loops without completing them.  I don't know if this can cause any real problems, but it strikes me as inelegant. I always take something like this:

10 FOR C=1 TO 10:IF P(C)=5 THEN F=C:GOTO100
20 NEXT
30 ...

And  change it to something like this to make sure FOR/NEXTs are always completed:

10 FOR C=1 TO 10:IF P(C)=5 THEN F=C:C=10:NEXT:GOTO100
20 NEXT
30 ...

If anyone can tell me if such finickyness on my part is pointless I would appreciate hearing from you.
Anyway, as usual all my programs can be found in the Emulator .c10 format at: https://github.com/jggames

Wednesday, 27 March 2013

Scrabble Helper Final Version (Hopefully)


I've released the final version of Scrabble Helper for MC-10, Coco and Dragon.  It can be found on the Yahoo MC-10 group site, the Yahoo Coco site, the Dragon Archive Forums and my own site.  I think I've got rid of most bugs and added all the features I can add, given memory restrictions.  Recent additions include adding a bunch of 2 letter "killer" Scrabble words.  Now the word look-up function ("H") does not just provide a list of the first five words found, but continues rolling over the list of five until you hit a key or until it reaches the end.  If it reaches the end of its dictionary, it then prints a list of the five longest words found.  I got rid of a few lingering proper nouns from the dictionary and cleaned up the display when the game ends.  I also added a total point calculation so that games between multiple players can be assessed in terms of the overall level of competition.  You can also now choose to play as a single player for playing games of "Scrabble Solitaire."  I should mention that the key in the bottom right lists the letters not only in order of ascending point values, but descending order of the number of tiles.  In other words, "E" comes first because the largest number of tiles are "E"s followed by "A"s and then "I"s, etc.

Friday, 22 March 2013

Scrabble Helper Beta


I have a working version of a Scrabble game/simulation for the TRS-80 MC-10.  It's not single player, but with the [H]elp function you can have the computer search for up to 5 word suggestions.  It searches the tiles (or those in front of the left arrow, which is what I call the "terminator" symbol).  It can only search real letters and not "blank tiles."  Its dictionary is about 1750 words long, and includes some of the killer Scrabble words like "aa" (which is a form of scoriaceous lava).  Hitting any key cancels the search.

There are two modes for using the game.  If you enter [Y] to the prompt about "using a real game" you can input the tiles you wish to play.  If you have any blank tiles you will have to bury these between other letters and then re-arrange the tiles to get at the blank tile.  For some reason the INPUT command in basic doesn't take single blank spaces as input.  I have too little time and inclination to do away with this limitation.  If you make a mistake, just have the next player hit [F] to forfeit her turn, and then re-input your tiles.

The other mode is regular play.  You are given 7 tiles from a virtual bag.  When you play tiles, your compliment is restored to 7 from the virtual bag, until the bag is empty.  Once the bag is empty, up-arrow characters are used to fill out your shelf.  These up-arrow tiles cannot be played, so keep them behind the terminator symbol.  The game is completed after six [F]orfeit commands are issued by either or both players after the bag has been emptied.  So, once you both can't make any more words, or someone has played all her last tiles, just keep hitting [F] until the final score card comes up, or hit [*] key to end immediately.  The score card represents the scores of each player after subtracting any tiles remaining on the players' shelves.

Another command is [E]xchange, which will swap any of your letters before the terminator symbol for ones in the virtual bag.  This option only works if there are at least 7 tiles left in the bag.  The number of tiles left in the bag are listed in the bottom right corner of the screen in the score "key" description space, just above the double letter score DLS information.  The key also contains information on the values of the letter tiles and the other bonuses (triple word score TWS, double word score DWS, triple letter score TLS).


Manipulating the 7 tiles and terminator symbol on your virtual "shelf" of tiles is accomplished by using the [A] and [S] keys to move a cursor left and right through the tiles.  It wraps when it reaches either end of the shelf.  You can move any letter under the cursor left or right by using the [,] and [.] keys.  These also wrap at each end.  When you have a "word" you wish to place on the board (the letters in front of the terminator symbol on you shelf) just hit [ENTER] and your cursor will switch to the game board.  Move your cursor to where you wish to begin the word and hit either [D] or [R] to place the tiles down or to the right.  If there are any existing tiles on the board these will be jumped over until your entire word is placed.  If there is not enough space on the board, or if your word is not touching any existing words, or you start on top of an existing tile, then your word will not be placed.  If your word can be placed, your potential score will be displayed along with a prompt "OK?".  Press [Y] to place your word and take your score or [N] to return to the board.  If you hit [ENTER] while on the board, you will be taken back to the shelf.

If at any point you wish to complete the game and have the final scores computed, just hit the [*] key.  See my previous postings for information about the scoring algorithm.  As far as I can see from testing and playing few games with my son, it seems to work.  Please let me know, though, if you find anything fishy, or would like added features.  The beta is called "SCRABBLE13.TXT" and it can be found at the Yahoo MC-10 site:
http://tech.groups.yahoo.com/group/TRS80MC10Club/

Sunday, 17 March 2013

Scrabble Update


Well, I have a somewhat working scoring system in place.  At least I think so.  If any expert Scrabble players out there, for instance, could tell me whether the arrangement of tiles above should work out to a score of 47, it would be much appreciated.

I also have a functioning "tile re-arranging" routine that allows you to move tiles easily and to select the word by moving the terminator character (the left pointing arrow in the above).

What remains to do is to add the multiple player stuff (up to 4) and to design the right hand side of the screen.  I would like to add a little "key" for the different values of the letters and one for the meaning of the colours (i.e. DWS, TWS, DLS, TLS).  I also will add the ability to choose between using the program simply to keep score for a real game and actually playing the game just on the computer.  In the former, you will input your tiles each turn, whereas for the latter, the computer will provide you with tiles for each turn till the virtual bag of 100 is empty.  Which reminds me, I still have to add provision for 2 blank tiles...

I'm taking this project a littler easier than I have of late.  I had quite a rush there for a while getting projects squared away for the Restospectiva and the CocoCoding contests.  Now I'm back to simply programming for the fun of coding.  My wife finds games like Scrabble, Sudoku, and Mahjong relaxing.  I finding making computer versions of such games relaxing.  But playing... not so much.  So if there is anyone out there willing to do a little beta testing like my son Charlie, please let me know what you think of my games.  Critical comments or bug reports are much appreciated.

Monday, 11 March 2013

Yet Another Project Underway: Scrabble



Well I've got another project underway.  I'm trying to make a 4 player Scrabble game.  I already have a 1750 word dictionary built in, and an algorithm for finding words in it from a jumble of 7 letters.  I had originally had aspirations of creating an AI to play against.  But after loading the dictionary, there was only about 6200 bytes left.  Also, the word finding algorithm takes about 20 minutes to search the entire list for words that can be created from 7 random tiles.

So I have settled for trying to make a simulation of the board, which will automatically score words placed on it, and keep track of tiles from a virtual "bag" of 100 tiles for up to four players.  The dictionary will be used only as a "Help" feature if requested, and will search for word recommendations until a key is pressed to cancel the search.  Perhaps this can function as a simple "AI."  A single player could choose 2 player mode, and then use the help function to get some recommendations of words for the "second" player, which could then be placed by the first player to create a "pseudo opponent."

Or I might just make a routine that allows players to key in words directly for placement on the board for scoring.  This way you could use the program in conjunction with a real game, but just as a "score keeper."  Or perhaps both options.

I've basically got the algorithm in hand:
1. Input letters for your word (or manipulate 7 tiles on screen until in desired order, use left arrow ASCII char 95 as terminator of desired word)
2. Move cursor on board to beginning position for word
3. Prompt whether Right or Down direction desired
4. If down, then count down for each letter in the letter list compiling a list of @ locations and also counting colour bonuses and letter scores.  Skip over any existing letters on the board, but count them for scoring purposes.  At the end of this process, check for any letters in front of the first letter position or after the last position.
5. Process each @ location for possible horizontal words. If one is found, count letters (including @ location letter and any colour bonuses for that location)
6. Place actual tiles on the board (reverse video) and report score
7. Confirm placement
8. Undo if not confirmed

A similar process will be needed for right direction, which if I do it right, can perhaps simply use the same code as above, just with different vectors.  In fact, I'm sure I'll have to have a single routine, because otherwise I'll probably run out of space!  20K of memory is not a lot to work with, but its an interesting challenge.  We'll see if it can be done.