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.

Saturday, 2 March 2013

TRS-80 Model 1 Homage and "Commercial Software" for the MC-10


Another useful source of code to port to the MC-10 can be found in the world of the mother of all TRS-80s, the Model One.  The 128X48 set/reset graphics of that machine can often simply be converted to the MC-10s 64X32 set graphics by multiplying any X coordinates by .5 and any Y coordinates by .66 to adjust to the MC-10's smaller screen size.  So a game like Softside magazine's famous "Engineer" simulation by David Bohlke (thanks to Neil Morrison on Yahoo for bringing it to my attention), which looks like this
when converted to the MC-10's screen looks like this:
 Of course since the MC-10 has colour, we can also have variations on the theme such as this:
Another thing that will have to be adjusted is the print@ locations, but this is often as simple as multiplying the number by .5 since the MC-10 512 long text screen is exactly half of the TRS-80's 1024.  This often requires that text messages be shortened, which is somewhat of an art form, but I have generally found that messages can usually be adequately expressed in a more terse "MC-10" fashion without much, if any, loss of information.  Sometimes creative use of reverse video can also help.

I have found that even with the added overhead of adjusting X and Y coordinates on the fly, the MC-10 versions of TRS-80 programs are often faster than the originals.  This is especially the case if some of my speedup techniques are added.  This can sometimes make lack-luster games into truly challenging arcade action games.  The following are some of the other programs from the TRS-80 world that I have ported to the MC-10:

ABM Command Quest 1 Maze Race
Santa Paravia and Fiumaccio Rescue Adventure in the Near Tholian Sector

All the above programs "Rescue" "ABM Command," "Quest 1," "Maze Search," "Santa Paravia and Fiumaccio," and "Adventure in the Near Tholian Sector" where first published in the groundbreaking Softside magazine.  I have also found 80Micro to be a useful resource.  To gain access to the original code, I started by simply typing in the programs from PDFs of these magazines that I was able to find on the Net (thanks to the scanning efforts of many dedicated 8-bit enthusiasts).  I moved on to using character recognition software to take away some of the brute work of typing.  Finally, I was able to find emulators for the Model One, which contained utilities for converting programs from emulator files into simple text files.  Such files could than be edited and loaded directly into EmuCompboy's MC-10 emulator using it's wonderful "quicktype" feature.

Plowing through all the Softside and other magazines you can find on-line would have been a terribly arduous process (although perhaps a wonderfully nostalgiac one).  However, I was able to avoid much of this work because of the help of a very valuable resource on the Net called the Giant List of Classic Game programmers by James Hague.  It can be found at: http://www.dadgum.com/giantlist/
As he describes his list:
This is a Who's Who of classic game designers and programmers, where "classic" generally refers to pre-NES 8-bit home computers (like the Atari 800 and Apple II), consoles (like the Atari 2600 and Intellivision), and arcade coin-ops. Why the pre-NES distinction? Because prior to that there was a closer connection between the creator of a game and the finished project. That's an oversimplification, because there were 8-bit computer games developed by teams, but single-person, single-vision games became rarer once the Nintendo-era of consoles took off.
This is great resource because it not only lists the programmers, but also their programs, which system they were programmed on, and whether they were "type-in" Basic programs.  Using the Giant List I was able to quickly zero in on some of the big favorites of the 8-bit era and find TRS-80 versions.  Programs that had versions created for the other 8-bit machines tended to be the best programs for conversion because, if they had been ported multiple times already, this was usually a good indication that the program was amenable to conversion.  Sometimes I have even found "commercial" Basic programs in this way.  For example my port of "Andromeda Conquest" by Avalon Hill was a result of noticing that it was a Basic program that had versions for TRS-80, Atari, IBM, Apple and Commodore.


Andromeda Conquest TRS-80 Gameplay screen
IBM TRS-80
Atari Version MC-10 Version
However, in this instance I worked from the IBM source because it was available on-line in GWBasic format, which allowed me to easily save the program to an ASCII text file (Save "FILENAME",A just like in Coco basic) for importing into the MC-10 emulator. It also lacked some of the complexities and fancy screen formatting that had been added to the TRS-80 port of the program.  For example, the IBM version used simple number entries for all display objects instead of letters and numbers.  Still, conversion was difficult because a 32X16 screen is a real squeeze compared to the 40X24 screens of these other systems.  Also, recreating a simple "reverse video" subroutine presented some difficulties.  In the port, I had to swap the panels that displayed the Fleet Status and the list of fleets, since the MC-10 left only 11 characters to the right of the main map.  In the end, I was able to get all the same info of the original shoe-horned into the screen with only a little loss (witness the concatenated menu options in the MC-10 version above).  Still, the MC-10 (and the Coco and the Dragon) now have a classic 8-bit program shared by the other classic systems that has all the same game play and features of the original "commercial" program.  You can even go here to get a PDF of the original manual http://www.scribd.com/doc/93433653/Andromeda-Conquest

So, who says new "commercial software" is no longer coming out for computers like the MC-10 and Coco.  You just have to know where to look!

Thursday, 28 February 2013

ZX81 Homage and Pipe Frenzy Update

