Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4612792
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:27:09+00:00 2026-05-22T01:27:09+00:00

I need some help with this. I am trying to make a mini game

  • 0

I need some help with this. I am trying to make a mini game that basically uses a timer with 2 players. It continually takes the highest score for each that user and saves it then at the end of 3 rounds it is supposed to display who has the highest score. I have tried this with a loop around everything within the else if play==2 and it just wouldnt work correctly. It would auto display the winner on first click. Here is the code for that section.

else if (play==2)
             {
                 round++;
                 turn = turn%2;
                 if (turn == 0 && turn<3)
                 {
                     TextView c1c = (TextView) findViewById(R.id.player);
                        c1c.setText( " CHALLENGER 1:" );


                     click=click%2;
                         if (click==0 && turn<6)
                        {

                            reset();
                            TextView challenger1 = (TextView) findViewById(R.id.display);
                            challenger1.setText("");

                            start();
                            click++;
                            startbutton.setText("Stop");
                        }
                        else if (click==1 && turn < 6)
                        {
                            stop();
                            getElapsedTimeMicro();

                           TextView time1 = (TextView) findViewById(R.id.display);
                            time1.setText( " "+ formatter.format(elapsed) );

                            if (elapsed > c1time )
                                  c1time=elapsed;

                           click++;
                            startbutton.setText("Start");


                            turn++;
                        }

                 }

                 else if (turn ==1 && turn < 3)
                 {

                     TextView c2 = (TextView) findViewById(R.id.player);
                        c2.setText( " CHALLENGER 2:" );

                     click=click%2;
                     if (click==0)
                        {

                            reset();
                            TextView challenger2 = (TextView) findViewById(R.id.display);
                            challenger2.setText("");
                            start();
                            click++;
                            startbutton.setText("Stop");
                        }
                        else if (click==1)
                        {
                            stop();
                            getElapsedTimeMicro();

                           TextView time2 = (TextView) findViewById(R.id.display);
                            time2.setText( " "+ formatter.format(elapsed) );

                            if (elapsed>c2time)
                                c2time=elapsed;

                           click++;
                            startbutton.setText("Start");

                            turn++;
                        }

                 }
                 if ( round==3) 
                 {
                    if (c1time > c2time)

                    {
                        TextView winner1 = (TextView) findViewById(R.id.display);
                        winner1.setText("Challenger 1 is the Iron Lung!\n"+formatter.format(c1time));
                    }
                    else if (c2time > c1time)
                    {
                        TextView winner2 = (TextView) findViewById(R.id.display);
                        winner2.setText("Challenger 2 is the Iron Lung!\n"+formatter.format(c2time));
                    }
                    click=0;
                    turn=0;
                    c1time=0;
                    c2time=0;
                 }
                }

All of this is within a button ( the else if play==2 is there because the button has 2 games linked into the same xml/class… I font believe that is causing any problems though cause the other game works fine) This game is displaying the players turn correctly and their times correctly. The problem is occurring when it should be ending. I tried using if if elses to fix all this and it still wont display it properly. Could use some help. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:27:10+00:00Added an answer on May 22, 2026 at 1:27 am

    what are you trying to do here:

    if (turn == 0 && turn<3)
    

    You might have wanted “or” (||) but even then it wouldn’t make sense to double check since if turn==0 it will by definition be <3). In anyevent, what you wrote will only execute when turn==0

    Later, inside that same block, you test for turn<6 – which is pointless since it will only get that far if again turn==0. And even if you fix the && to ||, it would be by definition <6 since it must be <3.

    Basically, your if statements are all wonky.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help calculating Pi. I am trying to write a python program
I need some help with jQuery script again :-) Just trying to play with
I need some help figuring out how to make some changes to some .jsp
I'm trying to make my first android game and to do this I made
I need some help from the shell-script gurus out there. I have a .txt
I need some help regarding algorithm for randomness. So Problem is. There are 50
I need some help ... I'm a bit (read total) n00b when it comes
Hi I need some help with the following scenario in php. I have a
I am getting a little confused and need some help please. Take these two
I am new to all the anonymous features and need some help. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.