19 Mar 2009

Reconstructing strategy in the game of Sinat

After commenter Hans told me that my Sínat game wasn't playing up to par with him, I decided to see whether I could code a better strategy into the game. I figured it shouldn't be hard to make an improvement. Afterall, the only thing the computer is programmed to do is to find a list of available moves and then pick a move randomly from that list. How could any strategy be worse than that?

A few days ago, I coded a new strategy on my computer to test out. Basically I told my program to evaluate each move and favour those moves which yielded greater protection of one's own pieces at the greatest expense of its opponent's protection. Seems right, yes? Apparently not. After I played the game, I still came out on top without much fuss and that got me a little curious.

So I decided that I would seperate my random algorithm from this new algorithm and have them battle it out. I called the "random" strategy Lateesha, for kicks, while I baptized the other "protection" strategy Shanequa. With Lateesha in red and Shanequa in blue I unleashed the two algorithms against each other for 20 turns to see what the statistical outcome would be.

The results were surprising. Our ol' lady of the block Lateesha won 55% of the time (11 out of 20 moves) over the new kid Shanequa!! What?? Yes, apparently randomness is better than being protective! It appears that this game does not reward overcautiousness because by being too focussed on one's own protection, one's pieces will be slower to get to the end of the board while one's opponent's pieces may pass one by. As a result, I've so far changed nothing in the A.I. programming.

Now I have to think up a better strategy. Back to the drawing board.

