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 ...
30
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, ...
15
votes
Accepted
C++ Blackjack game
Members Vs Globals
It's odd that you have global variables defined in your Blackjack.cpp file. These:
...
13
votes
Implementation of a Card class in Java
Naming
Your Card class is currently composed of 3 fields, which represent its suit, its rank and its color:
...
13
votes
C# Card Shuffle
Performance
The shuffle implementation is very inefficient, as removing a random item from a list is inefficient. Searching for the element to remove is an \$O(n)\$ operation, and then removing it ...
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
Class to represent playing card
Use the types you have
Why are you storing the card value as an int? You have already created a CardValue enum, so use it. Change the ...
11
votes
Accepted
Deck of cards design
Card class
Specify the access modifiers of the class and members properly.
Use proper names for members:
...
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
"War" card game which includes betting "money" as well
Pretty nice - kudos.
If I were to point out some things - which of course I am, this being a review - it'd be your prototype/class structure.
You have a Card ...
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 "...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
playing-cards × 367python × 119
beginner × 108
game × 91
object-oriented × 80
java × 78
python-3.x × 62
c++ × 43
c# × 40
javascript × 36
performance × 19
random × 17
programming-challenge × 14
algorithm × 13
classes × 13
shuffle × 13
c × 11
console × 11
.net × 10
f# × 8
c++11 × 7
ruby × 7
python-2.x × 6
simulation × 6
community-challenge × 6