playing-cards

C++ Deck Of Cards Shuffling Functions

匆匆过客 提交于 2019-12-24 04:47:19
问题 I am trying to build a poker game using C++. The deck shuffling function is giving me some issues. Every time that I run the program that initializes the deck, shuffles it, and then prints the deck I get the same output: Shuffling the cards and dealing... Printing deck... KD 6S 7D QD 5C JH 9S 6D 7H JD QH 3C 7S 3H TC 5D 5S 3D AD 7C 4H 6H JC TS 4D JS QC AH 9C 2D 5H 8C TD 4S 2S KS 2C 8D KC 2H 9H 6C KH 3S QS 8S 8H 4C AS AC 9D TH Using the classes Deck and Card I have the relevant functions

All possible combinations of card/poker hands for a set of players

北城以北 提交于 2019-12-23 22:39:13
问题 I am looking for an elegant(fast) python function that produces every combination from the following two arrays. cards = ["8H", "8S", "8C", "8D", "9H", "9S", "9C", "9D", "10H", "10S", "10C", "10D", "AH", "AS", "AC", "AD"] players = ["_1", "_1", "_1", "_2", "_2", "_2", "_3", "_3", "_3", "_4", "_4", "_4", "_To", "_To", "_To", "_Tc"] A combination would look like: [('8H', '_1'), ('8S', '_1'), ('8C', '_1'), ('8D', '_2'), ('9H', '_2'), ('9S', '_2'), ('9C', '_3'), ('9D', '_3'), ('10H', '_3'), ('10S

is Open GL a Overkill for a 2d Card Game?

孤街醉人 提交于 2019-12-23 19:20:18
问题 I was just have an idea of creating a card game and I was just thinking whether to use OpenGl or CoreAnimation.Can you please tell me whether it would be a bit of a overkill to use OpenGL for s 2D card game.Thanks :) 回答1: It's hard to say without knowing more. You can get pretty far using CALayers, images or drawing with quartz for the cards though. It really depends on the level of visual effects you are considering. If it's just moving cards around, then I'd say use layers. 回答2: Might want

Correctly using LINQ to shuffle a deck

人盡茶涼 提交于 2019-12-23 10:14:31
问题 I am attempting to write a simple card game. In an effort to come up with a good shuffling algorithm I came across Jeff Atwood's post on Coding Horror. However When I view the contents of the object after calling the Constructor they are not shuffled. Here is my attempt to use Jeff's Solution: class MainDeck : List<Card> { public MainDeck() { this.Add(new Card(1, "Hearts")); this.Add(new Card(2, "Hearts")); this.Add(new Card(3, "Hearts")); ... this.OrderBy(a => Guid.NewGuid()); } } here is

Android card based game, need help to start

£可爱£侵袭症+ 提交于 2019-12-18 18:21:52
问题 I'm just setting out in android development. I want to make a kind of card based game. I'm just looking for suggestions really on how I might start it. I know I have to make the menu layout and view, then use an Intent from that to get to the main game view. My sticking points are: There's going to be a deck of cards. It's going to be a set number so I was thinking I could just have each card defined as a button in the layout. I don't know if that is the right way to do it though. Storage of

Android card based game, need help to start

穿精又带淫゛_ 提交于 2019-12-18 18:21:09
问题 I'm just setting out in android development. I want to make a kind of card based game. I'm just looking for suggestions really on how I might start it. I know I have to make the menu layout and view, then use an Intent from that to get to the main game view. My sticking points are: There's going to be a deck of cards. It's going to be a set number so I was thinking I could just have each card defined as a button in the layout. I don't know if that is the right way to do it though. Storage of

How to prevent repeated random values?

落爺英雄遲暮 提交于 2019-12-12 04:15:20
问题 The CPU and User is getting repeated cards. I've used the shuffle function, as well as pop. Is there a way to prevent useer and CPU from getting repeated cards. Here is an example of the program compiled Here are your cards: 1) The 10 of Clubs 2) The 4 of Diamonds 3) The 6 of Diamonds 4) The 7 of Clubs 5) The 10 of Clubs To play cards, simply type their number one at a time. When done, input blank 2 1 3 4 You played: The 4 of Diamonds The 10 of Clubs The 6 of Diamonds The 7 of Clubs CPU

Implementing a `Card` class

我与影子孤独终老i 提交于 2019-12-11 07:32:07
问题 This program is about defining a class Card that generates a card whenever it is called (rank only, no suit). I did it a different way than the instructions so now I'm extremely confused on how this program is suppose to work. import random class Card: def __init__(self): self.__value = 0 def deal(self): self.__value(random.randint(1,13)) def set_value(self, value): self.value = set_face_value def get_value(): def set_face_value(self): faces = {1: "Ace", 2: "two", 3: "Three", 4: "Four", 5:

Algorithm for matching cards to a set of rules

泄露秘密 提交于 2019-12-11 04:01:54
问题 I've run into a peculiar problem which I don't seem to be able to wrap my head around. I'll get right into it. The problem is matching a set of cards to a set of rules. It is possible to define a set of rules as a string. It is composed of comma separated tuples of <suit>:<value> . For example H:4, S:1 should match Four of Hearts and Ace of Spades. It is also possible to wildcard, for example *:* matches any card, D:* matches any card with in the diamond suit, and *:2 matches a Two in any

Java: online card game library/class/e.g [closed]

夙愿已清 提交于 2019-12-10 19:33:56
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I am looking for java example solution/library/class for online card game. I'm interested in creating a non-profit version of a game called "Thousand", with functionality to play human vs human and human vs AI. I'll appreciate any kind of advise. 回答1: There's JPC-API which provides general playing card services