@Retrochallenge – The Man From Auntie

BBC Master

The BBC Master that I recently snagged on Ebay has finally arrived, along with a Microvitec Cub monitor and an Opus dual disc drive unit.  It arrived in a pretty grim state, the Master was fairly thick with dust and the monitor seriously grimy.  I cleaned up the computer unit and will tackle the monitor tomorrow.

_1030996

BBC Master Welcome Guide

I knew the sensible thing to do would be to open up the computer and give it an internal clean whilst also checking for leaked batteries and unseated chips.  However I instead plugged it all in and powered it up.

Fortunately everything worked, well almost.  I was greeted on the screen by the text:-

Acorn MOS

This is not a language

*_

I made the assumption that this was down to a failed CMOS battery and restarted the machine with the ‘R’ key pressed to reset the CMOS configuration.  A quick search led me to the default configuration which I entered and following a CTRL/Break reset I was up and running.  My guess is that I will be presented with the same issue when I next power up and a battery replacement will be in order.

In Working Order

In Working Order

A fair pile of old and pretty tatty disks also came with the computer so I attempted to read a few them with no luck.  It seemed inevitable that some of them would have failed but I was surprised that I was unable to read any of them.  Another quick search led me to realise I needed to change from the ADFS to DFS filing system to read them.

I successfully formatted some new disks in both 40 and 80 track mode but have as yet had no luck copying files backwards and forwards between the dual drives.  I’m also having no luck using Omnidisk to transfer disk images onto floppy but I shall persevere.

Ideally I’d like to get the Yahtzee code transferred onto floppy so that I can continue development on the Master and relive the school computer studies class experience as closely as possible.

Formatting Disks

Formatting Disks

On the other hand I can imagine spending the last few days of the challenge cleaning up computer and monitor, replacing the battery pack and possibly installing some sort of solid state  disk drive.

@Retrochallenge – Slow Progress

I’m still awaiting the arrival of my BBC Master and have therefore been coding using the excellent BeebEm emulator.  Obviously it wasn’t long before I was distracted and started downloading various disk images from Stairwaytohell.  After a few rounds of Pacman, Frogger, Defender and Elite I managed to finally knock out something useful.

Having now read the full instructions for Yahtzee, it seems that my original decision to require the player to input their score wasn’t quite such a cop-out as I’d originally thought.  The scoring system is in fact quite complex and different scores can be attributed to the same roll of dice depending on tactical decisions made by the player in order to complete their score card.

Given this and the time that I have available I think a compromise might be in order.  Initially I shall attempt to write a procedure that will calculate the highest available score and attribute this automatically to the player.

I decided the first stage of this process should be to write a procedure to sort the rolled dice in to order.  I settled on a rather brute force ‘bubble sort’ approach.  This is what I came up with where V is the value of the die:-

 2000 DEFPROCsort
 2010 FOR PASS=1 TO 5
 2020 FOR SORT=1 TO 4
 2030 ST=V(SORT+1)
 2040 IF V(SORT)<V(SORT+1) THEN ST=V(SORT)
 2050 IF V(SORT)<V(SORT+1) THEN V(SORT)=V(SORT+1)
 2060 V(SORT+1)=ST
 2070 NEXT SORT
 2080 NEXT PASS
 2090 ENDPROC

It works, but it’s pretty unsubtle and will run to completion even if the dice are sorted in the first place.  Some sort of flag to recognise when sorting is complete and end the process would be ideal.

I’m slightly concerned how long it took me to work out what is presumably for most people a pretty simple piece of code.  It’s no wonder I didn’t finish it in the first place, though I would like to think my mind was somewhat more nimble all those years ago.

I also found some old screenshots of other student’s projects that I’d attempted to take with a Minolta SLR, with limited success:-

Ski by Simon Howard(?)

Ski by Simon Howard(?)

Magazine Database by David Tournay

Magazine Database by David Tournay

@Retrochallenge – Yahtzee!

yahtzee

Perhaps somewhat foolishly I’ve decided to follow in Urbancamo’s footsteps and use this year’s Winter Warmup as an opportunity to try to finish my 28 year old school project, specifically a version of the dice game Yahtzee written in BBC BASIC.

The recovery from disk of the original unfinished code has transported me directly back to 1985 and the fifth year computer studies class where a put upon Mr Rigby tried in vain to concentrate our minds on programming when we were more interested in throwing each other’s school bags out of the windows and bunking off for a fondle with the girls in the tennis courts.

Yahztee Running On BeebEm

Yahztee Running On BeebEm

What little work was achieved was done using BBC Model B computers.  These machines remain very popular and still command a fair price at auction.  I’ve been intending to buy one for some time and this current trip down memory lane has jolted me in to action.