My son Charlie also suggested that I find a way to add a little more challenge and variety to Pipe Frenzy. I have responded by adding a special randomly placed "gold pipe" which you get extra points for if you can integrate it into your pipe network.  When the water reaches this section of pipe it makes a satisfying gurgling sound, and slows the water's progress somewhat--giving you a little extra time to plan.
One question Charlie asked me was why I like to make programs that already exist for the Coco (we have one he sometimes plays games on for a "classic 8-bit" experience of the "olden days" of computers).  My reasons are twofold.  First I simply like to program, and some the classic games provide simple compelling concepts that are easily programmed on a 8-bit computer.  Second, the MC-10 is the machine of my heart, since it was my first computer, and as I tell him, it didn't have then, and still doesn't have now, all the programs (nice machine language game programs) that the Colour Computer has.  I'm trying to fill some of the gaps with the best Basic equivalents that I can make.  I get my inspiration from looking at all the great 8-bit era computers to see if I can find simple game ideas that can be recreated using the special Basic techniques I have developed and learned about over the last few years.  One example is the inspiration I received from a game I found on a ZX81 emulator, which is a variation of the classic arcade game "Scramble."  Here's the ZX81 program:
I have generally found that if a program can be made in machine language or Basic using only the ZX81's simple graphics, a version can probably be created for the MC-10 using only Basic.  Here's my variation on Scramble:

Other ZX81 games that I have found inspiration from for creating MC-10 basic games can be found on the Steven's ZX81 classic basic programming website: http://zx81.reids4fun.com/?action=zx81.  His Basic programs, for example, inspired my versions of Joust and Tower Dodge:

Tower Dodge

I really think what my MC-10 retro-computing programming hobby re-creates for me is some of the magic experienced by the people, like Steven, who were first introduced to home-computing on  machines like the ZX-81 that required the user to learn a bit of programming.  I have tried to pass some of this interest on to my son Charlie, and he seems to have taken it up.  He has developed quite an interest in C, Java and Python programming, which he experiments with using his laptap, which he has "purified" of Microsoft products (This is something we agree to disagree about, as I quite like Bill's version of Basic).  Instead, his laptop has multiple partitions containing multiple versions of Linux and GCC etc.  Way to go Charlie, you are truly a "Master of the Bash!"  And you've definitely helped inspire my ongoing interest in classic 8-bit Basic game programming.


Attack of the A-Holes

Well I've been trying to make my game "Tunnel Jumper" more challenging.  As usual my son Charlie was very helpful through his role as chief "Beta Tester."  He was able to master the game very quickly, and win through to the end.  In fact, it only took him about 15 minutes to figure out all the nuances of the first version of Jumper and then another five to get to level 10.  Based on his experience, he gave me a long list of "improvements."  Here they are:

1. Make the "A-holes" (as he dubbed the alien "A"s) more deadly
2. Make the A-holes "protect" the rare elements 
3. Make the dirt or rock layers less available or thinner
4. Add deadly "lava" to make for more dangers on the screen
5. Add levels of difficulty
6. Add better music and sound
7. Make the levels harder as you progress upwards
8. Have music at the end when you win

I think I have been able to deal with all of these requests.  I've tightened the code and reordered the declaration of variables to increase the speed of the program.  I changed all the prints@s to pokes for the aliens and the player.  This has allowed me the speed to add another alien.  Now you can choose between levels of difficulty.  On level 1 there are 5 aliens, on level 2 there are 6, and on level 3 there are 7 for each screen.  You also can no longer run straight into aliens without dying, although you can still jump on top of them without dying (this can be useful for jumping up to platforms that are usually out of reach).

I didn't add deadly lava, but now I randomly sprinkle red blocks throughout the levels.  These blocks can only be destroyed by a direct hit from your upward digger, so this adds further complexity to choosing where to shoot in order to create workable "stairs."  More red blocks are added on higher levels of difficulty.  Now the amount of blue rock that is laid down is diminished the higher number of screens you complete.  And this is amplified on the higher levels of difficulty.  This means that on higher levels, it is more likely for screens to be created with gaps that can only be bridged by use of spike gun ladders and selective drilling.  So now there is a real need to collect and save these objects for possible use on later screens (Charlie found it easy to complete the earlier version without having to use these special tools).


Charlie used his musical skills to transcribe a snippet of the "Fanfare for the Common Man" into sound statements for the victory sequence.  It only plays if you collect the secret plans, which now appear less frequently (only on level 3 and level 7).  These plans are now displayed as "@" symbols.  I also shortened the timer for each screen before the aliens "gas you," which forces you back a level.  The time limit also varies according to difficulty level.  The higher the difficulty level, the shorter the time delay before you are pushed back.  This really forces the player to move quickly to try to make it to the top of each screen before time runs out.  To create the music, Charlie used the musical score program that I modified from one created by William Barden Jr.  My version allows editing, saving, playback and conversion to sound statements for output to a text file options, to name a few of the additions.  It allows Charlie to compose using a regular range of notes and then to output his work as a string of SOUND commands that I can use in my programs.


I was also able to fix a number of infrequently occurring, but none-the-less annoying bugs. For example in the screenshot to the left you can see the "X" character has been able to drop into the score area of the screen (Thanks Charlie!).  That no longer can happen.  Scoring has been modified so that it is adjusted relative to the level of difficulty.  Rare elements (except for 4 per level) appear under where aliens spawn.

I hope you enjoy the new version for the MC-10 which is available on the Yahoo site.  I hope to have  the code converted to Coco shortly for submission to the Cococoding contest.