![]() ![]() You are passing the Deck into the constructor, which is a good thing, but, because you don't change the _deck you should make it readonly. NET one shouldn't use snake_case casing for naming things and shouldn't use abbreviations like e.g cd_return. Looking at RemoveCard() I think you really should read the. If the validation fails the methods shouldn't return null but throwing an ArgumentOutOfRangeException. _deckDimension -> DeckDimension.īut still, this doesn't look right. NET Naming Guidelines methods should be named using PascalCase casing. ![]() But wait, _deckDimension isn't a field, its a property and therfor it should not be named using underscore-prefix. Having the condition like this public Card GetCard(int i) You should change the condition and maybe extract the validation into its own method. In both methods, GetCard() and RemoveCard(), the method-argument-validation is hard to read at first glance. Create a functionality for Calculate odds when player goes all in before river coming.Create a functionality for Hand Valuation.Create a functionality for distribute a Flop, Turn and River.I await advice and opinions about it and for the general improvement of the code. It makes sense because it is part of the context we are "modeling"Īnd could contain the logic for the comparison (Hand valuation) I have repeatedly asked myself if it makes sense to create a Hand class with two fields Card. How would you improve this code? How would you change the class design? I know there is a "Fisher Yates" algorithm for Shuffle() There are some methods like PrintDeck() and Order() that I have created only for testing. thread.sleep use for switch context and random generate not a two consecutive card Label1.Text = deck._deckDimension.ToString() If (!(i >= 0 & i = 0 & pos _hand īutton1 and some listbox for testing and see result private void Button1_Click(object sender, EventArgs e) Return " Value: " + Value + " Suit: " + Suid įoreach (Suit s in Enum.GetValues(typeof(Suit)))įoreach (Value v in Enum.GetValues(typeof(Value))) return base.ToString()+ " Value: " + Value + " Suit: " + Suid Now the code that working good : using System I look for suggestions to improve the quality of the design and also suggestions on possible improvements in style and logic. What I pay particular attention to is design: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |