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
nexus9112 [7]
3 years ago
9

Rock, Paper, Scissors is a two-player game in which each player chooses one of three items. If both players choose the same item

, the game is tied. Otherwise, the rules that determine the winner are:
(a) Rock always beats Scissors (Rock crushes Scissors)

(b) Scissors always beats Paper (Scissors cut Paper)

(c) Paper always beats Rock (Paper covers Rock) Implement function rps() that takes the choice ('R', 'P', or 'S') of player 1 and the choice of player 2, and returns −1 if player 1 wins, 1 if player 2 wins, or 0 if there is a tie.


>>> rps('R', 'P') 1


>>> rps('R', 'S') -1


>>> rps('S', 'S') 0
Computers and Technology
1 answer:
mezya [45]3 years ago
7 0

Answer:

The answer is c

Explanation:

You might be interested in
Finish and test the following two functions append and merge in the skeleton file:
avanturin [10]

Answer:

Explanation:

#include <iostream>

using namespace std;

int* append(int*,int,int*,int);

int* merge(int*,int,int*,int);

void print(int*,int);

int main()

{ int a[] = {11,33,55,77,99};

int b[] = {22,44,66,88};

print(a,5);

print(b,4);

int* c = append(a,5,b,4); // c points to the appended array=

print(c,9);

int* d = merge(a,5,b,4);

print(d,9);

}

void print(int* a, int n)

{ cout << "{" << a[0];

for (int i=1; i<n; i++)

cout << "," << a[i];

cout << "}\n";

}

int* append(int* a, int m, int* b, int n)

{

int * p= (int *)malloc(sizeof(int)*(m+n));

int i,index=0;

for(i=0;i<m;i++)

p[index++]=a[i];

for(i=0;i<n;i++)

p[index++]=b[i];

return p;

}

int* merge(int* a, int m, int* b, int n)

{

int i, j, k;

j = k = 0;

int *mergeRes = (int *)malloc(sizeof(int)*(m+n));

for (i = 0; i < m + n;) {

if (j < m && k < n) {

if (a[j] < b[k]) {

mergeRes[i] = a[j];

j++;

}

else {

mergeRes[i] = b[k];

k++;

}

i++;

}

// copying remaining elements from the b

else if (j == m) {

for (; i < m + n;) {

mergeRes[i] = b[k];

k++;

i++;

}

}

// copying remaining elements from the a

else {

for (; i < m + n;) {

mergeRes[i] = a[j];

j++;

i++;

}

}

}

return mergeRes;

}

4 0
3 years ago
Ipv6 includes a native information security framework (ipsec) that provides both data and control packets. true false
Galina-37 [17]
<span>The statement that IPv6 includes a native information security framework (IPsec) that provides both data and control packets is false.
</span>IPSec is a mandatory component for IPv6, and is used to natively protect IPv6 data <span>as it is sent over the network,. and not control packets.
</span>The IPv6 IPSec is a set of Internet standards that uses cryptographic security services to provide confidentiality ,data origin authentication and data integrity<span>
</span>

5 0
3 years ago
Hi guts gyt edgsahgflefljwegfwygafbhdshdnvcashD
lapo4ka [179]

Hello, how are you and welcome!

4 0
3 years ago
What are the three major functions of a game engine?
Harrizon [31]
read that hope this helped

8 0
3 years ago
Which form of media allows the audience to share in and comment on the content immediatly
Luba_88 [7]

twitter

they will allow you to share comments about any topic you want

4 0
3 years ago
Other questions:
  • Which of the following is an unintended consequence of pesticide use on crops?
    10·1 answer
  • If you delete an imessage does the other person see it
    12·1 answer
  • What is the meaning of the word joystick
    6·2 answers
  • In an array based implementationof a queue a possible solution to dealing with the full condition is to
    14·1 answer
  • Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T
    9·1 answer
  • Write a technical term for following statements
    15·1 answer
  • What is the scope of numC?
    8·2 answers
  • Management information system by different outhors<br>​
    10·1 answer
  • Write an answer in three to five sentences that describes the photo, explains what better lighting would mean for your photograp
    6·1 answer
  • with a ____ the traffic of a given enterprise or group passes transparently through an internet in a way that effectively segreg
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!