Power Pinochle Forums

Full Version: Pinochle Bot Strategy Competition
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This thread is the tangent of the discussion of the rdwrites intro thread.
Rather than digress and lose searchability, I'll announce a future competition in its own thread.

...

I found the section of the book that was talking about the best conditional strategy competition...

In The Selfish Gene, Chapter 12 is called "Nice guys finish first".
Dawkins returns to John Maynard Smith's concept of Evolutionarily Stable Strategies (ESS).
see: https://en.wikipedia.org/wiki/Evolution_...y_of_Games

This time there is reference to the Prisoner's Dilemma.
https://en.wikipedia.org/wiki/Prisoner%27s_dilemma

Robert Axelrod was fascinated by the Prisoner's Dilemma, and he set out to find the ESS for the shockingly simple game...

Quote:He had the entertaining idea of running a competition, and he advertised for experts in games theory to submit strategies.  Strategies, in this sense, are preprogrammed rules for action, so it was appropriate for contestants to send in their entries in computer language.  Fourteen strategies were submitted.  For good measure Axelrod added a fifteenth, called Random, which simply played COOPERATE AND DEFECT randomly, and served as a kind of baseline 'non-strategy': if a strategy can't do better than Random, it must be pretty bad.

Axelrod translated all 15 strategies into one common programming language, and set them against one another in one big computer.  Each strategy was paired off in turn with every other one (including a copy of itself) to play Iterated Prisoner's Dilemma.  Since there were 15 strategies, there were 15 x 15, or 225 separate games going on in the computer.  When each pairing had gone through 200 moves of the game, the winnings were totalled up and the winner declared.

I'll stop citing Dawkin's book now, but it goes on to announce the winning strategy and its author and explains why it outperformed the others in the long term.

This is exactly what I want to do with Pinochle bots!!!
I will need to be the host, neutral party, and confidant. (in case authors want to keep their intellectual property a secret)
I'll need to figure out how I will set it up and what programming language I will use to run the simulator.

I am most confident writing in php and javascript/jquery, but in truth, any language that employs function calls would do.
The bot strategy submissions should be packaged as a single function for repeated calling.
The function would need to receive PN and deliver a valid action (a valid bid, trump suit, or thrown card)
The value provided by my simulator -- the parameter -- would be all of the hand data sets for the current hand up to that point.

Example#1 rdwrite's bot's first function call for the Auction phase (as Seat4) would be:
Code:
GameScores 302 280
Dealer Seat1
Deal1 CTTQJJ DKJJ SAKJJ HAAATKJJJ
Deal2 CAAAKQQ DTTKQQ STQQJ HATKQJ
Deal3 CTKJJ DAATQJ SATTTKKJ HTTQQ
Deal4 CATKKQ DAATKKQJ SAAKQQ HKKQ
Bids1 Pass Pass
The function would be expected to output a string --  a valid bid like Pass, 50, or other.

Example#2 Marya's bot's first function call for the Play phase (as Seat4) would be:
Code:
GameScores 0 0
Dealer Seat3
Deal1 CATTKJJ DTQJ SATTKQJ HATTKJ
Deal2 CAAKKQ DAAAKQ STTKQJ HAAQQJ
Deal3 CQQ DATKQJJ SKKJJ HATTKKQQJ
Deal4 CATTKQJJ DTTKKQJ SAAAQQ HKJ
Bids1 50 Pass Pass 51
Bids2 52 - - 60
Bids3 65 - - Pass
Contract Seat4 65 Clubs
Meld1 CJ DJ SKQJ HJ 10
Meld2 CKQ DKQ SKQ HQ 14
Meld3 C DKQ S HKKQQ 6
Meld4 CATKQJ DKQJ SQ H 21
The function would be expected to output a string -- a valid 2-character card to throw.


To enable all bot developers to design their own Bidding System, competitions will be formed by seating two identical bot copies on one team versus two identical bot copies on the other.

What an exciting notion!
I am usually very open to comparisons of this sort... it's an interesting idea, in principle! But I'm not sure if it makes sense for me. It seems to me that in participating, I have nothing to gain, and everything to lose. I know that my bots are inferior - they were coded by me, someone with only a rough understanding of Pinochle. Currently they are better than they were to start, but still have lots of room for improvement. Just so it's clear: World of Card Games is primarily intended to be a place for multiplayer card games between humans. Most of the work that I put in is to improve game play for humans. I try to tune the bots when I have time, but they are intended as a crutch to use when there are not enough human players around (even so, they are better than some humans...)

Anyway, it is practically a given that my bots will lose in a competition with expert bots or humans (and probably badly). Do I really want to advertise my site by its presence as last in a list of Pinochle bots? Not really...

I'm not quite sure what you have in mind regarding the source code, either. I wouldn't let the source out of my hands, and kind of find it hard to believe that anyone else would either. Would they? You can always ask... but for me, it's just too big a risk.

In addition, I would think that the chore of trying to patch together bot code from multiple programs (and programming languages) to run games would be a gargantuan task (assuming you got a lot of competitors).

But here's a suggestion. If you are going to run a competition, it should not be required that the bot code be in your hands, anyway. We're well into the internet age, and SaaS is the name of the game. It should be possible to run a game vs a bot API using a web service. Each competitor would have to provide a web service that responds to your REST calls. You run the central service that controls the game (dealt cards, trump, cards played etc), and you hit all the APIs that have been submitted.

That way you only have to write the controller code - the code that is in charge of dealing cards, making sure that all bots are returning legal plays, etc. You don't have to migrate code from 20 competitors into your competition software.

