|
Stimulated Variation of the Card Game “War”
I need to create a simulation of the card game "war" except in this game it is called trump. The rules are:
1) two players (the computer will be playing against itself. The user just watches the game)
2) each player starts with an array of 100 slots, partially filled with 50 random numbers from 0 to 9.
3) Each player is assigned a trump number from 1 to 9. (This is how far I’ve gotten so far)
4) For every turn randomly compare one value in player 1's array to one value in player 2's.
5) For every turn the higher value wins and the player claims the losing value from the losing player's array
6) if on any turn the random value is trump the player automatically wins.
7) In the event of a tie or both players' values are trump, a playoff occurs where a second set of random values are compared and so on. But in this scenario rather than the winner claiming the other players' value the winner gains a new trump value added to their array
8) the ultimate winner is the player with more elements in their array after 250 head to head comparisons.
9) No global variables
the stimulation of trump has 250 comparisons. Post every value pulled from array to the screen as if it were a battle. Use time wasting loop to delay time between flips.
After the stimulation print each array to the screen and determine a winner
any help would be appreciated with this program.
It’s my first year in a computer programming class using c++.
I would prefer for the program to be as simple as possible.
im using microsoft visual c++ 2010 express.
<Added>
Stimulated Variation of the Card Game “War”
I need to create a simulation of the card game "war" except in this game it is called trump. The rules are:
1) two players (the computer will be playing against itself. The user just watches the game)
2) each player starts with an array of 100 slots, partially filled with 50 random numbers from 0 to 9.
3) Each player is assigned a trump number from 1 to 9. (This is how far I’ve gotten so far)
4) For every turn randomly compare one value in player 1's array to one value in player 2's.
5) For every turn the higher value wins and the player claims the losing value from the losing player's array
6) if on any turn the random value is trump the player automatically wins.
7) In the event of a tie or both players' values are trump, a playoff occurs where a second set of random values are compared and so on. But in this scenario rather than the winner claiming the other players' value the winner gains a new trump value added to their array
8) the ultimate winner is the player with more elements in their array after 250 head to head comparisons.
9) No global variables
the stimulation of trump has 250 comparisons. Post every value pulled from array to the screen as if it were a battle. Use time wasting loop to delay time between flips.
After the stimulation print each array to the screen and determine a winner
any help would be appreciated with this program.
It’s my first year in a computer programming class using c++.
I would prefer for the program to be as simple as possible.
im using microsoft visual c++ 2010 express.
so far i have:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main ()
{
int i;
srand (time(NULL));
cout<<"Welcome to Trump!"<<endl;
int player1[100];
int player2[100];
for (int x=0; x<50; x++)
{
player1[x]=rand() %9+1;
}
for (int y=0; y<50; y++)
{
player2[y]=rand() %9+1;
}
//Time Wasting Loop
for (i=0; i<=1500500; i++)
{
cout<<"";
}
int trump1=rand() %9+1;
int trump2=rand() %9+1;
cout<<"Player number 1's trump is "<<trump1<<"."<<endl;
cout<<"Player number 2's trump is "<<trump2<<"."<<endl;
cin>>i;
return 0;
}
<Added>
i need help with how to compare the value of player 1 and player 2 so that i can then generate wins/loses. using a counter. At least thats what i hope to use.
|
|
|
|
|
|
|
|