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
Write a program that calculates the amount of money the salesperson will earn from selling discount cards. java program
BaLLatris [955]

Answer:

import java.util.Scanner; public class Salesman2 {

public static void main(String[] args) { // TODO Auto-generated method stub double CommissionRate;

double TotalSales, Commission;

Scanner Read = new Scanner (System.in); System.out.println("Please enter total sales "); TotalSales=Read.nextDouble();

if (TotalSales<500)

CommissionRate=0.0;

else if (TotalSales>=500 && TotalSales <1000) CommissionRate=0.05;

else

CommissionRate=0.08;}

Commission = CommissionRate * TotalSales;

System.out.println("The Commision is: "+ Commission); }

}

}

4 0
2 years ago
Pls help. will give brainliest to FIRST and CORRECT answer!
Zolol [24]

Answer:

All of the above

Explanation:

7 0
2 years ago
Heya!!<br><br>•DEFINE DATA SCIENCE??<br>(∩_∩)<br><br>#kavya#<br>​
anastassius [24]

Answer:

Explanation:

Data science defined

Data science encompasses preparing data for analysis, including cleansing, aggregating, and manipulating the data to perform advanced data analysis. Analytic applications and data scientists can then review the results to uncover patterns and enable business leaders to draw informed insights.

5 0
2 years ago
Pls help me po:{<br><br> I need the answer lang po talaga , pls:{
julsineya [31]

Answer:

for cutting it's scissors for measuring it's the tiny measurement spoonlikes for mixing it's the blender and preparatory

7 0
2 years ago
I'm programming in javascript, I tryed to put a code like this, but it doesn't work. could someone help me?
VMariaS [17]

Answer:

Your computer does not support this code because you have put spaces in between the code, or maybe that is how you have written the question.

6 0
3 years ago
Other questions:
  • The instruction set for a microprocessor is unique and is typically understood only by the microprocessors of the same brand.
    7·1 answer
  • is a specific system for gathering information from a single group of respondents by continuously monitoring the advertising, pr
    13·1 answer
  • In the Remote Access Domain, if private data or confidential data is compromised remotely, you should set automatic blocking for
    5·1 answer
  • What are dividends? AA small part, or share, of a company. BA type of savings account that grows over time. CA distribution of a
    5·1 answer
  • Multiple users report that the network printer, which is connected through the print server, is not printing. Which of the follo
    12·1 answer
  • What's the name of this apex legend hero​
    13·2 answers
  • Help me match these answers
    5·1 answer
  • What two programming systems uses numbers and text?
    6·1 answer
  • To close the ____ view, click File on the Ribbon or click the preview of the document in the Info gallery to return to the docum
    9·1 answer
  • If userNum1 is less than 0, put "userNum1 is negative.\n" to output. If userNum2 is greater than 10, assign userNum2 with 0. Els
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!