Skip to main content
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 ...
Chris G's user avatar
  • 501
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 ...
holroy's user avatar
  • 11.5k
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 ...
indi's user avatar
  • 11.4k
28 votes

Deck of cards as an interview exercise

This is mostly how I would solve it (in Python): ...
Zah's user avatar
  • 450
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. ...
Joseph's user avatar
  • 25.1k
22 votes
Accepted

Making a deck of cards in Python

You could just use str.join in a list comprehension and create deck directly: ...
Graipher's user avatar
  • 41k
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: ...
Reinderien's user avatar
  • 62.4k
16 votes
Accepted

C++ Blackjack game

Members Vs Globals It's odd that you have global variables defined in your Blackjack.cpp file. These: ...
forsvarir's user avatar
  • 11.7k
16 votes
Accepted

Blackjack game interview task

Avoid repetitive code ...
mdfst13's user avatar
  • 21.6k
16 votes

Yu-Gi-Oh cards in Python 3

dataclasses.dataclass would single handedly remove the majority of your code. ...
Peilonrayz's user avatar
  • 43.4k
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, ...
Flater's user avatar
  • 5,542
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: ...
Tunaki's user avatar
  • 9,233
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 ...
janos's user avatar
  • 111k
13 votes

Simple Blackjack game in console

Avoid singletons private static Blackjack game; and later ...
mdfst13's user avatar
  • 21.6k
12 votes
Accepted

Comparable playing cards

Plain enum (unlike enum class) convert implicitly to integers, so there's no need for the ...
Toby Speight's user avatar
  • 76.9k
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 + ")." ...
Paul M.'s user avatar
  • 271
11 votes
Accepted

Deck of cards design

Card class Specify the access modifiers of the class and members properly. Use proper names for members: ...
I'll add comments tomorrow's user avatar
11 votes

Weekend Challenge - Poker Hand Evaluation

Almost four years later... I discovered a bug. Consider the following tests: ...
Simon Forsberg's user avatar
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 ...
chatton's user avatar
  • 1,496
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. ...
tobias_k's user avatar
  • 1,669
10 votes
Accepted

Beginnings of a Poker hand classifier part 2

...
Heslacher's user avatar
  • 50.4k
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 ...
Seth's user avatar
  • 209
10 votes
Accepted

Command line Blackjack

Instead of switch (choice) { case "n": gameLoop = false; break; default: break; } you could use something like the following: <...
JanDotNet's user avatar
  • 8,538
10 votes

Blackjack game interview task

main method In the main method, I don't think you should pass args to the ...
IEatBagels's user avatar
  • 12.4k
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. ...
downrep_nation's user avatar
10 votes
Accepted

Macau Card Game

CardProperties.hpp #pragma once Don't use #pragma once. It's not standard, it's not ...
indi's user avatar
  • 11.4k
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 ...
IEatBagels's user avatar
  • 12.4k
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 "...
Jamal's user avatar
  • 34.9k
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 ...
Aleksandr Hovhannisyan's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible