39
votes
Deck of cards as an interview exercise
No one but the folks who reviewed your code for the company can say with certainty why you were rejected.
It also depends on the position you're applying for. If you're applying for an entry-level ...
34
votes
Accepted
Object Oriented Design of Card Deck
So much to say, in so little space. This could be answered in so many ways, mainly due to why you need to model the cards. Without a proper context, the requirements will change and can thusly change ...
31
votes
Deck of Cards written in C++
Design review
Card
Let’s start by looking at the Card class. As designed, Card has 4 data ...
28
votes
26
votes
Accepted
Deck of cards as an interview exercise
While not strictly required, we value usage instructions, nicely-modeled data, automated tests, and thoughtful consideration of architectural decisions and simplicity-vs-completeness trade-offs.
...
22
votes
Accepted
Making a deck of cards in Python
You could just use str.join in a list comprehension and create deck directly:
...
19
votes
Accepted
Yu-Gi-Oh cards in Python 3
Trim redundant else
...here:
if len(self.main_deck) > 60:
return "You have to many cards in your deck (60)."
else:
...
16
votes
Accepted
16
votes
Yu-Gi-Oh cards in Python 3
dataclasses.dataclass would single handedly remove the majority of your code.
...
16
votes
Accepted
Card Shuffle without using any help C#
Modeling the real world
You've clearly drawn inspiration from the real world. That's a good thing. A lot of programming and the design that goes into it can be modeled based off of real life.
However, ...
13
votes
Simple Blackjack game in console
Avoid singletons
private static Blackjack game;
and later
...
12
votes
Accepted
Comparable playing cards
Plain enum (unlike enum class) convert implicitly to integers, so there's no need for the ...
12
votes
Yu-Gi-Oh cards in Python 3
Since you're using python 3.7, I would take advantage of f-strings.
For example, this:
return "That card hasn't been added to the game yet (" + card_to_add + ")."
...
11
votes
Weekend Challenge - Poker Hand Evaluation
Almost four years later... I discovered a bug. Consider the following tests:
...
11
votes
Simple Blackjack game in console
I wanna start of by saying that I think this code is to a very high standard for someone just completing their first project, the game is overall well put together.
So for this review I'm going to ...
10
votes
Making a deck of cards in Python
You can unpack the tuple directly in the list comprehension and use + to join the cards.
...
10
votes
Accepted
10
votes
Deck of cards as an interview exercise
I sympathise :)
I'm not sure if my answer will actually help much as it's either a rant or a list of hard work to do but hopefully it informs.
Interview tests are hopelessly flawed experiments
When ...
10
votes
Accepted
Command line Blackjack
Instead of
switch (choice)
{
case "n":
gameLoop = false;
break;
default:
break;
}
you could use something like the following:
<...
10
votes
Blackjack game interview task
main method
In the main method, I don't think you should pass args to the ...
10
votes
Poker dealer Hold'em
Overall the code seems ok.
But there are some things to consider which have to do with cleaner code and SOLID principles.
Firstly your variable names are confusing and not indicative.
...
10
votes
Accepted
Macau Card Game
CardProperties.hpp
#pragma once
Don't use #pragma once. It's not standard, it's not ...
9
votes
Accepted
Another attempt at a Blackjack game
Boolean used in conditions
Let's take the following example : if (skyIsBlue == true).
In a proper English sentence, we'd read :
If it is true that the sky is ...
9
votes
Yu-Gi-Oh cards in Python 3
I know you're trying to abbreviate "defense," but you could consider writing the whole thing out instead of making inconsistent naming with the preceding underscore. As such, you could write out "...
9
votes
Accepted
A Python Blackjack terminal based game
Card:
Consider renaming card_value to just value. Since it belongs to an instance of the ...
9
votes
8
votes
Find and display best Poker hand
Overall, this solution is quite good, especially if you are a beginner as you say. Each function has a clear purpose, and the docstrings are helpful. The docstrings could be improved by writing the ...
8
votes
The card game war
The other answer already mentions the Fisher-Yates Shuffle which is definitely what you want to use. I thought I'd break down your Shuffle a bit to show you why it's flawed.
This is what I consider ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
playing-cards × 371python × 121
beginner × 110
game × 95
object-oriented × 82
java × 79
python-3.x × 62
c++ × 44
c# × 40
javascript × 36
performance × 19
random × 17
programming-challenge × 15
algorithm × 13
classes × 13
shuffle × 13
c × 11
.net × 10
console × 10
f# × 8
c++11 × 7
ruby × 7
python-2.x × 6
simulation × 6
community-challenge × 6