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
4 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]4 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
11. Technician A says that gasoline storage containers should be painted red. Technician B says that any metal container may be
QveST [7]

Explanation:

1. Both a and b only

2. A only

3. B only

4.Neither a or b

6 0
3 years ago
The number of vacancies in some hypothetical metal increases by a factor of 3 when the temperature is increased from 1020 ˚C to
weeeeeb [17]

Answer:

first step here is to substitute the 3 of your two equations into the second;

3 Ne^(-Q_v/k(1293)) = Ne^(-Q_v/k(1566))

Since 'N' is a constant, we can remove it from both sides.

We also want to combine our two Q_v values, so we can solve for Q_v, so we should put them both on the same side:

3 = e^(-Q_v/k(1293)) / e^(-Q_v/k(1566))

3 = e^(-Q_v/k(1293) + Q_v/k(1566) ) (index laws)

ln (3) = -Q_v/k(1293) + Q_v/k(1566) (log laws)

ln (3) = -0.13Q_v / k(1566) (addition of fractions)

Q_v = ln (3)* k * 1566 / -0.13 (rearranging the equation)

Now, as long as you know Boltzmann's constant it's just a matter of substituting it for k and plugging everything into a calculator.

6 0
4 years ago
An example of organisms and energy crossing ecosystem boundaries.
aniked [119]
Good afternoon!

An example can be migrating salmon moving material across ecosystem boundaries.
4 0
3 years ago
A motor vehicle has a mass of 1.8 tonnes and its wheelbase is 3 m. The centre of gravity of the vehicle is situated in the centr
seropon [69]

Answer:

1) The normal reactions at the front wheel is 9909.375 N

The normal reactions at the rear wheel is 8090.625 N

2) The least coefficient of friction required between the tyres and the road is 0.625

Explanation:

1) The parameters given are as follows;

Speed, u = 90 km/h = 25 m/s

Distance, s it takes to come to rest = 50 m

Mass, m = 1.8 tonnes = 1,800 kg

From the equation of motion, we have;

v² - u² = 2·a·s

Where:

v = Final velocity = 0 m/s

a = acceleration

∴ 0² - 25² = 2 × a × 50

a = -6.25 m/s²

Force, F =  mass, m × a = 1,800 × (-6.25) = -11,250 N

The coefficient of friction, μ, is given as follows;

\mu =\dfrac{u^2}{2 \times g \times s} = \dfrac{25^2}{2 \times 10 \times 50} = 0.625

Weight transfer is given as follows;

W_{t}=\dfrac{0.625 \times 0.9}{3}\times \dfrac{6.25}{10}\times 18000 = 2109.375 \, N

Therefore, we have for the car at rest;

Taking moment about the Center of Gravity CG;

F_R × 1.3 = 1.7 × F_F

F_R + F_F = 18000

F_R + \dfrac{1.3 }{1.7} \times  F_R = 18000

F_R = 18000*17/30 = 10200 N

F_F = 18000 N - 10200 N = 7800 N

Hence with the weight transfer, we have;

The normal reactions at the rear wheel F_R  = 10200 N - 2109.375 N = 8090.625 N

The normal reactions at the front wheel F_F =  7800 N + 2109.375 N = 9909.375 N

2) The least coefficient of friction, μ, is given as follows;

\mu = \dfrac{F}{R} =  \dfrac{11250}{18000} = 0.625

The least coefficient of friction, μ = 0.625.

3 0
4 years ago
If the coefficient of static friction between the block and the platform is μs = 0.4, determine the maximum speed which the bloc
MrRa [10]

Question:

A disc of radius 6m is rotating about its fixed centre with a constant angular velocity 3rad/s ( in the horizontal plane). A block is also rotating with the disc without slipping. If coefficient of friction between the block and disc is 0.4, determine the maximum speed which the block can attain before it begins to slip. Assume the angular motion of the disk is slowly increasing.

Answer:

Maximum Radius = 0.44m

Given

r = Radius = 6m

w = Angular Velocity = 3rad/s

μ = coefficient of friction between the objects = 0.4

There are four forces acting on the objects

1. Centripetal Forces

2. Friction

3. Blocks weight

4. Normal force on the block

The centripetal force acts inward toward the disk center.

The friction hinders the block's motion.

The block's weight acts on the disk

The normal force of the disk acting on the block.

The block's weight is equal to the normal force on the block because the block sits on the desk surface.

Centripetal force, Fc = mw²r

Friction,Fr = μN where N = Normal force = mg

Friction = μmg

The maximum distance rmax that we could place the block would be when Ff < Fc

We assume they are equal to solve for r

Ff = Fc

μmg = mw²r ---- divide through by m

μg = w²r ----- make r the subject of formula

r = μg/w² where g = 9.8m/s²

Plugging in the values

r = 0.4 * 9.8/3²

r = 0.435555555555555

r = 0.44m ----- Approximated

Explanation:

6 0
3 years ago
Other questions:
  • 4. A person is standing 4 miles east from his house. He travels 2 miles east. a. Calculate the initial displacement. b. Calculat
    13·1 answer
  • 99 POINTS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    15·2 answers
  • Given a two-dimensional steady inviscid air flow field with no body forces described by the velocity field given below. Assuming
    8·1 answer
  • A. Calculate the concentration of a toxic (Cout) that is added to a lake with an input concentration of 100 μg/l. The flow rate
    10·1 answer
  • What are the assumptions made for air standard cycle analysis?
    15·1 answer
  • What is a torque <br> what is a turns <br><br>​
    7·1 answer
  • What type of engineer would be most likely to develop a design for cars? chemical civil materials mechanical
    13·1 answer
  • Label each of the line types in the drawing below. ( will not mark you brainlest or whatever if you don't at least try to help)
    11·1 answer
  • What are Teets<br><br> I am so confused right kn
    9·1 answer
  • 10. True or False? A disruptive technology<br> radically changes the way people live and<br> work.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!