1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Karolina [17]
2 years ago
11

I need help in php coding

Computers and Technology
1 answer:
enyata [817]2 years ago
8 0
How can i help you please post your question
You might be interested in
Assume that getPlayer2Move works as specified, regardless of what you wrote in part (a) . You must use getPlayer1Move and getPla
kakasveta [241]

Answer:

(1)

public int getPlayer2Move(int round)

{

  int result = 0;

 

  //If round is divided by 3

  if(round%3 == 0) {

      result= 3;

  }

  //if round is not divided by 3 and is divided by 2

  else if(round%3 != 0 && round%2 == 0) {

      result = 2;

  }

  //if round is not divided by 3 or 2

  else {

      result = 1;

  }

 

  return result;

}

(2)

public void playGame()

{

 

  //Initializing player 1 coins

  int player1Coins = startingCoins;

 

  //Initializing player 2 coins

  int player2Coins = startingCoins;

 

 

  for ( int round = 1 ; round <= maxRounds ; round++) {

     

      //if the player 1 or player 2 coins are less than 3

      if(player1Coins < 3 || player2Coins < 3) {

          break;

      }

     

      //The number of coins player 1 spends

      int player1Spends = getPlayer1Move();

     

      //The number of coins player 2 spends

      int player2Spends = getPlayer2Move(round);

     

      //Remaining coins of player 1

      player1Coins -= player1Spends;

     

      //Remaining coins of player 2

      player2Coins -= player2Spends;

     

      //If player 2 spends the same number of coins as player 2 spends

      if ( player1Spends == player2Spends) {

          player2Coins += 1;

          continue;

      }

     

      //positive difference between the number of coins spent by the two players

      int difference = Math.abs(player1Spends - player2Spends) ;

     

      //if difference is 1

      if( difference == 1) {

          player2Coins += 1;

          continue;

      }

     

      //If difference is 2

      if(difference == 2) {

          player1Coins += 2;

          continue;

      }

     

     

  }

 

  // At the end of the game

  //If player 1 coins is equal to player two coins

  if(player1Coins == player2Coins) {

      System.out.println("tie game");

  }

  //If player 1 coins are greater than player 2 coins

  else if(player1Coins > player2Coins) {

      System.out.println("player 1 wins");

  }

  //If player 2 coins is grater than player 2 coins

  else if(player1Coins < player2Coins) {

      System.out.println("player 2 wins");

  }

}

3 0
3 years ago
In general, what is the leftmost point of a circle with radius r centered at (x,y)?
Semmy [17]

The answer is (x-r, y).

5 0
3 years ago
Which is a monthly cost associated with renting a house?
Evgesh-ka [11]
The answer is a. utility bills
8 0
3 years ago
Read 2 more answers
You want to divide the value in cell D3 by the value in cell E3. Which formula should you use?
Tom [10]
The formula is:
=D3/E3
4 0
3 years ago
Read 2 more answers
How many answers do you need to be able to write messages on here??
Kipish [7]

1,000

Hope this helps!



~Courtney

3 0
3 years ago
Other questions:
  • An array UnsortedInt consists of integers in random order. Another array SortedInt consists of a sorted list of integers.
    13·1 answer
  • 1. _______ is when two things happen at one time when using the Scratch program.
    6·1 answer
  • How did the invention of the printing press lead eventually to an increase in the diversity of religious expression?
    7·1 answer
  • What video game has made the most money as of 2016?
    15·2 answers
  • Fill in the blank with the correct response.
    6·1 answer
  • Select three advantages of cloud computing.
    10·1 answer
  • Which generation computer supported GUI operating system?​
    11·1 answer
  • HELP 20 points THIS IS ON EDGE IF YOU DON'T KNOW THE ANSWER DON'T RESPOND
    12·2 answers
  • Write Epic username plz
    6·1 answer
  • Which directory contains the initrd file? in suse linux
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!