Coder Social home page Coder Social logo

jankodedic / poker.js Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 6.0 61 KB

Texas Hold 'Em Poker table model with convenience features for running real games.

License: MIT License

Python 2.41% JavaScript 5.03% C++ 92.56%
cpp javascript native nodejs poker texas-holdem

poker.js's People

Contributors

jankodedic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

poker.js's Issues

Hard crash on preflop.

In a 2 player game, before the flop, after the hand has started (only small and big blinds on the table). Raise, re-raise, fold will hard-crash the game with no error thrown.

I'm confused about what to do at showdown time.

It runs fine and awards the player who won but how do I get ahold of the winner and their hand? I can get table.holeCards() and table.communityCards(). Do I have to calculate what their hands were and which player index won? Any help is appreciated :)

Failed build on Macos

Hello

Poker.js installation is failed on my macos env.
I have installed new gcc and clang.

But when I try to run

yarn add poker

I have the following error.

error /Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker: Command failed.
Exit code: 1
Command: npx node-gyp configure && npx node-gyp build
Arguments:
Directory: /Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 2.7.10 found at "/usr/bin/python"
gyp info spawn /usr/bin/python
gyp info spawn args [
gyp info spawn args   '/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/6998/Library/Caches/node-gyp/12.4.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/6998/Library/Caches/node-gyp/12.4.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/6998/Library/Caches/node-gyp/12.4.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/addon/src/addon.o
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:60:3: error: cannot use 'try' with exceptions disabled
  try {
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:275:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(*this, status, Object());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:282:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(*this, status, Value());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:289:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(*this, status, Value());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:335:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:354:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, napi_undefined);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:397:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:408:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:419:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:438:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:449:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:460:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:476:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, Boolean());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:483:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, Number());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:490:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, String());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:497:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, Object());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:508:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(env, status, Boolean());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:525:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:536:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(env, status, Number());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/addon/src/addon.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/6998/.nvm/versions/node/v12.4.0/bin/node" "/Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker/node_modules/.bin/node-gyp" "build"
gyp ERR! cwd /Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v5.0.5

I've also tried to run installation with env set, for example

env CC=/usr/local/opt/llvm\@7/bin/clang CXX=/usr/local/opt/llvm\@7/bin/clang++ yarn add poker
# OR
env CC=gcc-8 CXX=g++-8 yarn add poker

Env:

  1. MacOS - 10.14.6
  2. Node - 12.4.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.