Results 1 to 5 of 5
Thread: Logical problem in aplication
- 12-24-2010, 09:16 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 17
- Rep Power
- 0
Logical problem in aplication
Iīm developing a card game Called "TRUCO" with is a Stand-alone desktop application...
Well, the game dynamics works the following: Some one starts (pc our CPU) depending on who won the last 'game' , then, the 'person' that won the first round, starts the secound, and the person who won the secound, starts the third...
And the way I made the game, only the person that is playing is going to start... I mean, the person (not the cpu) is going to start the first round, the secound round and the third.. and that isnīt right...
The source code to my program is the following:
http://dl.dropbox.com/u/15625458/Truco.rar
I have it comment in portuguese.. sorry if you guys canīt understand!
Thanks for the help in advance.. lol
-
I'm going to include a link to the first thread you had on this game: Developing a Listener
A couple of questions:- Do people play against the computer or do you have a couple of people around the computer playing against each other?
- Is your game logic or model well separated from the GUI?
- If so, which classes are part of the model and which part of the GUI?
- Can you explain what each class does?
- Again, your chances of getting a decent and fast response will increase by orders of magnitude if you can create a small compilable runnable program that demonstrates your problem that we can test and modify, an SSCCE (please read the link). The smaller it is, the easier it would be for us to understand it and be able to help you. This small demo program should require no outside files or resources, so skip the fancy graphics and images, but rather should just show the program logic.
Much luck!
- 12-24-2010, 09:38 PM #3
Member
- Join Date
- Dec 2010
- Posts
- 17
- Rep Power
- 0
Thank you for the replay again...
Plays the Person versus the computer...
Well.. more or less.. I separeted some of the logics and the GUI.. But the GUI package also was instructions the define the game.
Sure i can :)
from package REGRA:
Carta.java is the class that builds the CARD ..
Computador.java is the computer, simbolizes the CPU player...
Juiz.java is the Judge
from package GUI
Conteins All imagens of the cards
Janela_Principal.java is the first Jframe that comes up...
Mesa.java is where the game starts.. has the table of the game, the CPU cards, and the PLAYER cards!
hope it is enough to help understanding the aplication!
Thanks again for the reply...
-
I tried to figure out your code, but given the size of the code, the language problems, and the variable naming used, I've failed, sorry. Again, if you can create an SSCCE, I would have a better chance, but for now, I'm going to pass on this and hope that someone smarter than me can look at your code. Best of luck.
- 12-24-2010, 10:21 PM #5
Member
- Join Date
- Dec 2010
- Posts
- 17
- Rep Power
- 0
Thank you for the effort ! Well if this helps iīll show you what is happening:
when the person clicks on the first card this is what is going to happen:
--- You see? The computer only "makes his move" after the person clicks on a card.. i need to figure a way to change that, and do as i said before:Java Code:private void cartaPC1ActionPerformed(java.awt.event.ActionEvent evt) { // sets the ICON of the label "cartaJogadaPC" that means the card //selected by the player will be shouln where it should be. cartaJogadaPC.setIcon(cartaPC1.getIcon()); //puts a new image icon at the button "cartaPC1" witch is the card that the person selected... cartaPC1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/blank.GIF"))); //variable "JogadaPC" means the card (object carta) that the person // selected... JogadaPC = lista.get(0); //disables the button so the person doesnīt click on it again cartaPC1.setEnabled(false); //NOW IS THE PART THAT I NEED TO CHANGE //variable "JogadaCPU" simbolizes the card the the computer is going to select // "cpu.fazerJogada" is a method i am calling from the "cpu" (object of "Computer.java") JogadaCPU = cpu.fazerJogada(JogadaPC); //"ganhou" is a string the will contein the name of the best "hand" (CPU or PC) ganhou = juiz.Verifica(JogadaPC, JogadaCPU); //method that will change icons of CPU "hand" and put it on the "table" marcaJogadaCPU(); //change round... atualizaRodada(); }
Winner of the first round is the person that plays next .. and the winner of the secound round is the person that plays the third!
By that code, you can see that the CPU only plays after the player.. and i need to change that!
Thanks!Last edited by lostmind; 12-24-2010 at 10:23 PM.
Similar Threads
-
My program has a logical error but i cant find problem
By s0meb0dy in forum New To JavaReplies: 3Last Post: 09-26-2010, 06:29 AM -
Making an aplication on top
By RKhadder in forum New To JavaReplies: 0Last Post: 09-25-2010, 12:28 AM -
Some Logical problem
By MuslimCoder in forum New To JavaReplies: 4Last Post: 03-01-2010, 08:12 AM -
Hibernate aplication Problem
By Prashant.surwade in forum Advanced JavaReplies: 6Last Post: 09-18-2009, 10:32 AM -
Logical JDBC problem
By nick2price in forum Advanced JavaReplies: 3Last Post: 10-02-2008, 11:34 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks