Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: The game of Skunk

by smalhotra (Scribe)
on Jun 25, 2003 at 18:29 UTC ( [id://268944]=note: print w/replies, xml ) Need Help??


in reply to The game of Skunk

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.

Replies are listed 'Best First'.
Re: Re: The game of Skunk
by John M. Dlugosz (Monsignor) on Jun 26, 2003 at 04:56 UTC
    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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://268944]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-26 08:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found