Results 1 to 5 of 5
  1. #1
    lostmind is offline Member
    Join Date
    Dec 2010
    Posts
    17
    Rep Power
    0

    Default 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

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    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!

  3. #3
    lostmind is offline Member
    Join Date
    Dec 2010
    Posts
    17
    Rep Power
    0

    Default

    Thank you for the replay again...


    Quote Originally Posted by Fubarable View Post
    [*]Do people play against the computer or do you have a couple of people around the computer playing against each other?
    Plays the Person versus the computer...


    Quote Originally Posted by Fubarable View Post
    [*]Is your game logic or model well separated from the GUI?
    Well.. more or less.. I separeted some of the logics and the GUI.. But the GUI package also was instructions the define the game.

    Quote Originally Posted by Fubarable View Post
    [*] Can you explain what each class does?
    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...

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    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.

  5. #5
    lostmind is offline Member
    Join Date
    Dec 2010
    Posts
    17
    Rep Power
    0

    Post

    Quote Originally Posted by Fubarable View Post
    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.
    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:

    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();
    
    
        }
    --- 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:

    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

  1. Replies: 3
    Last Post: 09-26-2010, 06:29 AM
  2. Making an aplication on top
    By RKhadder in forum New To Java
    Replies: 0
    Last Post: 09-25-2010, 12:28 AM
  3. Some Logical problem
    By MuslimCoder in forum New To Java
    Replies: 4
    Last Post: 03-01-2010, 08:12 AM
  4. Hibernate aplication Problem
    By Prashant.surwade in forum Advanced Java
    Replies: 6
    Last Post: 09-18-2009, 10:32 AM
  5. Logical JDBC problem
    By nick2price in forum Advanced Java
    Replies: 3
    Last Post: 10-02-2008, 11:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •