Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 19 of 19

Thread: Game over method not updating correctly

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Game over method not updating correctly

    If I run this code. I can manipulate it so that X wins. When the third X button is pressed, there is no display saying that X has won and that the game is over. I have read over this code for days and still have not figured it out. Please don't give me the answer exactly. I really want to become a better programmer.


    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
     
    public class TicTacToe extends JFrame implements ActionListener, WindowListener{
     
    	public JFrame window = new JFrame("window");
    	public JButton button1 = new JButton("");
    	public JButton button2 = new JButton("");
    	public JButton button3 = new JButton("");
    	public JButton button4 = new JButton("");
    	public JButton button5 = new JButton("");
    	public JButton button6 = new JButton("");
    	public JButton button7 = new JButton("");
    	public JButton button8 = new JButton("");
    	public JButton button9 = new JButton("");
    	public String letter = "";
    	public String lastLetter = "";
    	public int count = 0;
    	public boolean win;
    	public boolean isTieGame;
     
    	//Buttons added, window made visible
    	public TicTacToe()
    	{
     
    		window.setSize(300,300);
    		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		window.setLayout(new GridLayout(3,3));
    		window.setName("Tic Tac");
     
     
    		window.add(button1);
    		window.add(button2);
    		window.add(button3);
    		window.add(button4);
    		window.add(button5);
    		window.add(button6);
    		window.add(button7);
    		window.add(button8);
    		window.add(button9);
     
    		button1.addActionListener(this);
    		button2.addActionListener(this);
    		button3.addActionListener(this);
    		button4.addActionListener(this);
    		button5.addActionListener(this);
    		button6.addActionListener(this);
    		button7.addActionListener(this);
    		button8.addActionListener(this);
    		button9.addActionListener(this);
     
    		window.setVisible(true);
    		}
     
    	public static void main(String[] args) {
    		new TicTacToe();
    	    }
    	public boolean isGameOver()
    	{
    		//Button 1 2 3
    		if(button1.getText() == button2.getText() && button2.getText() == button3.getText() && button1.getText() != "")
    		{
    			win = true;
    		}
    		else if(button4.getText() == button5.getText() && button5.getText() == button6.getText() && button4.getText() != "")
    		{
    			win = true;
    		}
    		else if(button7.getText() == button8.getText() && button8.getText() == button9.getText() && button7.getText() != "")
    		{
    			win = true;
    		}
    		else if(button1.getText() == button5.getText() && button5.getText() == button9.getText() && button1.getText() != "")
    		{
    			win = true;
    		}
    		else if(button3.getText() == button5.getText() && button5.getText() == button7.getText() && button3.getText() != "")
    		{
    			win = true;
    		}
    		else if(button1.getText() == button4.getText() && button4.getText() == button7.getText() && button1.getText() != "")
    		{
    			win = true;
    		}
    		else if(button2.getText() == button5.getText() && button5.getText() == button8.getText() && button2.getText() != "")
    		{
    			win = true;
    		}
    		else if(button3.getText() == button6.getText() && button6.getText() == button9.getText() && button3.getText() != "" )
    		{
    			win = true;
    		}
    		else
    		{
    			win = false;
    		}
    		return win;
    	}	
    	public void counter()
    		{
    			if(count == 1 || count == 3 || count == 5 || count == 7 || count == 9)
    			{
    				letter = "X";
    			}
    			else
    			{
    				letter = "O";
    			}
    		}
    	public void endOrReset()
    		{
    			if(win == true)
    			{
    				JOptionPane.showMessageDialog(null, lastLetter() + " WINS!");
    				int playAgain = JOptionPane.showConfirmDialog(null, "Would you like to play again?", "Play Again.", JOptionPane.YES_NO_OPTION);
    				if(playAgain == JOptionPane.YES_OPTION)
    				{
    				win = false;
    				}
    				else if(playAgain == JOptionPane.NO_OPTION)
    				{
    					JOptionPane.showMessageDialog(null, "Goodbye");
    					System.exit(0);
    				}
    			}
    			else if(isTieGame == true)
    				{
    				JOptionPane.showMessageDialog(null, "Tie Game!");
    				int playAgain = JOptionPane.showConfirmDialog(null, "Would you like to play again?", "Play Again.", JOptionPane.YES_NO_OPTION);
    				if(playAgain == JOptionPane.YES_OPTION)
    				{
     
     
    				}
    				else if(playAgain == JOptionPane.NO_OPTION)
    				{
    					JOptionPane.showMessageDialog(null, "Goodbye");
    					System.exit(0);
    				}
    				}
     
    		}
    	public void actionPerformed(ActionEvent a) {
     
    		count++;
    		isGameOver();
    		endOrReset();
    		counter();
     
    		//method needs to return win or loss as count is updated
    		if(a.getSource() == button1)
    			{
    			button1.setText(letter);
    			button1.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource() == button2)
    		{
    			button2.setText(letter);
    			button2.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    		} 
    		else if(a.getSource() == button3)
    		{
    			button3.setText(letter);
    			button3.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    		} 
    		else if(a.getSource() == button4){
    			button4.setText(letter);
    			button4.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource() == button5)
    		{
    			button5.setText(letter);
    			button5.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource() == button6)
    		{
    			button6.setText(letter);
    			button6.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource() == button7)
    			{
    			button7.setText(letter);
    			button7.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource() == button8){
    			button8.setText(letter);
    			button8.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource() == button9){
    			button9.setText(letter);
    			button9.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			}
     
       }
     
    	@Override
    	public void windowActivated(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowClosed(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowClosing(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowDeactivated(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowDeiconified(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowIconified(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowOpened(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}	
    	public String lastLetter()
    	{
    		String lastLetter;
    		if(letter == "O")
    		{
    			lastLetter = "X";
    		}
    		else
    		{
    			lastLetter = "O";
    		}
    		return lastLetter;
    	}
    	public boolean isTieGame()
    	{
    		if(count >= 9 && win == false)
    		{
    			isTieGame = true;
    		}
    		return isTieGame();
    	}
    	}
    Last edited by Blykon; September 4th, 2014 at 07:29 PM.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Game over method not updating correctly

    Just had a quick look: why do you check if the game is over before you update the button with 'X' or 'O'?

    Update: just ran your code and due to the above problem it reports that the wrong player wins.
    Improving the world one idiot at a time!

  3. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Game over method not updating correctly

    Junky, that was an issue I hadn't noticed. My main issue is it updating the win a whole count value after the win happens. So if you click a third x in a row, you have to click another O for it to say you won, last turn.

    Quote Originally Posted by Junky View Post
    Just had a quick look: why do you check if the game is over before you update the button with 'X' or 'O'?

    Update: just ran your code and due to the above problem it reports that the wrong player wins.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Game over method not updating correctly

    One possible problem I see: using == to compare Strings instead of the equals() method.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Sep 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Game over method not updating correctly

    Quote Originally Posted by Norm View Post
    One possible problem I see: using == to compare Strings instead of the equals() method.
    I fixed that and it still takes an extra count to display the winning message.

  6. #6
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Game over method not updating correctly

    Because you are doing things in the wrong order!
    Improving the world one idiot at a time!

  7. #7
    Junior Member
    Join Date
    Sep 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Game over method not updating correctly

    Quote Originally Posted by Junky View Post
    Because you are doing things in the wrong order!
    Updated code
    -Changed to .equals()
    -Changed the order of the methods

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
     
    public class TicTacToe extends JFrame implements ActionListener, WindowListener{
     
    	public JFrame window = new JFrame("window");
    	public JButton button1 = new JButton("");
    	public JButton button2 = new JButton("");
    	public JButton button3 = new JButton("");
    	public JButton button4 = new JButton("");
    	public JButton button5 = new JButton("");
    	public JButton button6 = new JButton("");
    	public JButton button7 = new JButton("");
    	public JButton button8 = new JButton("");
    	public JButton button9 = new JButton("");
    	public String letter = "";
    	public String lastLetter = "";
    	public int count = 0;
    	public boolean win;
    	public boolean isTieGame;
     
     
    	public TicTacToe()
    	{
     
    		window.setSize(300,300);
    		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		window.setLayout(new GridLayout(3,3));
     
     
     
    		window.add(button1);
    		window.add(button2);
    		window.add(button3);
    		window.add(button4);
    		window.add(button5);
    		window.add(button6);
    		window.add(button7);
    		window.add(button8);
    		window.add(button9);
     
    		button1.addActionListener(this);
    		button2.addActionListener(this);
    		button3.addActionListener(this);
    		button4.addActionListener(this);
    		button5.addActionListener(this);
    		button6.addActionListener(this);
    		button7.addActionListener(this);
    		button8.addActionListener(this);
    		button9.addActionListener(this);
     
    		window.setVisible(true);
    		}
     
    	public static void main(String[] args) {
    		new TicTacToe();
    	    }
     
    	public void counter()
    		{
    			if(count == 1 || count == 3 || count == 5 || count == 7 || count == 9)
    			{
    				letter = "X";
    			}
    			else
    			{
    				letter = "O";
    			}
    		}
    	public boolean isGameOver()
    	{
    		//Button 1 2 3
    		if(button1.getText().equals(button2.getText()) && button2.getText().equals(button3.getText()) && button1.getText() != "")
    		{
    			win = true;
    		}
    		else if(button4.getText().equals(button5.getText()) && button5.getText().equals(button6.getText()) && button4.getText() != "")
    		{
    			win = true;
    		}
    		else if(button7.getText().equals(button8.getText()) && button8.getText().equals(button9.getText()) && button7.getText() != "")
    		{
    			win = true;
    		}
    		else if(button1.getText().equals(button5.getText()) && button5.getText().equals(button9.getText()) && button1.getText() != "")
    		{
    			win = true;
    		}
    		else if(button3.getText().equals(button5.getText()) && button5.getText().equals(button7.getText()) && button3.getText() != "")
    		{
    			win = true;
    		}
    		else if(button1.getText().equals(button4.getText()) && button4.getText().equals(button7.getText()) && button1.getText() != "")
    		{
    			win = true;
    		}
    		else if(button2.getText().equals(button5.getText()) && button5.getText().equals(button8.getText()) && button2.getText() != "")
    		{
    			win = true;
    		}
    		else if(button3.getText().equals(button6.getText()) && button6.getText().equals(button9.getText()) && button3.getText() != "" )
    		{
    			win = true;
    		}
    		else
    		{
    			win = false;
    		}
    		return win;
    	}
    	public void endOrReset()
    		{
    			if(win)
    			{
    				JOptionPane.showMessageDialog(null, lastLetter() + " WINS!");
    				int playAgain = JOptionPane.showConfirmDialog(null, "Would you like to play again?", "Play Again.", JOptionPane.YES_NO_OPTION);
    				if(playAgain == (JOptionPane.YES_OPTION))
    				{
    				win = false;
    				}
    				else if(playAgain == JOptionPane.NO_OPTION)
    				{
    					JOptionPane.showMessageDialog(null, "Goodbye");
    					System.exit(0);
    				}
    			}
    			else if(isTieGame == true)
    				{
    				JOptionPane.showMessageDialog(null, "Tie Game!");
    				int playAgain = JOptionPane.showConfirmDialog(null, "Would you like to play again?", "Play Again.", JOptionPane.YES_NO_OPTION);
    				if(playAgain == JOptionPane.YES_OPTION)
    				{
     
     
    				}
    				else if(playAgain == JOptionPane.NO_OPTION)
    				{
    					JOptionPane.showMessageDialog(null, "Goodbye");
    					System.exit(0);
    				}
    				}
     
    		}
    	public void actionPerformed(ActionEvent a) {
     
    		count++;
    		counter();
    		isGameOver();
    		endOrReset();
     
     
     
    		if(a.getSource().equals(button1))
    			{
    			button1.setText(letter);
    			button1.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource().equals(button2))
    		{
    			button2.setText(letter);
    			button2.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    		} 
    		else if(a.getSource().equals(button3))
    		{
    			button3.setText(letter);
    			button3.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    		} 
    		else if(a.getSource().equals(button4))
    		{
    			button4.setText(letter);
    			button4.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource().equals(button5))
    		{
    			button5.setText(letter);
    			button5.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource().equals(button6))
    		{
    			button6.setText(letter);
    			button6.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource().equals(button7))
    			{
    			button7.setText(letter);
    			button7.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource().equals(button8)){
    			button8.setText(letter);
    			button8.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			} 
    		else if(a.getSource().equals(button9)){
    			button9.setText(letter);
    			button9.setEnabled(false);
    			System.out.println( "" + count);
    			System.out.println("" + win);
    			}
     
       }
     
    	@Override
    	public void windowActivated(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowClosed(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowClosing(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowDeactivated(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowDeiconified(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowIconified(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void windowOpened(WindowEvent e) {
    		// TODO Auto-generated method stub
     
    	}	
    	public String lastLetter()
    	{
    		String lastLetter;
    		if(letter == "O")
    		{
    			lastLetter = "X";
    		}
    		else
    		{
    			lastLetter = "O";
    		}
    		return lastLetter;
    	}
    	public boolean isTieGame()
    	{
    		if(count >= 9 && win == false)
    		{
    			isTieGame = true;
    		}
    		return isTieGame();
    	}
    	}

  8. #8
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Game over method not updating correctly

    Is it working?
    Do you have a question?

    BTW that massive if statement you have in your action performed method can be replaced with:
    ((JButton)a.getSource()).setText(letter);
    Improving the world one idiot at a time!

  9. #9
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Game over method not updating correctly

    All better then?

    Other thoughts:

    The method isTieGame() is an infinitely recursive method.

    Once you get the order right, the method lastLetter() is unnecessary.

    if ( boolean == true ) is verbose. if ( boolean ) is sufficient.

    Applying the concept of the statement, ( (JButton)a.getSource() ).setText( letter ), throughout your program will eliminate several if() statements.

  10. #10
    Junior Member
    Join Date
    Sep 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Game over method not updating correctly

    Quote Originally Posted by GregBrannon View Post
    All better then?

    Other thoughts:

    The method isTieGame() is an infinitely recursive method.

    Once you get the order right, the method lastLetter() is unnecessary.

    if ( boolean == true ) is verbose. if ( boolean ) is sufficient.

    Applying the concept of the statement, ( (JButton)a.getSource() ).setText( letter ), throughout your program will eliminate several if() statements.
    I'm a self-taught programmer so I don't have the best foundation. Not sure what infinitely recursive really means so I'm not sure how I could fix that.
    What do I need to be studying so that I can figure out simple things like ( (JButton)a.getSource() ).setText( letter ) naturally?

    As of right now the code runs but still does not immediately show the winner as a showMessage... it's delayed by one turn.

  11. #11
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Game over method not updating correctly

    Practice, practice, practice, review and learn from the code of others, and post your code and ask for feedback. Don't take feedback personally and accept that some critics are more gentle than others, but don't listen to A-holes.

    Learn the basic programming tools very well before moving to intermediate and advanced topics. Before coding a graphical program - even a "simple" TicTacToe game - you should know what a recursive method is. For an OOP language like Java, you should have a growing foundation of OOP understanding that would lead you to try things like (JButton)a.getSource(), simply because that's how it works. Knowing that that's simply how it works comes with practice. An understanding of OOP, its use and advantages, dawns on different people at different times.

    To improve your coding approach, have a design well thought out and documented before writing any code. This program appears to have evolved from code based on a rough idea of how a TicTacToe game flows to code that grew because band aid code was applied when the desired results were not achieved. Instead of adding band aid code, attempt to improve the basic design.

    Don't give up, be patient, keep coding.

  12. #12
    Junior Member
    Join Date
    Sep 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Game over method not updating correctly

    Quote Originally Posted by GregBrannon View Post
    Practice, practice, practice, review and learn from the code of others, and post your code and ask for feedback. Don't take feedback personally and accept that some critics are more gentle than others, but don't listen to A-holes.

    Learn the basic programming tools very well before moving to intermediate and advanced topics. Before coding a graphical program - even a "simple" TicTacToe game - you should know what a recursive method is. For an OOP language like Java, you should have a growing foundation of OOP understanding that would lead you to try things like (JButton)a.getSource(), simply because that's how it works. Knowing that that's simply how it works comes with practice. An understanding of OOP, its use and advantages, dawns on different people at different times.

    To improve your coding approach, have a design well thought out and documented before writing any code. This program appears to have evolved from code based on a rough idea of how a TicTacToe game flows to code that grew because band aid code was applied when the desired results were not achieved. Instead of adding band aid code, attempt to improve the basic design.

    Don't give up, be patient, keep coding.
    Well what is making my code update the win Boolean after the win has occurred?

  13. #13
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Game over method not updating correctly

    Well what is making my code update the win Boolean after the win has occurred?
    When should the variable be updated? It seems that it should do it after the win has been found. It shouldn't do it before the win.

    Have you tried tracing or debugging the program to see what it does when it executes
    and to see what order it does things?
    I use println() statements that print out messages that tell me when the values of variables are changed and when methods are executed. If you add lots of println() statements to the code you will see in what order the win Boolean is updated and when the win occurs. The values of the print out can help you understand what the program is doing.
    If you don't understand my answer, don't ignore it, ask a question.

  14. #14
    Junior Member
    Join Date
    Sep 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Game over method not updating correctly

    Quote Originally Posted by Norm View Post
    When should the variable be updated? It seems that it should do it after the win has been found. It shouldn't do it before the win.

    Have you tried tracing or debugging the program to see what it does when it executes
    and to see what order it does things?
    I use println() statements that print out messages that tell me when the values of variables are changed and when methods are executed. If you add lots of println() statements to the code you will see in what order the win Boolean is updated and when the win occurs. The values of the print out can help you understand what the program is doing.
    I actually have been doing th. It hasn't been helpful.

  15. #15
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Game over method not updating correctly

    Try setting break points in the code - at places you think the execution is following
    a different path. Check the values of any variables when the execution stops, then step
    into the code, note what has happened, then step out and continue the execution.

    I do agree with Norm's advice about the println statements too - it really helps in the debugging
    process.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  16. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Game over method not updating correctly

    I actually have been doing th. It hasn't been helpful.
    That may be because it needs more work.
    Debugging a program is a big part of programming. It's important to learn how.

    What does the print out show? Does it show when a win is detected and when the program shows the "Winner" message? What other things happen between those two events? Should the "Winner" message be shown immediately after the win is found?
    If you don't understand my answer, don't ignore it, ask a question.

  17. #17
    Junior Member
    Join Date
    Sep 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Game over method not updating correctly

    Quote Originally Posted by Norm View Post
    That may be because it needs more work.
    Debugging a program is a big part of programming. It's important to learn how.

    What does the print out show? Does it show when a win is detected and when the program shows the "Winner" message? What other things happen between those two events? Should the "Winner" message be shown immediately after the win is found?
    I have an idea for a project. Making an application that stores data and creating a search function for it. The problem is I don't know where to start. What would you say would be a good start.

  18. #18
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Game over method not updating correctly

    Is this problem solved? Please mark it as solved.

    Please start a new thread for a new topic.
    If you don't understand my answer, don't ignore it, ask a question.

  19. #19
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Game over method not updating correctly

    Quote Originally Posted by Blykon View Post
    I have an idea for a project. Making an application that stores data and creating a search function for it. The problem is I don't know where to start. What would you say would be a good start.
    You mean a database!
    Improving the world one idiot at a time!

Similar Threads

  1. Replies: 6
    Last Post: August 5th, 2014, 11:19 AM
  2. Why does my post always get deleted at every forum I post at?
    By WebDevGuy in forum Forum Updates & Feedback
    Replies: 3
    Last Post: April 30th, 2014, 11:30 AM
  3. code to post JMS Request on Queue
    By indiareks in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 7th, 2014, 02:31 PM
  4. code to post JMS Request on Queue
    By indiareks in forum Member Introductions
    Replies: 0
    Last Post: January 7th, 2014, 01:23 PM
  5. how to convert this my PHP code 'send post request' to java
    By mr.msds in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 9th, 2013, 05:03 AM