Jump to content

Photo

Royal Game of Ur (old thread)


60 replies to this topic

#26 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Fri Dec 22, 2017 7:47 PM

Here you go :)

Attached File  20171221_121410.jpg   766.54KB   1 downloads
Attached File  20171221_121419.jpg   842.11KB   1 downloads
Attached File  20171221_121441.jpg   886.84KB   2 downloads
Attached File  20171221_121448.jpg   571.12KB   1 downloads

#27 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Fri Dec 22, 2017 8:05 PM

That is perfect.  If I just lie on my side, I can read them.  :)  Just kidding, they are great.  Thanks.



#28 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Fri Dec 22, 2017 8:49 PM

Sorry :) Uploaded from my tablet. Should be easy to rotate once downloaded.

#29 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Sat Dec 23, 2017 5:25 PM

Here is what I have done so far: typed those pages into a text editor (as best I could make them out) and added some notes as to what I think I understand.

 

Attached File  URBASIC.txt   6.08KB   6 downloads

 

 



#30 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Sat Dec 23, 2017 7:33 PM

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?

#31 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Sat Dec 23, 2017 8:03 PM

I have not tested it.  I am actually not planning to use my little Sharp computer. 

 

I will probably work up a version for the PC then perhaps try to run it on an Atari 7800.  



#32 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Sat Dec 23, 2017 8:47 PM

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, Sat Dec 23, 2017 8:58 PM.


#33 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Sat Dec 23, 2017 9:25 PM

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.

 

Attached File  PCUR.bas   6.16KB   2 downloads



#34 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Sat Dec 23, 2017 10:03 PM

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!

#35 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Sun Dec 24, 2017 5:21 AM

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.

 

Attached File  PCUR2.bas   8.17KB   2 downloads

 

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, Sun Dec 24, 2017 7:45 AM.


#36 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Sun Dec 24, 2017 9:27 AM

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.



#37 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Sun Dec 24, 2017 10:20 AM

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.  :)

 

Attached File  runpcur3.zip   1.19MB   6 downloads

 

BASIC code is in the .zip as well.


Edited by SIO2, Sun Dec 24, 2017 10:24 AM.


#38 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Sun Dec 24, 2017 11:12 AM

Runs great on the PC under Win 7. Displaying the arrays is a great idea.



#39 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Mon Dec 25, 2017 3:46 PM

Still having fun with this. :)

 

This version is for PC.  I added the option to play again and an intro with text rules and added display of pieces not in play to help with strategy if playing without a real board.

 

Attached File  runpcur3_1.zip   1.19MB   6 downloads


Edited by SIO2, Mon Dec 25, 2017 3:47 PM.


#40 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Tue Dec 26, 2017 7:45 PM

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.

 

Attached File  urshot.jpg   55.31KB   0 downloads

 

 

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

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

 

Attached File  Runpcur3_2.zip   1.22MB   4 downloads



#41 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Tue Dec 26, 2017 9:57 PM

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? 



#42 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Tue Dec 26, 2017 11:36 PM

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!



#43 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Wed Dec 27, 2017 10:34 AM

Thanks Vorticon.

 

Here is the fixed version for PC.

 

 

Attached File  runpcur3_3.zip   1.22MB   4 downloads



#44 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Wed Dec 27, 2017 10:48 AM

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
 



#45 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Wed Dec 27, 2017 12:46 PM

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! 



#46 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Wed Dec 27, 2017 10:16 PM

I have played quite a few games now and not had any further issues. :)

 

Here is the update.

 

Attached File  Runpcur3_4.zip   1.22MB   4 downloads

 

 



#47 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Wed Dec 27, 2017 11:03 PM

Great! Yeah I think we've rooted out the last of the bugs. I have to check out Just Basic when I have some time.



#48 matthew180 OFFLINE  

matthew180

    River Patroller

  • 2,529 posts
  • Location:Castaic, California

Posted Sat Dec 30, 2017 8:33 PM

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, Sat Dec 30, 2017 8:37 PM.


#49 SIO2 ONLINE  

SIO2

    Stargunner

  • 1,054 posts
  • Location:Nebraska

Posted Sat Dec 30, 2017 9:40 PM

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, Sat Dec 30, 2017 9:44 PM.


#50 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,216 posts
  • Location:Eagan, MN, USA

Posted Sat Dec 30, 2017 11:02 PM

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 :)






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users