GithubHelp home page GithubHelp logo

johnnyjayjay / poker Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 7.0 112 KB

A functional implementation of the game mechanics of Texas hold 'em and a Discord bot to play poker in chat

License: Other

Clojure 99.72% Dockerfile 0.28%
clojure discord discord-bot game hacktoberfest poker

poker's Introduction

Hi there ๐Ÿ‘‹

I am a both a hobbyist and professional programmer with a particular interest in the JVM and its languages (Java, Kotlin, Clojure). I also feel comfortable with Python and have basic knowledge of C, Rust and frontend web development (HTML, CSS, JavaScript). I have a general interest in functional programming and theoretical computer science.

In my spare time, I prefer writing libraries and tools for other programmers over applications with user interfaces. This reflects upon the majority of my open source projects.

Johnny's github stats

  • ๐Ÿ”ญ Iโ€™m currently working on discljord and a couple of own libraries and Discord bot projects

  • ๐ŸŒฑ Iโ€™m currently learning ActivityPub, FIDO2/WebAuthn, Software Licensing

  • ๐Ÿค” Iโ€™m looking for help with javidaloca, my prototype Java bindings to fluent-rs

  • ๐Ÿ’ฌ Ask me about Clojure, my projects and my experience studying computer science

  • ๐Ÿ“ซ How to reach me:

poker's People

Contributors

johnnyjayjay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

poker's Issues

Set presence on all shards

Currently only shard 1 gets the presence update ("Listening to @ Poker"). Functionality to send this to any shard is being added in the upcoming discljord release and it should be implemented.

Ensure big blind is always bigger than small blind

Currently it is allowed to start a game with the same value for big blind and small blind and this even happens automatically when you use a buy in of 100 chips (both default to 1 in this case). This causes issues with the stakes in the first round however, causing the game to immediately move on to the flop.
To fix this, custom inputs should be validated accordingly and the default minimum for big/small blind should be set to 2/1 instead of 1/1.

Wrong number of arguments passed to max-key

Occasionally, there is an error message stating that only one argument is passed to max-key when two are expected in bot.clj. This implies that the list of winners that is fetched there is either empty or nil, which should never happen.

UI rework

Discord is rolling out a lot of new features that could work perfectly for poker.

Slash Commands

Slash commands are already considered stable now, and it is already planned to support them in the form of a /holdem command. This will make it easier for the majority to understand and use the command options.

Components/Button Interactions

So far it is not clear when this feature will become visible to the public, but it is already live and functional in developer mode.
This adds clickable buttons to messages, which could be used to replace the manual typing of "check", "fold" and so on. Additionally, since those are part of the new interactions category, it is possible to send messages only visible to the user who clicked the button, so there could even be an in-place "View cards" button.

The only thing that would need to be rewritten further is the raise command, since that expects an additional argument. Discord's rate limits probably won't allow for this to be part of the UI, it will have to ask you to type the amount you want to raise to manually.

Message Threads

Just yesterday, Discord announced support for message threads, a kind of "mini-channels" in reference to one specific message. Messages in such threads are only visible to those who join the thread, while the "real channel" remains untouched. This might be a perfect fit for poker games. A separate channel for every game without having to actually create a real channel.
It might be best to make this optional first, via a thread option in the command for example. I could see this becoming the default in the future, though.

The purpose of this issue is just to write those ideas down and reference it in upcoming pull requests related to the UI.

Add Artificial Intelligence

It would be nice to be able to play against some sort of AI opponent.
I need to conduct more research on Poker AIs and come up with some function that makes a sensible move based on a given game state.

Internationalisation

The bot could provide an option to set a server-wide language (and use the preferred locale of the server by default).
This would require the introduction of some database, optimally sharing the systems used for the economy features (#1).

In terms of code, I could use some localisation system, like java.util.ResourceBundle or something more Clojure-specific. This could perhaps also be a good testing environment for my project fluent Java bindings.

I should make it possible for the community to submit translations, since I can only do so much by myself.

Remove in-game? check

Upon approving holdem!, the bot checks whether the executor is already in any active game anywhere. The way I see it, this check is actually redundant and does not need to be performed. To avoid confusion when you're in multiple games at once, the bot could instead mention the corresponding channel in its private card message instead.
To be honest, I forgot why I added this check in the first place. It seems redundant and very inefficient considering it takes linear time over all active games for each check.

Issue with cards

im running into an issue with the bot.

the cards arent displayed. All I see is:

"Community Cards:
:: :: :: :: ::
:: :: :: :: ::
Main pot: 15 chips"

and I also see in the console that the bot is being rate-limited

Add economy system

Currently, chips have no real value and are therefore pretty meaningless. The bot could become more interesting if players had an actual, limited balance of chips that they would increase by winning games.

This would involve a couple of changes such as a database to store the chips of each player. Also, it requires some balancing:

  • What's the initial amount of chips you get?
  • How can you get chips without winning games (to not make it frustrating and to be able to build a solid budget)?
    • daily reward?
    • voting on top.gg?

Highest scores on server, Highscores

I'd like to suggest adding command to the poker bot, showing highest scores players from server achieved. Like stats!.

Implementation could be made by creating one message on server which bot would edit when new highest score is reached.

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.