Pages

Saturday, 28 March 2020

RetroChallenge April 2020: The Devil's Whist

Bit of an early start to the the RetroChallenge Retry proposed by Mr. Sherman, but I have added to my JGGAME14.DSK in my Coco distro the program "Devil's Whist" from the Australian Coco magazine December 1986. It is a two player variation of the game Whist, which is itself a simplification of contract Bridge. One of the players is the computer. Bob Delbourgo has created what seems to be a pretty adept AI to play against.


Since the MC-10 and Coco video MC6847 video chip lacks any native characters for the card suits the author uses colours to represent the four suits instead. However, one of these colours is green, which creates problems in terms of contrast with the regular green screen background.  I think in the original program, the author switches the screen to the alternate orange color set in order to provide this contrast.  However, since the MC-10 can't display this alternate color when any sounds are played, I modified the program to use a black screen for the areas where the card hands are displayed.  However, in the main info display there was still a need to contrast the green suit, so I switch that suit to being not just the colour green but the diamond/asterix character.  So at least there is one of the more traditional card suits being used.


There are lots of nice sounds used in the program. Since they used the PLAY command, I translated them to use my special subroutine to play lists of notes from such commands, but using the regular SOUND command of standard Micro Color Basic. So not only will this program now run on an MC-10, it can also be used by 16K Color computers with only Color Basic. I have also created a version for the Dragon and added it to my Dragon Distro: https://drive.google.com/open?id=0B7oFL_dNqgh9OUZFeklURW9DNTQ

I also use a slightly modified version of my standard reverse video routine. This one uses AND 64 to select the correct character for polking to get proper reverse characters. Don't know if it is any faster, although the routine is one character shorter in length, but I think it might be. I should run some benchmarks to find out.

The program also replaces the instances where changes are made to character strings using the MID$ function. The MC-10 does not support the ability to use MID$ to "splice in" new character sequences into existing strings. So although Micor Color Basic can support using MID$ to "cut" a selected part out of a string like this:

10 S$=MID$("***JIM***",4,3)

which will result in S$ containing "JIM," the following cannot be done:

10 A$="***   ***"
20 MID$(A$,4,3)="JIM"
30 PRINT A$

which will result in the output "***JIM***." Instead, I had to using a special subroutine that allows strings to be poked into existing strings, which recreates this functionality built into Extended Color Basic. This  subroutine uses the VARPTR function to determine where a string is stored in memory in order to poke the new characters into that string. It probably slows things up a little, but I have used all my techniques for increasing execution speed, which hopefully means the program does not run much slower than the original. Still there is a little delay while cards are shuffled (about 10 seconds) and sorted. That's just part of the charm of such old 8-bit Basic programs that we were willing to live with. Back in the early 80s we were just impressed that the computer could be turned into any kind of "artificially intelligent" opponent for games. They were pretty heady days. We were even willing to manually type-in programs to see such capabilities demonstrated, which I had to do today as well, since the scan was not clear enough to even bother trying to use OCR.

So my thanks go out to Bob and his nifty little computer AI driven game.


P.S. There were some corrections and improvements presented by the author in a followup edition of the Australian Coco magazine (Feb 1987), page. 41. I integrated them into the program. Now the program makes sure you follow suit if possible (i.e. now you can't cheat). Again, I had to use a special subroutine (lines 8 and 9) to recreate the INSTR function used in the update because that function is not available in Micro Color Basic for TRS-80 MC-10.


No comments:

Post a Comment