Now the problem is that you need to get any Pinochle software developers to write the web services to handle your REST calls. Might not be easy - commercial developers may not want to take the risk of competing and looking bad. They might not think it's worth the effort unless there were some big prize money. But I think it will be easier trying to get them to fork over their proprietary code.

Just my $.02.
I agree with everything marya said. I thought anything like this would be with API calls, and of course it will have to be.

I also understand and agree with marya's hesitation on particpating a bot competition. I was thinking more of a helpful thing than hey that's a loser botSmile My expertise is bot. I don't have the infrastructure in place to host tables and live players and that's not my interest. And World of Cards handles it well anyway. My niche is a unique level field rating game for humans (or bots with API I guess) to compete on leaderboard as best against the bot. It takes all the unfairness of partners you don't know or know too well out of a rating based on table play.

While I would be glad to add an API for this (for basically access only by this site) after I go live and gennerate notation etc., what would be of more interest I think is to create bot logic here and have it compete against other bots to improve the logic, discuss strategies and pros and cons of rule variations, etc.

I only give out the innermost thoughts of the bot when it parallels what I have written in my rules and tips for human players which also is what the bot does, but the logic is quite complex to implement. Personally I think it would be a great project for Power Pinochle where the logic is somehow edited in by multiple forum posters in a manner that is translated to PHP or a script that a PHP rules engine parses and executes, etc.

It would be an interesting and educational undertaking and a nice add to this site.
(03-26-2016, 04:27 PM)marya Wrote: [ -> ]It seems to me that in participating, I have nothing to gain, and everything to lose. I know that my bots are inferior - they were coded by me, someone with only a rough understanding of Pinochle.

Anyway, it is practically a given that my bots will lose in a competition with expert bots or humans (and probably badly). Do I really want to advertise my site by its presence as last in a list of Pinochle bots? Not really...

(03-26-2016, 04:27 PM)marya Wrote: [ -> ]I'm not quite sure what you have in mind regarding the source code, either. I wouldn't let the source out of my hands, and kind of find it hard to believe that anyone else would either. Would they? You can always ask... but for me, it's just too big a risk.

In addition, I would think that the chore of trying to patch together bot code from multiple programs (and programming languages) to run games would be a gargantuan task (assuming you got a lot of competitors).

But here's a suggestion. If you are going to run a competition, it should not be required that the bot code be in your hands, anyway. We're well into the internet age, and SaaS is the name of the game. It should be possible to run a game vs a bot API using a web service. Each competitor would have to provide a web service that responds to your REST calls. You run the central service that controls the game (dealt cards, trump, cards played etc), and you hit all the APIs that have been submitted.

That way you only have to write the controller code - the code that is in charge of dealing cards, making sure that all bots are returning legal plays, etc. You don't have to migrate code from 20 competitors into your competition software.

Now the problem is that you need to get any Pinochle software developers to write the web services to handle your REST calls. Might not be easy - commercial developers may not want to take the risk of competing and looking bad. They might not think it's worth the effort unless there were some big prize money. But I think it will be easier trying to get them to fork over their proprietary code.

(03-26-2016, 08:15 PM)rdwrites Wrote: [ -> ]I agree with everything marya said. I thought anything like this would be with API calls, and of course it will have to be.

I also understand and agree with marya's hesitation on particpating a bot competition. I was thinking more of a helpful thing than hey that's a loser botSmile My expertise is bot.

I certainly agree to allowing owners to "keep their card bots close to their chest".
After all, I was asking for others to trust me with their IP, so I will now have to trust that competitors will not rig their bots to "share" the dealt cards with their bot teammate.
It makes my role in the experiment much simpler, so I'm definitely okay with that.
API calls sound good.
I really only need to deal the cards, build the notation based on what transpires, deliver the appropriate notation to each bot, and record the completed hand histories -- easy.
Bots would need to receive the notation, and then output Bids, Trump suit if Declarer, Meld, and Thrown Cards in accordance with rules and in PN format.
I forget what Bridge calls it, but I would want to run duplicate hands while repositioning the teams so that both teams got to play both sides of an identical hand.  I think it is called Duplicate Bridge, but I don't play Bridge.

About the negative stigma of owning a losing bot...
My working mantra is that anything that is good for Pinochle will be good for the people that interact with it.
So, when someone says that one of my ideas to improve Pinochle will have a negative consequence, it immediately makes me step back and think deeply about why and how it could be.
When initially talking about developing a Pinochle notation that names players at the table, ToreadorElder arched up big time.  He said he would NEVER play at a site where his hand histories were shared publicly.  He put the highest value on his perfectionist online persona and also refused to play the Meld Test program for the same reason.
I don't think Marya suffers from the same vanity and I can see how it might devalue her site's Pinochle, so I will try to think of a different approach to include Marya.
In the end, there may not be a way to include Marya in the competition, but that doesn't have to be a bad thing.
We will undoubtedly uncover greater quality of analysis in the endeavor.
We will share the knowledge, and Marya can implement that knowledge however she pleases.

The more I think of the competition, it would be better for bot developers who DON'T have a Pinochle hosting Site.  And instead of offering a cash reward to the "winning" bot developer, maybe a site owner could offer to pay the bot developer for their IP.  This is totally theoretical -- Pinochle game hosting doesn't pay too well so there wouldn't be much of a monetary win for the developer.  Or of course, the best bot developer may decide to fully expose their source code as a generous act to benefit the game.  

One key point that I look forward to is the potential rise of new experimental Bidding Systems employed by bots.  The Play phase is generally much easier to code than the Auction phase, there is a lot more artistic license and room for refinement.