War Card Game | Sololearn: Learn to code for FREE!


War Card Game

I'm thinking about making the card game war in java. I was thinking about how to represent a deck of cards. Should I have one array with all the cards in it, or should I make two arrays, one with the suit and the other with the number? Any suggestions on this or on how to go about coding it are welcome. ;)

2/16/2017 1:45:11 AM


9 Answers

New Answer


www.bestprogramminglanguagefor.me did you get java?


@J.G. A few links to consider. Might help you get a clue on the base classes, arrays and structure in general: http://nifty.stanford.edu/2004/EstellCardGame/code.html# A full tutorial even for the average: http://www.dreamincode.net/forums/topic/116864-how-to-make-a-poker-game-in-java/


right! my bad! java offers fantastic oop so that shouldn't be a prob. :)


I tried it and got python...


Ahh... I didn't think of that. It will be interesting to try. Thank you for the suggestion. ;)


@Tristan I am not an HTML programmer, which is one of the reasons why everything you say is confusing to me. But I understand that, so okay. It would be better to do it in that instead of in java, but I just wanted to make something a little more difficult and have it record (output) the results.


Thanks for all of the help. I'm getting pretty busy right now, so it may be a while before I get back to you.


I'd create class "Card" with fields like, "color", "number" and "suit". Then create "Player" class which includes array of Cards objects. Hope it helped ^^


That's why I'm learning it (or one of the reasons)