✅ I need help with a c# project (I'm a student)

Hello, I'm a student on my first year of programming. We're currently learning c# and we just got assigned to create a Black Jack game as a final project. Me and my project partners are stuck and we need some help.
21 Replies
Kouhai
Kouhai2y ago
What problem(s) are you facing?
Pobiega
Pobiega2y ago
Not many people will want to download a .rar to help. Is the code available on github perhaps? If not, can you make it available, or upload the important parts on $paste
MODiX
MODiX2y ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
Pobiega
Pobiega2y ago
And as many details on what the problem(s) are and what you have tried so far.
・vαinillα・
・vαinillα・OP2y ago
our problem is that we got stuck because we don't know how to structure the classes I have some of the code that is necessary, but from there I don't know how to continue
・vαinillα・
・vαinillα・OP2y ago
BlazeBin - enbzjuhkedzy
A tool for sharing your source code with the world!
Kouhai
Kouhai2y ago
If the solution has to be object oriented, then you'd have classes like Player, Deck, Card And looks like you already have that!
・vαinillα・
・vαinillα・OP2y ago
but we don't know what to put in each class, like which should inherit some classes At the moment we're trying to figure out how to shuffle the cards that we established on the array
mindhardt
mindhardt2y ago
If you are allowed to use LINQ I usually do something like
int[] cards = /*array of cards*/
int[] shuffled = cards.OrderBy(_ => Random.Shared.Next()).ToArray();
int[] cards = /*array of cards*/
int[] shuffled = cards.OrderBy(_ => Random.Shared.Next()).ToArray();
Literally orders by random function
・vαinillα・
・vαinillα・OP2y ago
we havent seen any of that yet, i dobut we're allowed to use it
Pobiega
Pobiega2y ago
you could also just google "fisher yates c#" and you'll get a shuffle implementation 🙂 its a tried and tested shuffle algorithm and that would go in your deck of cards, obviously - as you shuffle a deck, not an individual card I see no particular reason to use inheritance at all in a blackjack app
mindhardt
mindhardt2y ago
+, you don't seem to need it here
・vαinillα・
・vαinillα・OP2y ago
okay, we'll forget about inheritance for now. Back to the shuffle algorithm, it would be better if we made the shuffling by ourselves using a random or at least basic coding since we're supposed to use what we've been taught and we're just begginers
Pobiega
Pobiega2y ago
then do that. you can still look up what "fisher-yates shuffling" is and try to write code that implements that yourself
・vαinillα・
・vαinillα・OP2y ago
is this right?
Kouhai
Kouhai2y ago
Yup! That's correct! Though a small note Usually, you shouldn't make fields public public string valor; Instead use auto properties public string Valor { get ;set; }
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
・vαinillα・
・vαinillα・OP2y ago
BlazeBin - ppiaiethnqih
A tool for sharing your source code with the world!
・vαinillα・
・vαinillα・OP2y ago
How do I shuffle the cards and deal them? I'm not understanding come on and I'm getting involved every time ams
Kouhai
Kouhai2y ago
If you want to implement shuffling yourself you can try Fisher Yates method
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server