Coder Social home page Coder Social logo

poker-with-python's Introduction

Python Poker

Texas Holdem Poker made with Python and TKinter

module dependencies: PIL

showing gui

The organization of this repository and its branches is a work in progress. ihsansaktia is helping with this effort: https://github.com/ihsansaktia

youtube playlist I am making to explain this code: https://youtu.be/0_G9XElINRE

the "cards" folder holds all of the card images

there is an operating version found in master branch called 'texas_holdem_poker.py'

download the "cards" folder and make sure it is in the same directory where you launch the 'texas_holdem_poker v0.1.py' file.

All the other files are modulations of all the objects/functions. This is something I should have done in the first place, but I am still learning.

Discord: https://discord.gg/pFbdWx helped organized by Muhsin7: https://github.com/muhsin7

Some information about how I handled scoring, since it is the most complex part of the code IMO:

    #  scores for an individual player will look like:
    #  [score0, score1, score2, score3, score4, score5, score6, score7]
    #  a score, like score0, will be an integer
    #
    #  I put all scores from all players in a list
    #  so we will have a list of lists of integers, representing scores from all players
    #
    #  I take advantage of how the max() function works with lists of integers.
    #  max() looks at the integer at index 0 when provided with multiple lists.
    #  if the integers at index 0 are the same number for every list,
    #  it will then look at and compare the integer at the next index
    #
    #  score0 is used to indicate hand rank
    #  with 0 being lowest (high card) to 9 as highest (royal flush)...
    #  ranks found at: https://www.cardplayer.com/rules-of-poker/hand-rankings
    #              or  https://www.cardschat.com/poker-hands.php
    #
    #  score0, score1, and score2 are somewhat like score modifiers,
    #               score1 will tell us the value of the pair or the three of a kind
    #               if two pair: score2 will tell us the value of the lowest value pair
    #                            or even the value of the pair when there is a full house
    #  while score3 to score7 are initially set as the value of the five cards in the hand
    #      in the order from highest value 12 (ace) to lowest value 0 (two)
    #
    #  for example: if a player has no special hand like pairs or a flush,
    #               all modifier scores will be 0
    #               the player will have to rely on their highest card 
    #               which will start at score3.
    #               if any other player has a pair (score0 = 1)
    #               the max() function used on a list of lists of integers
    #                           will select the player with a pair...
    #               if no player has a special hand, then the high card will be the deciding factor
    #               if more than one player has the same high card
    #                       then the max() function will move on to next index
    #                       and the next highest card will be evaluated

poker-with-python's People

Contributors

ihsansaktia avatar jeremiah9000 avatar

Stargazers

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

Watchers

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

poker-with-python's Issues

Suggestion - Shrink your cards and put them into the .py file for a single-file solution

A solitaire card game was released recently that runs on PySimpleGUI. The cards were in a separate folder but since they're not all that large (153x200) it was possible to Base64 encode them and include them inside the code itself.

The result is a single .py file that can be distributed and run without any need for users to download another folder with a bunch of cards in them.

The total size came to 1.5 MB, which isn't bad considering the the PNGs themselves were over 1 MB when by themselves.

https://github.com/PySimpleGUI/PySimpleGUI/blob/master/UserCreatedPrograms/Klondike_Solitaire.py

I've done this on a number of card and other games in Python.

You may find it helpful for your project. Or maybe not. Just a suggestion.

Networking!

How do we get this code to run on different computers and have them talk to each other through a network?

Modularization of the project code

At present all the code is within one file. It would be benificial to moduralize the code, it will increase efficiency of code development, make things easier to debug and modify etc etc.

This was definitely raised beforehand somewhere, so work may well be underway already, if so PLEASE SAY!

Add branches to push updates.

Not much to say about it, I can't contribute because I don't have access to the master which is currently the only branch.

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.