pluribus icon indicating copy to clipboard operation
pluribus copied to clipboard

make the code compile

Open MarekKosinski opened this issue 4 years ago • 7 comments

Hi,

I've downloaded your python port and I can't get it to compile - is it possible or it is not finished and the work must be done?

Thanks!

MarekKosinski avatar Mar 22 '20 11:03 MarekKosinski

getActionsFromInfoSet function is missing because it was not implemented in the original code. I asked @EAT-CODE-KITE-REPEAT but haven't heard back from him since. Also the deuces library has a different API so that needs to be fixed. So yes, work is very much needed in these areas. If anyone gets a working PR please let me know.

whatsdis avatar Mar 23 '20 04:03 whatsdis

I'm not asking for missing functionalities - I was wondering if this was by any chance compilable. I mean I've tried to compile it with Python 2.7, 3.6 and 3.8. Each time I had trillion syntax errors in the whole file. That's why I was wondering if this is something on my part or is this code simply not compilable yet?

MarekKosinski avatar Mar 23 '20 06:03 MarekKosinski

It works on nodejs in my repo @whatsdis getActionsFromInfoSet should do the exact thing as it's called. From the infoSet it should get a set of possible actions at that moment so it can iterate over those in the beginning of the script. Depending on how infoSet is implemented this is possible OR NOT, I think currently there is a problem and can't be implented yet because of the implementation of an infoSet. But I honestly think that this part of the code isn't even necessary:

function MCCFR_P(minutes = 1) {
  for (let p = 0; p < PLAYERS.length; p++) {
    Object.keys(treeMap).map(key => {
      const I = treeMap[key];
      if (getCurrentPlayerFromInfoSet(I.infoSet) === p) {
        const actions = getActionsFromInfoSet(I);
        let regretSum = [];
        let strategy = [];

        for (let a = 0; a < actions.length; a++) {
          regretSum[a] = 0;
          if (isPreflop(I)) {
            strategy[a] = 0; // 𝜙(Ii,a) = 0; not sure if this is correct
          }
        }
        treeMap[I.infoSet] = { ...I, regretSum, strategy };
      }
    });
  }

so that would make getActionsFromInfoSet uneccesary also

Karsens avatar Mar 23 '20 16:03 Karsens

@EAT-CODE-KITE-REPEAT thanks for the response. I will implement that in #3

@MarekKosinski No it does not yet compile due to issues #3 and #4 I've described previously.

whatsdis avatar Mar 23 '20 23:03 whatsdis

Do you have any syntax errors? (other than deuces library and getActionsFromInfoSet function)

MarekKosinski avatar Mar 26 '20 19:03 MarekKosinski

@MarekKosinski there are tons of syntax errors. The code uses // comments, for example. Rather look at the original stuff by @EAT-CODE-KITE-REPEAT or look at the poker_ai project.

theabhinavdas avatar Sep 04 '20 03:09 theabhinavdas

Please take a look from my commit: https://github.com/Mudr0x/pluribus/commit/c61606a076db12f6364ccee271d64dd9e760513e

I have corrected all code errors for Python 3.x (tested on Python 3.7) and now code is fully working.

However I don't really understand why you decide to translate Pluribus to Python the fact that NodeJS is very faster than Python (mostly for huge calculation) and I really certify this comparing NodeJS and Python code version speeds... Maybe for the fact that NodeJS cannot working with multiple cores with a shared memory and Python can (especially with its multiprocessing.shared_memory library), can you confirm me this?... But maybe NodeJS limitation for shared memory can be overcome with some solutions I mentionned here: https://github.com/Karsens/pluribus-poker-bot-js/issues/2

What do you think folks?

Mudr0x avatar Jul 23 '21 09:07 Mudr0x