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!