Jump to content
IGNORED

Royal Game of Ur (old thread)


ramidavis

Recommended Posts

Excellent work! I would remove the GoTo 5270 at the end of line 5260 as it is not needed.

Variables cb and pb refer to the number of computer and player pieces on the board respectively. The rf variable is a flag for the center rosette, and rp is a flag for the other rosettes.

Also, the Sharp computer has an idiosyncrasy where in a conditional if then statement, if you are assigning a value to a variable, you have to use the keyword LET before the assignment. And if you are making multiple assignments, you only have to use LET for the first one. For example IF X>0 THEN LET B=1:C=2. Weird, and it took me a while to figure out why I was getting an error on perfectly good statements...

Thank you for doing this!

Were you able to test it out?

  • Like 1
Link to comment
Share on other sites

I believe the text I posted has an error that there are two line number 5550. The first one should be 5500. Also, as I am moving this to PC and running under Just Basic the interpreter trips on the fact that I typed some upper case I's. Look for next I.

 

It is sort of running on the PC now but I got one subscript out of range error. The computer went first, rolled 4, moved 0-4, rolled 4 again, moved 4 to 8, rolled 3 - then got the subscript out of range error. I need to play with it some more yet.

 

Question: Line 140 tests both rp and rf before swapping to the other player. Line 180 only tests rf. Should 180 also test both flags?

Edited by SIO2
Link to comment
Share on other sites

This is a work in progress. It runs under Just Basic which is a free download. Seems to roll a lot of fours. I had stacked several on 0-4 moves then attempted to capture 4-8 but it would not let me. I also had a piece on square 3 and tried to move that. I got the subscript out of range error.

 

But here is the .bas (a text file) for Just Basic in case anybody wants to play with it.

 

PCUR.bas

Link to comment
Share on other sites

I believe the text I posted has an error that there are two line number 5550. The first one should be 5500. Also, as I am moving this to PC and running under Just Basic the interpreter trips on the fact that I typed some upper case I's. Look for next I.

 

It is sort of running on the PC now but I got one subscript out of range error. The computer went first, rolled 4, moved 0-4, rolled 4 again, moved 4 to 8, rolled 3 - then got the subscript out of range error. I need to play with it some more yet.

 

Question: Line 140 tests both rp and rf before swapping to the other player. Line 180 only tests rf. Should 180 also test both flags?

No, line 180 only needs to test for rf. Rp is used only by the computer AI.

Regarding the subscript error, my program assumes arrays from 0 to 14, not 1 to 14. Make sure that your flavor of Basic is setting up the arrays with 0 as the first element.

I'll check your listing against my papers when I get home tomorrow and let you know if I find any errors. Given my dense scribbling, I'm amazed you actually managed to extract the program out!

  • Like 1
Link to comment
Share on other sites

I checked and Just Basic uses base 0 for the arrays.

 

Regarding checking against your papers: sounds good. I am also checking again. So far I found a typo on line 5215 where I typed pt instead of pp. I believe the line should read as follows.

 

5215 if i+t<15 and pp(i+t)=0 then goto 5270

also in line 5300 I typed t=0: I believe it should have been an i=0: to read as follows.

 

5300 i=0:print "Capture ";i;" to ";i+t

 

also in line 5610, I read and typed in=5: but I think that should not be a constant but instead the variable i. I believe line 5610 should read as follows.

 

5610 in=i:out=i+t:gosub 6000:rem print move

 

With these changes, I was able to play a complete game and the AI beat me. However, there is an extreme bias to rolling 4 or 3. So, I need to work on that yet.

 

Attached text file containing updated code.

 

PCUR2.bas

 

Note: at some point I also edited the main loop so it will vary from your original code but should function the same.

Edited by SIO2
Link to comment
Share on other sites

The Sharp computer random routine does not seem to have that kind of bias. If anything, I feel I sometimes get more 1 rolls than other numbers :)

 

So I checked your latest version to my papers and in places I had a hard time reading my own handwriting :lol: :

  • Line 5210 should be if i+t<5 or i+t>12 then goto 5270

Other than that everything checks out perfectly. It should run just fine as is unless I have a bug lurking in there still...