I’m therefore awaiting the arrival of a BBC Master, dual disk drives and Microvitec Cub monitor with which I intend to finish my Yahtzee program.  While looking for a Model B I chanced upon this listing instead which had a very reasonable ‘Buy it Now’ price.

Having looked through the code that I originally wrote I can remember quite vividly the reason the project remained unfinished.  I was unable, or more likely unwilling, to figure out the necessary code to keep score, instead relying on the player to enter it manually.

Clearly this was a cop-out that needs rectifying and I will therefore attempt the figure out the necessary code and finish the program.  Whether I can then get upgraded to a ‘B’ from the ‘C’ grade that I originally received remains to be seen.

A quick search for ‘Yahtzee Instructions’ led me to a PDF helpfully provided on the Hasbro site.  I now need to figure out the most compact and elegant way of determining for scoring purposes which dice the player has rolled.  If I can achieve that, if, I may also look at jazzing the graphics up a bit.

Here’s the original code, some of it which I now have no idea what it does:-

   10 Y=0:MODE 7
   20 P=1000
   30 SC=0:U=0:I=0:O=0:P=0
   40 DIM Q$(5):DIM A(5):DIM V(5)
   50 REM YAHTZEE
   60 P=0
   70 CLS:DIM D(5)
   80 PRINT:PRINT:PRINT
   90 PRINTCHR$(141)"            àÇYAHTZEE"
  100 PRINTCHR$(141)"            àÜYAHTZEE"
  110 PRINT:PRINT:PRINT
  120 PRINT"        ÅBy"
  130 PRINT:PRINT:PRINT:PRINT
  140 PRINT"     É     PRESS ANY KEY"
  150 LET B$=GET$:IF B$="" THEN 150
  160 CLS
  170 PRINT:PRINT:PRINT
  180 PRINT"ÉINSTRUCTIONS(Y/N)"
  190 PRINT:PRINT
  200 INPUT A$
  210 IF A$="Y" THEN 1010
  220 IF A$<>"N" THEN 160
  230 CLS
  240 PRINT:PRINT
  250 PRINT"ÑPLEASE ENTER YOUR NAME"
  260 INPUT A$
  270 PRINT:PRINT"ÅTHANKYOU"
  280 CLS
  290 PRINTCHR$(141);"            ÖYAHTZEE"
  300 PRINTCHR$(141);"            ÇYAHTZEE"
  310 PRINTCHR$(141);"            Å======="
  320 PRINTCHR$(141);"            É======="
  330 PRINT:PRINT:PRINT
  340 PRINT"ÅPLAYER ONE IS ";A$
  350 PRINT:PRINT:PRINT
  360 PRINT"ÜPress any key to play"
  370 LET B$=GET$:IF B$=""THEN 370
  380 CLS
  390 Z=Z+1
  400 PRINTCHR$(141);"Ç            YAHTZEE"
  410 PRINTCHR$(141);"            ÜYAHTZEE"
  420 MODE 5
  430 COLOUR 1
  440 PRINT:PRINT
  450 PROCcubes
  460 L=0
  470 FOR L=1 TO 5
  480 LET Z=INT(RND(1)*6)+1:LET V(L)=Z
  490 ON Z GOSUB 880,900,920,940,960,980
  500 PRINT
  510 NEXT L
  520 C=1:REM counter
  530 FOR F=1 TO 5
  540 PRINT TAB(1,25);"HOLD ";F;" ?"
  550 INPUT A$
  560 IF A$="Y" THEN LET A(F)=1
  570 IF A$<>"Y" THEN LET A(F)=0
  580 NEXT F
  590 FOR F=1 TO 5
  600 LET Z=INT(RND(1)*6)+1
  610 IF A(F)=0 THEN LET V(F)=Z
  620 NEXT F
  630 CLS
  640 FOR F=1 TO 5
  650 PRINT
  660 ON V(F) GOSUB 880,900,920,940,960,980
  670 NEXT F
  680 IF C=2 THEN GOTO 710
  690 LET C=C+1
  700 GOTO 530
  710 PRINT "GO ON?"
  720 INPUT X
  730 MODE 7
  740 PROCscores
  750 V=V+1
  760 IF V=6 THEN GOTO 1420
  770 GOTO 420
  780 PRINTTAB(0,0)
  790 RETURN
  800 PRINTTAB(0,20)
  810 RETURN
  820 PRINTTAB(0,40)
  830 RETURN
  840 PRINTTAB(0,60)
  850 RETURN
  860 PRINTTAB(0,80)
  870 RETURN
  880 PROCone
  890 RETURN
  900 PROCtwo
  910 RETURN
  920 PROCthree
  930 RETURN
  940 PROCfour
  950 RETURN
  960 PROCfive
  970 RETURN
  980 PROCsix
  990 RETURN
 1000 INPUT F
 1010 CLS
 1020 MODE 7
 1030 PRINT:PRINT:PRINT"ÅYAHTZEE INSTRUCTIONS"
 1040 PRINT:PRINT"É  Yahtzee is a simulated dice throwing"
 1050 PRINT"Égame for one player."
 1060 PRINT"ÉThe player shakes his dice."
 1070 PRINT"ÉAfter shaking you may pick up any"
 1080 PRINT"Éamount of the dice you wish and shake"
 1090 PRINT"Éagain until you are satisfied with"
 1100 PRINT"Éyour score.You may do this twice after"
 1110 PRINT"Éyour first shake."
 1120 PRINT:PRINT:PRINT"ÑPRESS ANY KEY"
 1130 LET B$=GET$:IF B$="" THEN 1130
 1140 CLS
 1150 PRINT:PRINT:PRINT"Ö YAHTZEE SCORING"
 1160 PRINT:PRINT"ÜPoints are obtained for geting certain"
 1170 PRINT"áÜamounts and patterns on the dice"
 1180 PRINT"Üeg Runs,Sets and Pairs"
 1190 PRINT:PRINT:PRINT"ÉPress any key to play"
 1200 LET B$=GET$:IF B$="" THEN 1200
 1210 GOTO 230
 1220 DEFPROCscores
 1230 CLS
 1240 PRINTCHR$(141);"            ÑSCORING"
 1250 PRINTCHR$(141);"            ÜSCORING"
 1260 PRINTCHR$(141);" Ü          Å======="
 1270 PRINTCHR$(141);"            Ö======="
 1280 PRINT:PRINT
 1290 PRINT"ÅAmounts on dice         Score"
 1300 PRINT:PRINT"ÑLOW RUN                  70"
 1310 PRINT"ÑHIGH RUN                 80"
 1320 PRINT"ÑFULL HOUSE               75"
 1330 PRINT"ÑFOUR OF A KIND           80"
 1340 PRINT"ÑTHREE OF A KIND          70"
 1350 PRINT"ÑTWO PAIRS                50"
 1360 PRINT"ÑONE PAIR                 30"
 1370 PRINT"ÑYAHTZEE                  100"
 1380 PRINT:PRINT" please enter your score "
 1390 INPUT SC
 1400 U=U+SC
 1410 ENDPROC
 1420 PRINT"SCORES"
 1430 PRINT"AFTER 5 GOES YOU HAVE A SCORE OF ";U
 1440 PROCsound
 1450 PRINT"PLAY AGAIN(Y/N)"
 1460 INPUT Y$
 1470 IF Y$="Y" THEN 1490
 1480 GOTO 1510
 1490 RESTORE
 1500 RUN
 1510  CLS
 1520 PRINT"GOODBYE"
 1530 END
 1540 DEFPROCsound
 1550 SOUND 1,-15,97,10
 1560 SOUND 1,-15,105,10
 1570 SOUND 1,-15,89,10
 1580 SOUND 1,-15,41,10
 1590 SOUND 1,-15,69,20
 1600 ENDPROC
 1610 DEFPROCcubes
 1620 VDU 23,224,255,255,255,255,255,255,255,255
 1630 VDU 23,225,255,255,231,195,195,231,255,255
 1640 ENDPROC
 1650 DEFPROCone
 1660 PRINTCHR$(224);CHR$(224);CHR$(224)
 1670 PRINTCHR$(224);CHR$(225);CHR$(224)
 1680 PRINTCHR$(224);CHR$(224);CHR$(224)
 1690 ENDPROC
 1700 DEFPROCtwo
 1710 PRINTCHR$(225);CHR$(224);CHR$(224)
 1720 PRINTCHR$(224);CHR$(224);CHR$(224)
 1730 PRINTCHR$(224);CHR$(224);CHR$(225)
 1740 ENDPROC
 1750 DEFPROCthree
 1760 PRINTCHR$(225);CHR$(224);CHR$(224)
 1770 PRINTCHR$(224);CHR$(225);CHR$(224)
 1780 PRINTCHR$(224);CHR$(224);CHR$(225)
 1790 ENDPROC
 1800 DEFPROCfour
 1810 PRINTCHR$(225);CHR$(224);CHR$(225)
 1820 PRINTCHR$(224);CHR$(224);CHR$(224)
 1830 PRINTCHR$(225);CHR$(224);CHR$(225)
 1840 ENDPROC
 1850 DEFPROCfive
 1860 PRINTCHR$(225);CHR$(224);CHR$(225)
 1870 PRINTCHR$(224);CHR$(225);CHR$(224)
 1880 PRINTCHR$(225);CHR$(224);CHR$(225)
 1890 ENDPROC
 1900 DEFPROCsix
 1910 PRINTCHR$(225);CHR$(224);CHR$(225)
 1920 PRINTCHR$(225);CHR$(224);CHR$(225)
 1930 PRINTCHR$(225);CHR$(224);CHR$(225)
 1940 ENDPROC