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:-
2 thoughts on “@Retrochallenge – Slow Progress”
Your attic must be an aladdin’s cave mate! Finding the disc was one thing, but screenshots? Bonkers! Unfortunately the second one (which is actually really nicely laid out) does nothing for anyone’s street cred, eh?
It certainly is/was. We finally sorted it all out this week, put some more boarding up and took about 15 bags of stuff to the charity shop! You can actually get up there safely now and see what’s up there, including some worrisome bakelite electrics.
Having found the drawing pads into which I used to meticulously hand draw Tolkien maps and map out text adventures I’m not sure I’m qualified to comment on levels of street cred 🙂