5 comments:

  1. Hello Glen!


    I have been playing a lot of Sinat these weeks.

    I already discovered that the simple strategy of "running as fast as you can" is the winning one. Blocking plays and protecting plays almost never are really effective.

    Human against human almost always ends in one pawn against one. This means luck plays a too important role to my taste.
    Playing against the "retarded monkey" the human wins about 85%.
    This is rather disappointing nevertheless. Humans should win more often if Sinat be a game of strategy. I am certain even the "retarded monkey" will become a formidable opponent if it can be persuaded not to jump into the water if it can avoid it! Also, in most cases it should avoid 25.

    On the Internet I found an extra rule, three pawns in a row forming a real obstruction. You are not allowed to jump over them, not even with a five or four.
    I don't think, however, this will make the game much more interesting (but 7 against 7 or 10 against 10 may be more affected.
    I would like to try these. On the computer, that is; with real pawns and dice/sticks/cards a 7 against 7 takes about an hour!).

    The dynamics of the game are such that humans, however hard they try, almost always reach a 1 to 1 endgame. In the long run the better player will win, but it better be a very long run.
    My friends are already bored with it!

    The game surely can be improved.
    As the rules are now it is already a good game for children (and for me).
    Thank you!

    ReplyDelete
  2. Hans: "I already discovered that the simple strategy of 'running as fast as you can' is the winning one."

    It strangely may be a better strategy but I'm not convinced that it's the best. I created a new algorithm last night I call Tyche as per your advice here. Yet since "run as fast as you can" is a little vague I had to interpret the *details* of what you really mean. Strangely by both working *against* the protection of both oneself and one's opponent, it faired much better than random Lateesha!

    However, I still beat it because I'm using a different strategy that's more defensive. So I just don't think this is the *best* strategy.

    What facts or evidence do you base your assertion on (ie. "Blocking plays and protecting plays almost never are really effective.")?

    Hans: "Human against human almost always ends in one pawn against one."

    How do you know? Have you played with all humans? This is where a computer algorithm like I have comes in. A programmer can spar perfectly executed strategies against each other to see which one comes out better in a way that is simply not possible with flawed humans who may not even be faithful 100% of the time to their own strategy.

    Hans: "I am certain even the 'retarded monkey' will become a formidable opponent if it can be persuaded not to jump into the water if it can avoid it!"

    Although I did explore the possibility that there's some small advantage to having a square in the water since it protects one's incoming piece on the House of Happiness, I still agree with you in the end.

    Hans: "Also, in most cases it should avoid 25."

    The House of Happiness square? I'm intrigued by the seemingly nonsensical statement. Could you explain? Isn't the whole point to get your piece on that square?

    Hans: "On the Internet I found an extra rule, three pawns in a row forming a real obstruction."

    I'm more interested in a historically plausible game over idle entertainment, so this is why I'm following Timothy Kendall's rules which are guided by Tâb.

    Hans: "As the rules are now it is already a good game for children (and for me)."

    That can't be possible historically considering that it was a game of royals (ie. adult royals) and I'm not convinced that its simplicity, or even its element of chance by throwing sticks, automatically means that it has no clever strategy. Consider the popular Asian game of Go which is much simpler than Sínat but which has a remarkable amount of strategy. So much so that programmers and mathematicians can't completely solve the game. I'm not aware of anyone solving Sinat yet either. Shouldn't we keep an open mind?

    ReplyDelete
  3. Hello Glen!


    To start with your last comment:
    Yes, you are right, we should keep an open mind. I have been rushing to conclusions.

    I should have explained "running as fast as you can". I meant to say, that you should try to get your front pawn out as quickly as possible, then your second one, etc.

    If you do this against a "blocking" opponent, the opponent just has not enough (only 5) pawns for an effective block. He will allow gaps long before the end game is reached, so you can escape. I must admit I never played against a well blocking player.

    I did not play against all humans, but all seven humans I played against (including a 12 year old child) almost always end up 1-1. some of these humans are very experienced chess players (2400+Elo), bridge players (International), backgammon players (Don't know their strength; I know the rules, but I am not a backgammon player.)

    25 is not the "house of happiness". It is the square before the house. It should be avoided in many cases, as it requires a 1 (25%) to reach 26, as opposed to 24 which requires a 2 (37.5%). Also, from 23 to 25 is normally useless as a 3 comes up just as often as a 1.

    The game as it is now is a very good one for children (like this 54 year old child).
    Compare Sinat to Chess: When Kasparov lost against Deep Blue, the program was constructed with help of grandmasters. Chess players expect programs that do not need more than "brute force". Already "Rybka" is much stronger than any human.
    Compare also to Go. It has been proved that a perfect program will never be made, as the number of possible sequences of moves far outnumbers the atoms in the Universe.
    Lastly, compare to Bridge (I am a Bridge player). The computer has no real chance against humans.
    Sinat resembles Ludo, which had been popular for a century now. This too is a game of strategy, but with luck playing a very important role.
    Backgammon too is a game of strategy with an element of luck.
    I am told that both Backgammon and Ludo can not be won against a computer. The computer needs no more than "brute force".

    I do not doubt it is relatively easy to calculate the best move for Sinat for any given position.

    Sinat as it is now is certainly an entertaining game.
    Could it be possible that this is just what the ancient royal Egyptians wanted? What else is known about the games they played?
    Did they play games of hazard at all?
    If Sinat was the only game with an amount of strategy, you seem to have done a good job already.

    ReplyDelete
  4. Running as fast as you can doesn't seem to be working for me. I've lost 3 out of 4 games with it.

    What seems to work for me is to split your forces into 2 group. One with two in a row and one with three in a row. 10 out of 16 times you can move a piece without disrupting a group (unless the path is blocked).

    ReplyDelete
  5. Hello Glen!


    During the last 20 hours or so I again played a lot of Sinat.
    It seemed to me I played against a "blocking" program.
    I played my own "running" game. Without even considering any other move. Obviously some of my moves were bad. It seemed only fair to me, as the blocking program had no choice either.

    The results:
    I won my 85%, just like against the "retarded monkey". This 85%, to be honest, was a rather lucky result. Had the luck been equally divided I should have won only about 70%.
    Your program in most cases lost "by one", which is considerably better than the retarded monkey, who often lost "by two" or "by three" (once even by five!).

    In all the games the pattern was like:
    stage 1) I got my first pawn out by the time a block had begun to form around 11-12.
    stage 2) This block had to break up or leave gaps.
    stage 3) My second pawn got out.
    stage 4) A new block developed somewhere near 22.
    At this stage I had to wait as the block really was effective. Quite boring; strategy at this stage playes only a minor role.
    The program got pawns out, but in the proces very often had to jump into the water, for lack of any other "ones". This generally gave me enough advantage. Sometimes I could hit a pawn left by the program on 28 or 29, giving me the same advantage.

    I think your "blocking" program can be greatly improved by giving it a way to recognize the "water dangers" in time.

    I also experimented with a (28)-29-30 block. Surprise! I won by four!
    But alas! Next time I tried I lost by three.
    Opportunities for this block do not come up that often. They are intriguing.
    I wonder. Did it matter to the ancient royal Egyptians by how many pawns/points the game was won?

    And a question: The number 4 is a lucky one for Sinat. It is required to get out of the water to the ankh. It is needed to get to 30. It gives speed at the start of the game.
    Was the number 4 something special for the Egyptians?

    ReplyDelete