#feedback on my first game in c++ (cli)
21 messages · Page 1 of 1 (latest)
code looks really clean
you could use fallthrough to your advantage here ```cpp
int to_int(const Card &card) {
switch (card.rank) {
case Rank::jack:
case Rank::queen:
case Rank::king:
return 10;
default: return static_cast<int>(card.rank) + 1;
}
}
one minor formatting inconsistency, you write const Hand &hand but const Hand* winner
the asterisk position?
oh interesting, thanks
yep
ok thanks
in the definition of Deck::Deck(), why do you write i != 4 rather than i < 4? imo, the latter is clearer in intention
whats the difference between & and *, also, shoudl class/struct/enum names be PascalCase? also, should functions be snake_case or camelCase?
hm good point
int& is a reference, int* is a pointer? or do you mean something else
i.e in the case of const Hand &hand and const Hand *winner
like, one major difference is that pointers are reassignable and nullable
while references aren't
i see
using PascalCase for class/struct/enum is indeed common
oh, SuitSymbols and RankSymbols aren't one of those but are PascalCase anyway
entirely your own choice but i make my enum values PascalCase