. I really just need someone that is better than me to give me ideas and thoughts on how to better my own understanding and any bad habits that might be visible from the code below. I rather break those bad habits now than later.
Carey Brown wrote:Some comments:
'suits' and 'cards' should be in all upper-case because it's a static final, ie a constant.
Too many static members, they should be non-static fields.
Only use under-scores (_) in constant names. Use camel-case for everything else. Eg change Card_Pool to cardPool.
Variable and method names should start with a lower-case. Eg PlayerTwo, and Start_Game.
Methods that check for the presence of something and returns a boolean usually begin with 'is', eg 'isWar' instead of 'Check_For_War'.
Program to interfaces. Eg use List<String> tempDeck = ArrayList<>();
Used Random class instead of Math.random.
Change randNum = (int)(Math.random()*deck.size()); to randNum = rand.nextInt( deck.size() );
Line 161, variable name of 'i' is usually reserved for integers. Perhaps 's' would be better.
Nice indenting.

No more Blub for me, thank you, Vicar.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
BrandonA Brown wrote:I am just now getting ready to learn the GUI part of it but before I get into all of that, I wanted to write a simple card game.
)
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
I read several threads on here before registering and one thread someone had mentioned to another to always put code in Code tags, so learned that before posting
Carey Brown wrote:You're welcome Brandon. Nice job of cleanup. If you do come back to refactor this at some point bear in mind Winston's comments about OO design.
...Regarding 'List':
BrandonA Brown wrote:I am not sure what you mean by to many static members. I think i add that keyword in there because that is all I know so far. Static makes it readable by the whole class? or I probably read that wrong.
Fred -> thanks for the Cow
I read several threads on here before registering and one thread someone had mentioned to another to always put code in Code tags, so learned that before posting
Winston -> Yeppers, I don't like the GUI side of programming. I took several classes in Visual Studio and it took away from the coding big time.
Stephan van Hulst wrote:Like Winston, I suggest you make a Card class that represents a playing card. I further suggest you add enums Card.Rank and Card.Suit.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
| Consider Paul's rocket mass heater. |