pastly / cookerpoker Goto Github PK
View Code? Open in Web Editor NEWPoker game client/server in Rust WASM
Poker game client/server in Rust WASM
There are a few different error types floating around. Should probably unify them as 'real' errors which would allow us to use various error management libraries in the future.
I believe the thing card rooms do is pay the odd amount to the person in the earliest position.
Namely,
Turns out account IDs are i32. To avoid any possible confusion with other types that are just integers but aren't interchangeable, we should do type AccountID = i32
for these things and use AccountID
in place of i32.
I thought of this when working on #12.
This one variant doesn't seem to fall in line with the rest of them.
There a couple ways we could change this, in no particular order:
We don't really handle any situation right now as I write this, but as I work on the code, I'm realizing I'm not going to be handling situations such as the following, so this ticket is to record this fact.
See this random poker site I found with a DDG search for "allin raise less than minraise". See the Betting Rules for All-In Situations section:
What happens if a player goes all in with a bet or a raise but it's not enough for a full raise to be completed?
There are two common rules: the "full bet" rule or the half bet rule. If the "full bet" rule is in effect, as it usually is in No-Limit games, and the amount of an all-in is less than the minimum bet or the full amount of the previous raise, it's now a "real" raise and doesn't reopen the betting. If the "half bet" rule is in play if the amount is over half the minimum bet it is a raise and reopens the action.
Example: Player 1 bets $50 into the pot and the player that acts next goes all in for $65. As the extra $15 is not enough to constitute a "full raise" on Player 1's original bet, a third player can still raise instead of call as he has not yet had the option to raise. Player 1 would then be able to call or raise the amount of Player 3's raise.
If the third player just calls, however, Player 1 can't re-raise as it would essentially be re-raising his own original bet. Player 1 can only call the extra $15 from both players and would contest an extra side pot of $30 with Player 3. The main pot would have $50 from all three players in it for a total of $150.
So the table needs to:
I've already changed production sections of the file for our deployment. Any changes to this file in git will cause git pull
to not work.
I need to be able to specify to the poker-server binary my own untracked Rocket.toml.
Side pot logic requires I know not just the overall table winner, but the entire ranking of best hand to least best.
Desired api:
pub fn best_hands(hands: HashMap<i32, [cards; 7]>) -> Vec<Vec<(i32, [cards; 5]>
i32 is the account ID and tells me who the winner is, cards is obv the cards that won. Outer vec should be ordered be best ([0]) to worst([len-1]). Ties should be flattened to the inner vec, order doesn't matter.
There's probably some public domain slow cookers/grills/etc. clipart. Grab something and use it as a logo. I'm thinking
I've used the unicode characters for playing cards before, and that's what I was/am initially implementing.
I want to consider (as an option?) using SVG graphics of playing cards. Here is a set in the public domain (and some backs also in the PD).
https://openclipart.org/detail/315253/full-deck-of-ornate-playing-cards-english
https://openclipart.org/detail/315254/playing-cards-back
It looks like it would be easy, but tedious, to pull each individual card out of the source image. Not too bad really.
Pros for just characters:
Pros for SVG images:
See https://github.com/pastly/cookerpoker/blob/master/docs/client-server-api.md#action-epoch. Probably abstract GameInProgress::game_log to a type that stores, let's say, 2 full hands in 'live', private dequeue, and an 'archive' field with functions for draining by the server. State in the archive field is not reliable and should only be used (or not) by the server.
New clients will be sent the entire 'live' log, and older logs can be requested against the web server.
The above will lead to an event log suitable for an admin / someone with permission to see everything (including everyone's pocket).
Next, event filters should be added. Variants:
I've used mvp.css twice now (pastebin and blackjack site). I think we should grab it, change a couple colors, and use it at this point. Just so it looks significantly better, even if basic and bland still.
It should be dark (obviously :p), but if I pick this up, I should resist just copy/pasting the pastebin/bj version, thus having a 3rd site with the same color scheme.
Don't think this should go in game log, as clients will NEVER need the deck seed. Only reason server needs it is to re-build the game table, and if we're rebuilding the table we didn't have the game log anyway.
Incoming branch that demonstrates the issues.
- 1
. If there's one player, they should get card at index 51 and 50, but instead the function tries to give them card 51 and 51. Not possible.WXYZ
. First call for the first player's cards gives him ZX (assuming fix from #1 is impl). The second call gives second player Y ... and not W. Whatever is before W. Because Y and W are now next to each other at it is wrong to skip.I believe that we should .pop() .pop() to avoid this whole thing, even though it isn't how poker hands are dealt. It shouldn't matter mathematically.
Looks like there’s one that GitHub recommends and one that shows up when you google this issue. Pick something, test that it works, and merge to master.
Imagine the scenario:
The pot is not correct, and the hand should not be finalized. However, the pot currently accepts the uneven bet and will end up paying it out as if nothing were wrong.
The parent table struct should be enforcing valid bets. This does mean that the pot itself is not 'safe' by itself. The main reason this was offloaded was that the pot cannot verify the pot is valid (all non-folded players in for the same amount) without knowing which players are folded. This requires knowledge of who is seated at the table, which the pot does not have and cannot currently access.
Couple options:
There is currently two unit tests that test this behavior. multi_winners
assumes that option 1 is taken, and the pot simply doesn't behave correctly. The pot currently awards the overbets to the winner of the hand, regardless of if the pot was not correct. over_bet
the third option being implemented. These are mutually exclusive and no option should fix both tests.
I'm leaning towards option 4, while being the least concrete, should cover the majority of cases this could cause an issue in an actual game. Can likely implement both 3 and 4.
Diesel is 1.0 now and full featured, but "it's a lot sometimes." Rusqlite might be a better alternative.
Look at our options and pick something to start with.
IETF no longer recommends X- prefix on non-standard headers.
Host the static website generated by cargo doc
somewhere.
Also include the stdlib docs. The best solution I skimmed from here is to:
$ cp -a ~/.rustup/toolchains/stable-x86_64*/share/doc/rust/html/* target/doc/
$ cargo doc
Why is CurrentBetSet and MinRaiseSet different actions when they are very coupled ideas?
I don't think we have it. We need it.
Remove/make-private stuff that is unused and likely to continue to be unused. Anything that seems bj-specific should definitely go.
Do what https://github.com/pastly/cookerpoker/blob/master/docs/game-log-plans.md#way-forward says.
This issue more or less supersedes #41 and #42.
The list of things to do, taken from that document, is as follows:
logs_since
function.reveal
function to GameInProgress and the necessary Reveal
log item.There's builtin testing support in rocket.
If we want/need to reach for something larger, I have experience with Robot Framework. But honestly, it might be too heavy weight and corporate-y.
I have some experience with docker now, which might come in handy somehow?
I'm leaning towards setting something up that's bigger than Rocket's builtin testing support because I think it would be good to verify with external tools that the whole system end-to-end functions: an HTTP client can make a call to some endpoint, it returns success, and then opening the sqlite database reveals that the intended change was indeed made.
It's easy to login. It should be easy to logout. Ya know, without deleting cookies or manually editing them :)
edit: Oh I can just return to index.html to change my account. But still.
I'm writing tests in branch table-tests, and as I go, I'm documenting things here that I believe should be changed. Lmk if you think the current state is better in any of these cases.
Quick links:
Todo list:
view_tables_nonadmin
isn't finished. Any logged in person should be able to see an Open table. Augment this test to create a table, make it open, and see if a non-admin non-owner can see it.view_tables_admin
Admins should be able to see all tables, not just their ownget_table_settings_nonadmin
Regular logged-in users should not be able to see the details page for a table that is not owned by them. >> Form < UpdateTableSettings > data guard failed: Errors([Error { name: Some("table_type"), value: Some("Tournament"), kind: Int(ParseIntError { kind: InvalidDigit }), entity: Value }]).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.