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
eduard
3 years ago
15

Same rule: If both players spend the same number of coins, player 2 gains 1 coin. Off-by-one rule: If the players do not spend t

he same number of coins and the positive difference between the number of coins spent by the two players is 1, player 2 is awarded 1 coin. Off-by-two rule: If the players do not spend the same number of coins and the positive difference between the number of coins spent by the two players is 2, player 1 is awarded 2 coins. The following is an example of a game played with a starting value of 10 coins and a game length of 5 rounds
Engineering
1 answer:
Galina-37 [17]3 years ago
3 0

Answer:

Check the explanation

Explanation:

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");

  }

}

You might be interested in
4.116 The lid of a roof scuttle weighs 75 lb. It is hinged at corners A and B and maintained in the desired position by a rod CD
babunello [35]

Answer:

(a) The magnitude of force is 116.6 lb, as exerted by the rod CD

(b) The reaction at A is (-72.7j-38.1k) lb and at B it is (37.5j) lb.

Explanation:

Step by step working is shown in the images attached herewith.

For this given system, the coordinates are the following:

A(0, 0, 0)

B(26, 0, 0)

And the value of angle alpha is 20.95°

Hope that answers the question, have a great day!

5 0
3 years ago
A transformer winding contains 900 turns of wire which creates 400 ohms of primary importance how many terms of the same size wi
Eduardwww [97]

Answer: 255

255 turns are required to create 25 ohms of  secondary impedance.

Explanation:

Given that,

Number of turns in primary wire N₁ = 900

impedance on Primary wire Z₁ = 400 ohms

Number of turns in Secondary wire N₂ = ?

impedance on Secondary wire Z₂ = 25 ohms

we know that, the relationship between turn and impedance is

Zp / Zs = ( Np / Ns )²

(Primary impedance / secondary impedance) = Number of turns in primary wire / Number of turns in secondary wire)²

there fore

Z₁ / Z₂ = ( N₁ / N₂ )²

Now we substitute

( 400 / 25 ) = ( 900 / N₂ )²

400 / 25 = 900² / N₂²

we cross multiple to get our N₂

400 × N₂² =  900² × 25

N₂² = ( 900² × 25 ) / 400

N₂² = ( 810000 × 25 ) / 400

N₂² = 20250000 / 400

N₂² = 50625

N₂ = √50625

N₂ = 225

Therefore 255 turns are required to create 25 ohms of  secondary impedance.

4 0
3 years ago
Out
olchik [2.2K]

ave you ever seen a Rube Goldberg machine in action? You probably have, even if you didn’t know what it was. A Rube Goldberg machine is a contraption that uses a chain reaction to carry out a simple task. It performs a very basic job in a complicated way.

7 0
3 years ago
Three groups of students are given study outlines for 6 weeks. One group studies 2 hours a night, a second group studies 1 hour
katrin2010 [14]

Answer:

The constant here is the study outline

Explanation:

In scientific research, the constant variable is that part/variable of the experiment that does not change or is set not to change. Examples include temperature, environment or height.

Assuming the scenery described in this question is an experiment. All the groups presented are bound by a constant during the experiment. The constant here is the study outline. The study outline provided to the students is not going to change.

NOTE: There could be confusion as regards the answer being the final exam grade but that will be the dependent variable as that will be the outcome of the experiment while the time spent to study will be the independent variable.

8 0
3 years ago
Tensile Strength (MPa) Number-Average Molecular Weight (g/mol)
IceJOKER [234]

Answer:

\mathbf{T_{S \infty } \ \approx 215.481 \ MPa}

\mathbf{M_n = 49163.56431  \ g/mol }

Explanation:

The question can be well structured in a table format as illustrated below:

Tensile Strength (MPa)            Number- Average Molecular Weight  (g/mol)

82                                                  12,700

156                                                 28,500

The tensile strength and number-average molecular weight for two polyethylene materials given above.

Estimate the number-average molecular weight that is required to give a tensile strength required above. Using the data given find TS (infinity) in MPa.

<u>SOLUTION:</u>

We know that :

T_S = T_{S \infty} - \dfrac{A}{M_n}

where;

T_S = Tensile Strength

T_{S \infty} = Tensile Strength (Infinity)

M_n = Number- Average Molecular Weight  (g/mol)

SO;

82= T_{S \infty} - \dfrac{A}{12700} ---- (1)

