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
Can someone tell me a user to an admin on brainly I got a person sending "inappropriate pictures" all over brainly
cupoosta [38]

Answer:

What is the users name

Explanation:

6 0
3 years ago
The ability to anticipate and determine upcoming driving hazards and conditions are adversely affected
Keith_Richards [23]

Answer:

The statement is True.

Explanation:

The ability to anticipate means that, ability to think about future something that may happen or ability to look forward for making decisions. This ability will further leads to making future decisions by facing different hazards and conditions.

This ability can be affected adversely if there is some stress on the person. He will not be able to take right decisions and can't look forward. So the statement is true that, ability to anticipate and determine upcoming driving hazards and conditions are adversely affected by stress.

4 0
3 years ago
n macOS, what launch point provides access to almost all the settings needed to administer a macOS system?
Fynjy0 [20]

Answer:

System preferences.

Explanation:

MacOS is the primary operating system designed and developed for Apple computers (MacBook).

In macOS, system preferences is a launch point that provides access to almost all the settings needed to administer a macOS system. The system preferences allow users to change various settings on their Mac computers such as changing the desktop layout, desktop picture (wallpaper), size and location of the dock, font size, appearance, energy saver etc.

5 0
3 years ago
When RadioButton objects are contained in a group box, the user can select only one of the radio buttons on the panel.
Pani-rosa [81]
The answer is true, (i think)
7 0
3 years ago
The components of hardware include:
zlopas [31]

Answer:

A

Explanation:

Monitor, CPU, Disk Drives, Printer, Keyboard/mouse

5 0
3 years ago
Read 2 more answers
Other questions:
  • What action makes RAM on your computer disappear?
    12·2 answers
  • The Internet may best be compared to a/an
    8·1 answer
  • Use the word bank to identify each description.
    6·1 answer
  • . An access specifier is one of three keywords:
    14·1 answer
  • Can you give an example of mail merge (letter) pls​​
    6·1 answer
  • How to find out what windows version i have?
    10·1 answer
  • Credence is a student in college.
    13·2 answers
  • Facts and statistics collected together to be used for different purposes is
    14·1 answer
  • Which requires large computer memory?
    15·1 answer
  • What are hardware and software?<br><br><br><br> WILL MARK BRAINIEST
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!