![]() |
Java Class and Array trouble mixup.
Excuse me beforehand but I'm french so I hope this still makes sense.
I've been writting a poker program using some pre-made classes (Suits, Values, Card and CardPack), and my own main class that the whole of my own code is going to be. So far it's all basic stiff, make 4 pools of points for the 3 npc's and the player, make an array of : Carte[] mainO1 = {PaquetCartes.piger(), PaquetCartes.piger(), PaquetCartes.piger(), PaquetCartes.piger(), PaquetCartes.piger()}; (which is basically Card[] handcomputer1 = {CardPack.draw()... And it's all so far so good, the trouble arises when I try to compare the hand with itself to see if the hand as any possible poker combination is present. So at first I had many ideas. mainly fiddling around with the Values place, but now I check my java book and every resources I have, and none get in deep enough to have examples or information on how to get an object (or class?) from an array of classes/objects (and so on). The hand is also put in order from weakest to best card (When I place the hand in the pre-made show hand method, it shows 2 Hearts, 4 Spades, A Clubs, etc. My big problem, in the end, is getting the values (or leaving them there and comparing them) of each of the 5 cell's and comparing them to each other to see what's what. Anyone as any imput, I hope I made myself clear enough. |
Oh well nevermind, I figured one of my problem out, but now I'm faced with another (albeit smaller) one.
Code:
import java.util.ArrayList;if (royalflush(main[]) == true) segment. It keeps telling me .class expected, but I don't know why. Knowing would also help me shorten my straight and royalflush methods by alot. Anyone as a clue about that? |
800 something views and no replies :/ Anyhow I got that part working too, simple silly mistake.
|
| All times are GMT +1. The time now is 06:52 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.