156= T_{S \infty} - \dfrac{A}{28500} ---- (2)

From equation (1) ; collecting the like terms; we have :

T_{S \infty} =82+ \dfrac{A}{12700}

From equation (2) ; we have:

T_{S \infty} =156+ \dfrac{A}{28500}

So; T_{S \infty} = T_{S \infty}

Then;

T_{S \infty} =82+ \dfrac{A}{12700} =156+ \dfrac{A}{28500}

Solving by L.C.M

\dfrac{82(12700) + A}{12700} =\dfrac{156(28500) + A}{28500}

\dfrac{1041400 + A}{12700} =\dfrac{4446000 + A}{28500}

By cross multiplying ; we have:

({4446000 + A})*  {12700} ={28500} *({1041400 + A})

(5.64642*10^{10} + 12700A) =(2.96799*10^{10}+ 28500A)

Collecting like terms ; we have

(5.64642*10^{10} - 2.96799*10^{10} ) =( 28500A- 12700A)

2.67843*10^{10}  = 15800 \ A

Dividing both sides by 15800:

\dfrac{ 2.67843*10^{10} }{15800} =\dfrac{15800 \ A}{15800}

A = 1695208.861

From equation (1);

82= T_{S \infty} - \dfrac{A}{12700} ---- (1)

Replacing A = 1695208.861 in the above equation; we have:

82= T_{S \infty} - \dfrac{1695208.861}{12700}

T_{S \infty}= 82 + \dfrac{1695208.861}{12700}

T_{S \infty}= \dfrac{82(12700) +1695208.861 }{12700}

T_{S \infty}= \dfrac{1041400 +1695208.861 }{12700}

T_{S \infty}= \dfrac{2736608.861 }{12700}

\mathbf{T_{S \infty } \ \approx 215.481 \ MPa}

From equation(2);

156= T_{S \infty} - \dfrac{A}{28500} ---- (2)

Replacing A = 1695208.861 in the above equation; we have:

156= T_{S \infty} - \dfrac{1695208.861}{28500}

T_{S \infty}= 156 + \dfrac{1695208.861}{28500}

T_{S \infty}= \dfrac{156(28500) +1695208.861 }{28500}

T_{S \infty}= \dfrac{4446000 +1695208.861 }{28500}

T_{S \infty}= \dfrac{6141208.861}{28500}

\mathbf{T_{S \infty } \ \approx 215.481 \ MPa}

We are to also estimate the number- average molecular weight that is required to give a tensile strength required above.

If the Tensile Strength (MPa) is 82 MPa

Definitely the average molecular weight will be = 12,700 g/mol

If the Tensile Strength (MPa) is 156 MPa

Definitely the average molecular weight will be = 28,500 g/mol

But;

Let us assume that the Tensile Strength (MPa) = 181 MPa for example.

Using the same formula:

T_S = T_{S \infty} - \dfrac{A}{M_n}

Then:

181 = 215.481- \dfrac{1695208.861 }{M_n}

Collecting like terms ; we have:

\dfrac{1695208.861 }{M_n} = 215.481-  181

\dfrac{1695208.861 }{M_n} =34.481

1695208.861= 34.481 M_n

Dividing both sides by 34.481; we have:

M_n = \dfrac{1695208.861}{34.481}

\mathbf{M_n = 49163.56431  \ g/mol }

5 0
3 years ago
Other questions:
  • Answer every question of this quiz
    7·1 answer
  • When in a flow do the streamlines, streak lines and timelines coincide?
    14·1 answer
  • The themes around which social sciences texts are organized boost understanding by
    11·1 answer
  • A car is traveling at 36 km/h on an acceleration lane to a freeway. What acceleration is required to obtain a speed of 72 km/h i
    12·1 answer
  • A saturated 1.5 ft3 clay sample has a natural water content of 25%, shrinkage limit (SL) of 12% and a specific gravity (GS) of 2
    11·1 answer
  • Technician A says that a lack of lubrication on the back of the disc brake pads can cause brake noise. Technician B says that pa
    8·1 answer
  • 1) What output force (Fout) is produced if the lever arm length (rout) is 100 mm?
    13·2 answers
  • The velocity components expressed in m/s<br>​
    6·1 answer
  • From the top of a vertical cliff 80m high, the angles of depression of 2 buoys lying due west of the cliff are 23° and 15° respe
    13·1 answer
  • 8th grade safety test
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!