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
PolarNik [594]
3 years ago
6

In the simulation, player 2 will always play according to the same strategy. The number of coins player 2 spends is based on wha

t round it is, as described below. (a) You will write method getPlayer2Move, which returns the number of coins that player 2 will spend in a given round of the game. In the first round of the game, the parameter round has the value 1, in the second round of the game, it has the value 2, and so on. The method returns 1, 2, or 3 based on the following rules. If round is divisible by 3, then return 3. If round is not divisible by 3 but is divisible by 2, then return 2. If round is not divisible by 3 and is not divisible by 2, then return 1. Complete method getPlayer2Move below by assigning the correct value to result to be returned.
Computers and Technology
1 answer:
baherus [9]3 years ago
8 0

The simulation, player 2 will always play according to the same strategy.

Method getPlayer2Move below is completed by assigning the correct value to result to be returned.

Explanation:

  • You will write method getPlayer2Move, which returns the number of coins that player 2 will spend in a given round of the game. In the first round of the game, the parameter round has the value 1, in the second round of the game, it has the value 2, and so on.

#include <bits/stdc++.h>  

using namespace std;

bool getplayer2move(int x, int y, int n)  

{

   int dp[n + 1];  

   dp[0] = false;  

   dp[1] = true;  

   for (int i = 2; i <= n; i++) {  

       if (i - 1 >= 0 and !dp[i - 1])  

           dp[i] = true;  

       else if (i - x >= 0 and !dp[i - x])  

           dp[i] = true;  

       else if (i - y >= 0 and !dp[i - y])  

           dp[i] = true;  

       else

           dp[i] = false;  

   }  

   return dp[n];  

}  

int main()  

{  

   int x = 3, y = 4, n = 5;  

   if (findWinner(x, y, n))  

       cout << 'A';  

   else

       cout << 'B';  

   return 0;  

}

You might be interested in
To increase security on your company's internal network, the administrator has disabled as many ports as possible. Now, however,
tia_tia [17]

Answer: 443

Explanation:

Port 443 will need to be enabled for secure transactions to go through because it is the default port for HTTPS which is the transfer protocol for secure communication.

This way your credit card transactions will be encrypted to ensure protection from those who would seek to steal your data and your money.  

8 0
3 years ago
What is the output of the following code snippet? int age = 25; if (age &gt; 30) { System.out.println("You are wise!"); } else {
Lunna [17]

Answer:

You have much to learn!

Explanation:

In the question the variable age has been declared and assigned the value of 25.

The if Statement checks if age >30 to output "You are wise!" else it will output "You have too much to learn"

Since age has been assigned the value of 25, we expect the program to execute the else block which is "You have too much to learn"

4 0
3 years ago
Which of the following is not one of the current changes taking place in information systems​ technology? A. Growth in cloud com
lana66690 [7]

Answer:

Growth in the PC platform

Explanation:

Information system technology refers to study, design, implementation, management, support - of computer based information system.

In today's technical growth age : the area has undergone many dynamic changes :

Changes of technical upgradation & application of IT info - Growth in cloud computing,  Increased usage of data generated by the Internet of Things, Emerging mobile digital platform, Growing business use of big data

However, Growth of PC platform is not one of the current changes taking place in information systems​ technology.

6 0
3 years ago
What led to the reduction in size of the modern day computer system?
Hunter-Best [27]
Transistors , as in the past vacuum tubes were used which took much larger space.

Now with transistor you can create very complicated logical circuits in very limited space. 
7 0
3 years ago
How to fix 500 internal server error youtube?
DedPeter [7]
Just shut everything down.

Hope this was helpful :) 
5 0
3 years ago
Read 2 more answers
Other questions:
  • Which is the best description of a hierarchical report?
    13·1 answer
  • Define a function below, get_subset, which takes two arguments: a dictionary of strings (keys) to integers (values) and a list o
    8·1 answer
  • Help please appreciate it
    11·1 answer
  • The first step in the information processing cycle involves the _____ of data.
    10·1 answer
  • Which of these is a formatting option that you can use to enhance your text document?
    5·2 answers
  • Technician A says that using 100% coolant is better for freeze protection in an engine than a mixture with water. Technician B s
    13·1 answer
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    12·2 answers
  • Select the best answer from the drop-down menu. Sometimes people feel threatened by new ideas and different ways of doing things
    5·1 answer
  • Jolly 4 pls link in description
    7·1 answer
  • Which of the following best describes a hotspot as
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!