I'll convert your listing to run on the CC40/TI 74 computers as well.

  • Like 2
Link to comment
Share on other sites

Great! Thanks for creating this.

 

I made that change, tweaked the dice rolling for the PC to take into account the number of player pieces on the board to do random pulls in hopes of getting a better random string and, I added a display of the arrays to monitor the progress.

 

If anyone wants to extract this .zip onto their PC, they should be able to run the .exe file within and have a go. :)

 

runpcur3.zip

 

BASIC code is in the .zip as well.

Edited by SIO2
Link to comment
Share on other sites

So, I caught it cheating today. I had 4 pieces on Rosetta Prime and it jumped on top. Or maybe that is a rule?

 

your turn
* R *
0 Off c: 0 0 0 1 0 0 0 1 0 0 0 0 0 0 Home: 5

0 Off p: 0 0 0 0 1 0 0 4 0 0 0 0 1 1 Home: 0
* R *
You roll 4
from

 

Any rate, I added a graphic board which helped spot the whatever it is.

This is pretty rough yet but, I will post it in case anyone wants to tinker.

 

post-37734-0-55774100-1514339116.jpg

 

 

Be sure to read that instruction window and close it first.

Then click on the main (not the graphic window) to give it focus.

 

Runpcur3_2.zip

  • Like 1
Link to comment
Share on other sites

That should not happen and I have encountered that issue before. Hmmm....
If you encounter that issue again, please check the content of the pp( 8 ) array element. I'll play a few games on my end to see of I can replicate the issue.

I love the graphic representation of the game, but there is no way to tell if there is more than one piece on a square without referring to the arrays. Maybe the the number of pieces can be superimposed on the token when more than one is present?

Link to comment
Share on other sites

OK I was able to reproduce the cheating move, and it only happens when there are no other moves available for the computer and the dice roll puts a computer piece on the center rosette even when occupied by the opponent.

The error is in line 5605 which should read:

 

5605 if i+t=8 and pp( 8 )>0 then 5630

 

That should correct the issue. Thanks for rooting that bug out!

  • Like 3
Link to comment
Share on other sites

Rats: just posted the last fix and something else happened. The computer started moving pieces on that it didn't have.

 

my turn
* R *
0 Off c: 0 0 0 0 0 0 0 1 0 0 0 0 1 0 Home: 5

0 Off p: 0 0 0 0 1 0 0 0 0 0 0 0 0 0 Home: 6
* R *
I rolled 5
Capture 0 to 5


your turn
* R *
-1 Off c: 0 0 0 0 1 0 0 1 0 0 0 0 1 0 Home: 5

1 Off p: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Home: 6
* R *
You roll 1
from 0

Link to comment
Share on other sites

Yup, looks like another bug in an outlier case. This time the culprit is line 5280 which should be:

 

5280 if t<5 or cb=cn then goto 5320

 

The computer was failing to check whether it still had pieces on the stack when the dice roll was 5, it had no capture with the pieces already on the board, and there was a player piece on pp( 5 ). Clearly, even with as simple a game as UR, there are a lot of special cases to check for. Hopefully that's the last bug!

  • Like 1
Link to comment
Share on other sites

This is pretty neat. Makes me want to get the game and program the AI into my Sharp PC-1500. :-)

 

Quick question about the rules. If a I have multiple pieces on a square in the middle, and my opponent lands on that square, are all my pieces captured or just one of them?

Edited by matthew180
Link to comment
Share on other sites

If you have multiple pieces stacked on a square in the middle row (other than on the center Rosetta which is safe) and an opponent lands on them, the opponent removes all your pieces from that square and your pieces must begin again. The opponent then occupies that captured square.

 

Of course, the source code and resource files are included in the .zip file (#46) this thread in case anyone wishes to make their own rules.

Edited by SIO2
Link to comment
Share on other sites

These rules are a bit different from the ones from the British Museum. In the latter, you cannot stack pieces and if no dots show up on the dice then you lose a turn. I think this significantly changes the game dynamics compared to the rules that came with my version of the game and I might modify my engine to run these rules instead and see how the gameplay is :)

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...