Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include<ctime>
- using namespace std;
- int zawodnik1, zawodnik2, i, pierwszy, A1, A2, U1, U2, x1, x2, x3, x4, runda;
- unsigned int W1, W2;
- class bokser
- {
- public:
- string imie, nazwisko;
- int sila, unik, wytrzymalosc;
- };
- int main()
- {
- srand( time( NULL ) );
- bokser player1;
- bokser player2;
- cout << " Witaj w grze WALKA BOKSEROW \n";
- cout << "____________________________ \n \n";
- cout << " Wybierz pierwszego zawodnika z ponizszych wybierajac reprezentujacy \n";
- cout << " go numer i wciskajac ENTER \n";
- cout << " Wybiera gracz 1 \n";
- cout << " 1 - Tomasz Adamek (8, 12, 100) \n";
- cout << " 2 - Wladimir Klitschko (12, 9, 115) \n";
- cout << " 3 - Mike Tyson (13, 10, 110) \n";
- cin >> zawodnik1;
- switch( zawodnik1 )
- {
- case 1:
- {
- zawodnik1 = 1;
- player1.imie = "Tomasz";
- player1.nazwisko = "Adamek";
- player1.sila = 8;
- player1.unik = 12;
- player1.wytrzymalosc = 100;
- break;
- }
- case 2:
- {
- zawodnik1 = 2;
- player1.imie = "Wladimir";
- player1.nazwisko = "Klitschko";
- player1.sila = 12;
- player1.unik = 9;
- player1.wytrzymalosc = 115;
- break;
- }
- case 3:
- {
- zawodnik1 = 3;
- player1.imie = "Mike";
- player1.nazwisko = "Tyson";
- player1.sila = 14;
- player1.unik = 10;
- player1.wytrzymalosc = 105;
- break;
- }
- }
- do{
- system("cls");
- cout << " Wybiera gracz 2 \n";
- cout << " 1 - Tomasz Adamek (8, 12, 100) \n";
- cout << " 2 - Wladimir Klitschko (12, 9, 115) \n";
- cout << " 3 - Mike Tyson (13, 10, 110) \n";
- cin >> zawodnik2;
- switch( zawodnik2 )
- {
- case 1:
- {
- zawodnik2 = 1;
- player2.imie = "Tomasz";
- player2.nazwisko = "Adamek";
- player2.sila = 8;
- player2.unik = 1;
- player2.wytrzymalosc = 100;
- break;
- }
- case 2:
- {
- zawodnik2 = 2;
- player2.imie = "Wladimir";
- player2.nazwisko = "Klitschko";
- player2.sila = 12;
- player2.unik = 1;
- player2.wytrzymalosc = 115;
- break;
- }
- case 3:
- {
- zawodnik2 = 3;
- player2.imie = "Mike";
- player2.nazwisko = "Tyson";
- player2.sila = 14;
- player2.unik = 1;
- player2.wytrzymalosc = 105;
- break;
- }
- }
- } while(zawodnik1 == zawodnik2);
- i = 0;
- W1 = player1.wytrzymalosc;
- W2 = player2.wytrzymalosc;
- A1 = player1.sila;
- A2 = player2.sila;
- U1 = player1.unik;
- U2 = player2.unik;
- pierwszy = rand() % 2 + 1;
- if( pierwszy == 1 )
- {
- cout << " RUNDA 1 ";
- cout << "Rozpoczyna zawodnik 1 !";
- x1 = (( rand() % 4 ) + 1 );
- x2 = (( rand() % 4 ) + 1 );
- A1 = player1.sila * x1;
- U2 = player2.unik * x2;
- cout <<" Parametr A1 = " << A1 <<" Parametr U2 = " << U2 << " \n ";
- cout <<" Parametr X1 = " << x1 <<" Parametr X2 = " << x2 << " \n";
- if( A1 > U2 ) W2 = W2 - A1;
- x3 = (( rand() % 4 ) + 1 );
- x4 = (( rand() % 4 ) + 1 );
- A2 = player2.sila * x3;
- U1 = player1.unik * x4;
- cout <<" Parametr A2 = " << A2 <<" Parametr U1 = " << U1;
- cout <<" Parametr X1 = " << x1 <<" Parametr X2 = " << x2 << " \n";
- if( A2 > U1 ) W1 = W1 - A2;
- }
- else
- {
- cout << " RUNDA 1 ";
- cout << "Rozpoczyna zawodnik 2 !";
- x1 = (( rand() % 4 ) + 1 );
- x2 = (( rand() % 4 ) + 1 );
- A2 = player2.sila * x1;
- U1 = player1.unik * x2;
- cout <<" Parametr A2 = " << A2 <<" Parametr U1 = " << U1;
- if( A1 > U2 ) W2 = W2 - A1;
- x3 = (( rand() % 4 ) + 1 );
- x4 = (( rand() % 4 ) + 1 );
- A1 = player1.sila * x1;
- U2 = player2.unik * x2;
- cout <<" Parametr A1 = " << A1 <<" Parametr U2 = " << U2;
- if( A2 > U1 ) W1 = W1 - A2;
- }
- cout <<" Po RUNDZIE 1: \n";
- cout <<" Wytrzymalosc zawodnika 1 wynosi: " << W1;
- cout <<" Wytrzymalosc zawodnika 2 wynosi: " << W2;
- if (pierwszy == 1)
- {
- for (i = 2; i > 12 || W1 == 0 || W2 == 0; i++)
- {
- if (i%2 == 0)
- {
- cout << " RUNDA " << i;
- cout << "Rozpoczyna zawodnik 2 !";
- x1 = (( rand() % 4 ) + 1 );
- x2 = (( rand() % 4 ) + 1 );
- A2 = player2.sila * x1;
- U1 = player1.unik * x2;
- cout <<" Parametr A2 = " << A1 <<" Parametr U1 = " << U2 << " \n ";
- cout <<" Parametr X1 = " << x1 <<" Parametr X2 = " << x2 << " \n";
- if( A2 > U1 ) W1 = W1 - A2;
- x3 = (( rand() % 4 ) + 1 );
- x4 = (( rand() % 4 ) + 1 );
- A1 = player1.sila * x3;
- U2 = player2.unik * x4;
- cout <<" Parametr Aa = " << A2 <<" Parametr U2 = " << U1;
- cout <<" Parametr X1 = " << x1 <<" Parametr X2 = " << x2 << " \n";
- if( A1 > U2 ) W2 = W2 - A1;
- }
- else
- {
- cout << " RUNDA " << i;
- cout << "Rozpoczyna zawodnik 1 !";
- x1 = (( rand() % 4 ) + 1 );
- x2 = (( rand() % 4 ) + 1 );
- A1 = player1.sila * x1;
- U2 = player2.unik * x2;
- cout <<" Parametr A1 = " << A1 <<" Parametr U2 = " << U2 << " \n ";
- cout <<" Parametr X1 = " << x1 <<" Parametr X2 = " << x2 << " \n";
- if( A1 > U2 ) W2 = W2 - A1;
- x3 = (( rand() % 4 ) + 1 );
- x4 = (( rand() % 4 ) + 1 );
- A2 = player2.sila * x1;
- U1 = player1.unik * x2;
- cout <<" Parametr A2 = " << A2 <<" Parametr U1 = " << U1;
- cout <<" Parametr X1 = " << x1 <<" Parametr X2 = " << x2 << " \n";
- if( A2 > U1 ) W1 = W1 - A2;
- cout <<" Po RUNDZIE " << i <<": \n";
- cout <<" Wytrzymalosc zawodnika 1 wynosi: " << W1;
- cout <<" Wytrzymalosc zawodnika 2 wynosi: " << W2;
- cin >> runda;
- }
- }
- }
- else
- {
- for (i = 2; i > 12 || W1 == 0 || W2 == 0; i++)
- {
- if (i%2 == 0)
- {
- cout << " RUNDA " << i;
- cout << "Rozpoczyna zawodnik 1 !";
- x1 = (( rand() % 4 ) + 1 );
- x2 = (( rand() % 4 ) + 1 );
- A1 = player1.sila * x1;
- U2 = player2.unik * x2;
- cout <<" Parametr A1 = " << A1 <<" Parametr U2 = " << U2 << " \n ";
- cout <<" Parametr X1 = " << x1 <<" Parametr X2 = " << x2 << " \n";
- if( A1 > U2 ) W2 = W2 - A1;
- x3 = (( rand() % 4 ) + 1 );
- x4 = (( rand() % 4 ) + 1 );
- A2 = player2.sila * x1;
- U1 = player1.unik * x2;
- cout <<" Parametr A2 = " << A2 <<" Parametr U1 = " << U1;
- cout <<" Parametr X1 = " << x1 <<" Parametr X2 = " << x2 << " \n";
- if( A2 > U1 ) W1 = W1 - A2;
- cout <<" Po RUNDZIE " << i <<": \n";
- cout <<" Wytrzymalosc zawodnika 1 wynosi: " << W1;
- cout <<" Wytrzymalosc zawodnika 2 wynosi: " << W2;
- }
- else
- {
- cout << " RUNDA " << i;
- cout << "Rozpoczyna zawodnik 2 !";
- x1 = (( rand() % 4 ) + 1 );
- x2 = (( rand() % 4 ) + 1 );
- A2 = player2.sila * x1;
- U1 = player1.unik * x2;
- cout <<" Parametr A2 = " << A1 <<" Parametr U1 = " << U2 << " \n ";
- cout <<" Parametr X1 = " << x1 <<" Parametr X2 = " << x2 << " \n";
- if( A2 > U1 ) W1 = W1 - A2;
- x3 = (( rand() % 4 ) + 1 );
- x4 = (( rand() % 4 ) + 1 );
- A1 = player1.sila * x3;
- U2 = player2.unik * x4;
- cout <<" Parametr Aa = " << A2 <<" Parametr U2 = " << U1;
- cout <<" Parametr X1 = " << x1 <<" Parametr X2 = " << x2 << " \n";
- if( A1 > U2 ) W2 = W2 - A1;
- }
- }
- }
- if( W1 == 0 )
- cout << "Zawodnik 2 znokautowal zawodnika 1 !";
- else
- if( W2 == 0 )
- cout << "Zawodnik 1 znokautowal zawodnika 2 !";
- else
- cout << "REMIS !";
- system( "PAUSE" );
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement