Code Monkey home page Code Monkey logo

poker-maison's Issues

User Folds Automatically Too Quickly

I just tried to spin this up for a few mates to play however after I place big and small blind it would just auto fold the user who took more than about 1 seconds.

I've tried looking through the code but not sure what is going on or why it is timing out so quickly.

Player state becomes undefined then just folds the user and moves on.

Module not found: Error: Can't resolve './Counter.bs'

ERROR in ./app/components/Profile.js
Module not found: Error: Can't resolve './Counter.bs' in '/home/user/haskell-poker/client/app/components'
@ ./app/components/Profile.js 3:18-41
@ ./app/containers/ProfileContainer.js
@ ./app/components/App.js
@ ./app/containers/AppContainer.js
@ ./app/app.js
@ multi eventsource-polyfill webpack-hot-middleware/client?reload=true ./app/app.js
「wdm」: Failed to compile.

GetProfile API Endpoint should also give some basic game stats for the user

The type representing the Servant API endpoint for getting the User's Profile is here

The API Endpoint handler for fetching a user's profile is here

It would be a good idea to add some basic game stats such as Hands played, total profit/loss over career, Big Blind win rate etc. This way players can have more insight into how they are playing.

You will of course need to add new record fields to the UserProfile type.

Extracting holdem game logic into separate package

We've talked in the past (dunno if you remember - 3 years ago maybe?).

Summary

Thanks for the great project :) Incoming wall of text, but I hope it is all to the point. I would like to migrate poker-maison to use a shared library for core poker type declarations (in src/Poker.Types) and for holdem game logic (src/Poker.Game.*). In general there is no need for each programmer to reimplement poker types and holdem (or any poker game) logic, and so if we get one solid and collaborated-upon set of libraries going, we'll have a better haskell-poker ecosystem! :)

My goal for these libraries is to be a good example of Haskell code. Nothing too fancy, but also nothing too simple, using the most common haskell features such as lens and mtl, so that an intermediate haskeller would feel comfortable and a beginner could come in without being overwhelmed.

I have already implemented the lion's share of the library, so I am here to check if you would be okay with migrating poker-maison to use my code. I have tested poker-maison with some of the migration, and it all looks good as far as I can tell.

What it would look like for poker-maison

poker-maison would use the new library for stuff like:

  • core poker types
  • next available actions for main street actions (preflop thru river)
  • stack sizes
  • basic poker types

Some things are not yet implemented not yet support (but would be added at a later date, likely by using your logic, if that's okay with you):

  • blind posting
  • showdown

Some notable differences:

  • I, as a rule, don't override Show or Read instances, since the libraries are aimed for all to use. Instead I implement pretty-simple's Pretty class, which I see you already use anyway.
  • I don't override Eq/Ord anywhere, since these instances can be used sometimes for Map and occasionally for serialisation. This only caused one minor issue with migrating poker-maison (see Poker.Game.Hands.sortByLength), which is easily fixed.
  • My goal is to have hand phase separation, so the game state type will be unique for each of blind-posting, post-card-deal (preflop thru river), and showdown (3 game state types in total).
  • My library is polymorphic in the bet type, but this would hidden from your code almost completely.
  • My library code uses State monad lens combinators extensively, but no other fanciness, and isn't too long (around 1000 lines excluding tests).
  • My test coverage is not yet a superset of your tests. Before merging, I would translate all your tests into my codebase (I already started the process locally). My code is tested and was tested by running around 10,000ish hands from my Bovada database through my holdem engine. The tests test both that all actions in the DB were accepted by my holdem engine, and that test-runner-generated invalid actions returned an error for all acts for all hands. I will also be augmenting these tests with a 1,000,000 hand database (including heads-up hands) from PokerStars once I have a parser for PokerStars hand histories.
  • I don't account for table actions such as Timeouts and LeaveSeats, which would be translated to my "BetAction", which are the in-a-vacuum available actions to a player. For example, your "Action" type might look something like the following:
data Action
  = SitDown Player -- doesnt progress the game
  | LeaveSeat' -- doesnt progress the game
  | PostBlind Blind
  | ShowHand
  | MuckHand
  | SitOut
  | SitIn
  | Timeout
  | FromBetAction BetAction

The migration process

I would be happy to do this migration all myself, and do so incrementally to make it more reviewable for you! I don't expect the patches to be too involved/arduous.

If you're open to the process, the only thing that I would ask from you would be whether I could make changes to the build system for poker-maison. In particular I was having trouble with having a good IDE setup, likely because of the following github issue haskell/haskell-language-server#1822. Would you be okay with a cabal based build instead of stack? The trade off would be slightly more verbose builds (you have to add each file to the .cabal file) which is definitely annoying, but as a reward we don't get an infuriating bug that means you have to persistently restart the IDE each time you edit library code while working on a test.

The process would overall look like this:

  • integrate with poker-base, which is here. This code will definitely experience more cleanups, and I'd like to get to 90+% test coverage (up from ~70%)
  • integrate with poker-game which lives here. This would be the harder part, but I can show in a PR maybe this weekend?

Monthly League Format?

Have a monthly league where placing in a good position grants some kind of badge for players.

This would be a simple incentive for competitive play despite the lack of money involved.

Add support for side pots

The core of the poker game logic lives in Game.hs.

At the moment only single pots are supported.

What we need is side pots.

For an explanation of how they work check this out.

Do not /login

Status: 401 Unauthorized 0.020413627s

In everything wrote this, /register is working, but already wrote that

why on token generation write: Left KeySizeTooSmall ???

Connect remotely

When I am making requests to create a new user or login, its trying to connect to a localhost url.. how do define the URL or or IP of the server?

Thanks!

Player's Max Bet Should Be Limited

Limit a player's max bet according to either their chip count or the next largest player in the hand's chipcount. Which ever is smaller.

This would prevent the current bug where a player can raise more than an opponents chip stack in a 1v1.

Unable to Build

Windows 10
Docker version 19.03.8, build afacb8b
Help!

PS C:\Users\DELL-XPS730x\Desktop\ten-poker-master> docker-compose up
Building server
Step 1/8 : FROM fpco/stack-build-small
---> 5aab45466769
Step 2/8 : RUN mkdir -p /app
---> Using cache
---> d464935159cc
Step 3/8 : COPY . /app
---> Using cache
---> c6b5323f889e
Step 4/8 : WORKDIR /app
---> Using cache
---> e93007258dd8
Step 5/8 : RUN apt-get update && apt-get install libpq-dev lzma-dev libpq-dev -yy
---> Using cache
---> c5fa874e24ac
Step 6/8 : RUN stack build --only-dependencies
---> Running in 7f5d4fb23662
Segmentation fault
ERROR: Service 'server' failed to build: The command '/bin/sh -c stack build --only-dependencies' returned a non-zero code: 139
PS C:\Users\DELL-XPS730x\Desktop\ten-poker-master>

Add more Lobby tables when existing ones become full.

The amount of tables in the game lobby should automatically adjust when the existing tables begin to fill up.

A sensible default would be to say that there should be at least two tables with free seats which can be taken.

Feel free to add this logic to the Lobby.hs file.

cd server && stack run gives error

tuguldur@tuguldur-Inspiron-3537:~/Downloads/poker-maison-master/server$ stack run
poker-server-exe: Missing dbConnStr in env
CallStack (from HasCallStack):
error, called at src/Env.hs:46:18 in poker-server-0.1.0.0-1noFjA1fxcLE6B4gEAhgPz:Env

Remove action buttons from game UI which represent invalid actions

The game view in the UI presented to a player when sat at the table has a panel of buttons representing game actions.

Currently only two sets of buttons are shown for players depending whether they are sat in a game or not.

What we want is to only show buttons with actions which are valid for the given game state.

Here is an example. if a player has raised before you, then you will still be presented with a check button. As a check action isn't possible during a round after a previous player has raised in the game of poker. This button shouldn't be shown to the player in such a situation.

The front end has a Redux store which contains the game state as a JS object. So the task would be to add action validation functions and alter the game action panel React component so that only buttons with valid actions according to the rules of poker are shown to players.

To help you determine which actions are valid depending on certain game states then look at the ActionValidation.hs file on the back end. Essentially you would need to rewrite most of this logic in Javascript and put this validation logic in the selectors.js file on the front end.

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.