The code for Skunk is found at http://www.dlugosz.com/Skunk1.zip.

I already found out something interesting, just from the brute-simple sample player that always rolls only once. 4 instances of the player will result in a wide spread of money changing hands, even though the number of individual game wins/losses is about 25% as you would expect.

Playing 10000 games. Sam (2536/7608) 1640 Judy (2528/7584) 931 Lloyd (2514/7542) 1134 Scott (2422/7266) -3705 [C:\work\dev\PerlSkunk]test2 test1 running loading sample1.skunk.pl Single Roller - Always rolls once. Playing 100000 games. Sam (25123/75369) 6037 Judy (24995/74985) -1504 Lloyd (24959/74877) -1948 Scott (24923/74769) -2585
The magnitude of the money spread grows with the total length of play, while the win/loss ratio should converge ever more accuratly to 25% as the length of plays increases.

This indicates that the money win/loss follows a fractal curve, with ever larger trends emerging the longer you play.

Ah, it's like a random walk! Which means I would expect the money to be +/- the square root of the number of games, further complicated by the fact that all the wins/losses must add up to zero.

So, I have documentation and a pretty good framework. I'd appreciate it if anyone reviewed the code to make sure there are no problems. And, anyone who wants to add a player robot is welcome to send it to me at 0binsnh002 "at" sneakemail.com (I'll change that once it gets on the spamlists).

Replies are listed 'Best First'.
Re: The game of Skunk
by John M. Dlugosz (Monsignor) on Jun 23, 2003 at 06:17 UTC
    Early results: In a tournament between Solo who always rolls once no matter what (even ignores run-for-it mode) and some other N-roller strategies, Solo wins the money, big-time! Even when he doesn't win the pot as often as others (that is, he doesn't win the most individual games), he comes out way ahead in the money. He doesn't skunk as often so he doesn't contribute as much to the pot as everyone else. When he does win, it's when everyone else was skunking a lot so the pot is big!

    In my initial thread, the suggested strategies all boil down to N-roller or M-points-per-turn.

    Somehow I think a more advanced strategy would compute the odds based on the current game state, so it would optomize its play against "dumb" opponents no matter what mix it found itself in.

    —John

Re: The game of Skunk
by smalhotra (Scribe) on Jun 25, 2003 at 18:29 UTC
    I wrote a random roller:
    package SkunkPlayer::Random; my $meta_object = { NAME => "Random Roller", DESCRIPTION => "Rolls randomly", CREATE => sub { new (__PACKAGE__, @_} } }; sub ask_to_roll { return (rand() < shift->{R}) ? 1 : 0; }
    I tested it with R => 0.5 (rolls 50% of the time) which did pretty good. Setting this higher, brought better results. Eventually I found that always rolling did pretty well (in fact, beat all the other players consistently), as a streak to 100 can mount pretty quickly.
      Very interesting! Thanks.

      There seems to be a bug somewhere else in the framework, though, since when I tested a player from your class I noticed that the win/loss stats aren't adding up!

      Bingo: line 156 in SkunkGame.pm is $Players[$last_player]->lose(); should be $Players[$_]->lose()

      That didn't affect the money totals, just the win/loss stat display. I think the bug you reported was more seriously affecting the stats... Solo might have been winning more because he was first.

      Anyway, I found that

      SkunkGame::create_player ("Single Roller", "Solo"); SkunkGame::create_player ("N Roller", "Trey"); SkunkGame::create_player ("N Roller", "Ducky", N => 2); SkunkGame::create_player ("Random Roller", "Randy", R => 0.50);
      consistantly gives results that Randy is the big loser at 7 to 7.5 chips per game, and Ducky wins 6 to 7 chips per game.

      As posted, R=1.0 would always skunk, as it doesn't know to stop when it does manage a hundred points.

      —John

Re: The game of Skunk
by smalhotra (Scribe) on Jun 25, 2003 at 20:21 UTC
    Bug: I think in the second stage of play(), shouldn't
    if ($score > $newscore) {
    be
    if ($newscore > $score) {
    And if that's the case, my super always better isn't really that good.
Re: The game of Skunk
by eric256 (Parson) on Jul 06, 2003 at 01:41 UTC
    The link appears to be broken. :-(

    UPDATE: downvoted for noting the link is down? Either way it still says "file not found" for me. Has anyone else been able to get it?