ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > Living Room

Rock Paper Scissors 25 - an old game, a very cool twist

<< < (2/2)

PhilKC:
I need a job or something >_>

http://bluescreenofdeath.co.uk/DC/RPS%2025.exe


--- Code: C++ ---#include <iostream> using namespace std; void fillArrays();int getHand(bool);int findWinner(int, int); const int maxValue = 25;static char* names[maxValue];static int values[maxValue]; int main(){    cout << endl;    srand (time(NULL));    fillArrays();    int player = getHand(false);    int cpu = getHand(true);    int win = findWinner(player, cpu);    if (win == 0)       cout << "YOU WIN!";    else if (win == 1)       cout << "I WIN!";    else       cout << "Draw :(";    cout << endl;    system("PAUSE");    return EXIT_SUCCESS;} int findWinner(int player, int cpu){    if (player == cpu)       return 2;    if (player > 12)    {       if ((player < cpu) && (player > (cpu - 12)))          return 1;       return 0;    }    if (cpu > (player + 12))       return 0;    return 1;} int getHand(bool cpu){    int hand = 0;    if (cpu)    {       hand = rand() % maxValue;       cout << "I picked " << names[hand] << endl;    }    else    {        cout << "Pick your hand! (By number): ";        cin >> hand;            cout << endl << "Ok, you picked " << names[hand] << endl;    }          return hand;  } void fillArrays(){     names[0] =         "Gun";     names[1] =         "Dynomite";     names[2] =         "Nuke";     names[3] =         "Lightning";     names[4] =         "Devil";     names[5] =         "Dragon";     names[6] =         "Alien";     names[7] =         "Water";     names[8] =         "Bowl";     names[9] =         "Air";     names[10] =        "Moon";     names[11] =        "Paper";     names[12] =        "Sponge";     names[13] =        "Wolf";     names[14] =        "Cockroach";     names[15] =        "Tree";     names[16] =        "Man";     names[17] =        "Woman";     names[18] =        "Monkey";     names[19] =        "Snake";     names[20] =        "Axe";     names[21] =        "Scissors";     names[22] =        "Fire";     names[23] =        "Sun";     names[24] =        "Rock";     int i;     for (i=0;i<25;i++)     {         values[i] = i;         cout << i << " - " << names[i] << endl;     }     cout << endl;     }
PhilKC

jgpaiva:
 8) Nice Phil!
You could add a number of repetitions, though. So that i could take a bunch of tries, and see who gets the best score.

This might be a good way to make decisions in life...
"should i suicide myself? Let's ask RPS%2025.exe
 I choose axe. The computer chose scisors. I Lose.. Ho well.. Where's that rope?"

ljbirns:
See the following:
Judge Makes 'Rock, Paper, Scissors' Ruling

    *

Article Tools Sponsored By
By THE ASSOCIATED PRESS
Published: June 9, 2006

Filed at 7:56 a.m. ET

TAMPA, Fla. (AP) -- A federal judge, miffed at the inability of opposing attorneys to agree on even the slightest details of a lawsuit, ordered them to settle their latest dispute with a game of ''rock, paper, scissors.''

The argument was over a location to take the sworn statement of a witness in an insurance lawsuit.

In an order signed Tuesday, U.S. District Judge Gregory Presnell scolded both sides and ordered them to meet at a neutral location at 4 p.m. June 30 to play a round of the hand-gesture game often used to settle childhood disputes. If they can't agree on the neutral location, he said, they'll play on the steps of the federal courthouse.

The winner gets to choose the location for the witness statement.

''We're going to have to do it,'' said David Pettinato, lead attorney for the plaintiff, Avista Management. ''I guess I'd better bone up on 'rock, paper, scissors' rules.''

Last year, officials of the auction houses Christie's and Sotheby's engaged in the game to decide who would get to sell a $17.8 million collection of art offered by a Japanese electronics company. Christie's won.

Lew

mouser:
this would make a great multiplayer flash game!

hamradio:
I just posted the Flash Game I found that has it there.

Navigation

[0] Message Index

[*] Previous page

Go to full version