Sign In Register

How can we help you today?

Start a new topic

I have a need for this handy javascript tool called Poker-evaluator


I am looking for a way that I could possibly use a tool like the following (poker-evaluator) in gamesparks cloud code.   The biggest problem I am having is that it has a .dat file that uses   "path" & "fs"  to read in the file.   There doesn't seem to be a way to do this.

What would be great if i could just type  

require('poker-evaluator');   and it was a feature of GameSparks.

Thoughts?  Help?  Any advice would be great.   The last thing I want to do is have to install this on a 3rd party service and then hit it from within gamesparks.

1 Comment

We actually have this functionality already on the platform. You can use it from within cloud code as follows:

var hand = ["2c", "9d", "ks"];

Spark.setScriptData("rank", Spark.getUtils().getCards().evaluateHand(hand));

This will result in the following response :

 "@class": ".LogEventResponse",
 "scriptData": {
  "rank": {
   "handName": "high card",
   "handType": 1,
   "handRank": 235,
   "value": 4587

Where valid card values are "2c", "2d", "2h", "2s", "3c", "3d", "3h", "3s", "4c", "4d",, "4h",, "4s",, "5c",, "5d",, "5h",, "5s",, "6c",, "6d",, "6h",, "6s",, "7c",, "7d",, "7h",, "7s",, "8c",, "8d",, "8h",, "8s",, "9c",, "9d",, "9h",, "9s",, "tc",, "td",, "th",, "ts",, "jc",, "jd",, "jh",, "js",, "qc",, "qd",, "qh",, "qs",, "kc",, "kd",, "kh",, "ks",, "ac",, "ad",, "ah",, “as”

Supports 3, 5 and 7 card hands.

Login to post a comment