Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.76 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. enum plansza {puste=0, bialy=1, czarny=2};
  4.  
  5. void wyswietl(plansza tablica[])
  6. {
  7.     for(int i=0; i < 64; i++)
  8.     {
  9.         std::cout << tablica[i];
  10.         if(i == 7 || i == 15 || i == 23 || i == 31 || i == 39 || i == 47 || i == 55 || i == 63)
  11.         {
  12.             std::cout << "\n";
  13.         }
  14.     }
  15.     std::cout << "\n";
  16. }
  17.  
  18. void rozgrywka(plansza tablica[])
  19. {
  20.     int i = 0;
  21.     while(1)
  22.     {
  23.         wyswietl(tablica);
  24.  
  25.         if(i == 0)
  26.         {
  27.             tablica[] =  bialy;
  28.         }
  29.         else if(i == 1)
  30.         {
  31.             tablica[] =  czarny;
  32.         }
  33.  
  34.         else
  35.         {
  36.             i = 0;
  37.         }
  38.         i++;
  39.     }
  40. }
  41.  
  42. void przypisz(plansza tablica[], plansza bialy, plansza czarny)
  43. {
  44.     for(int i=1; i <= 7; i+=2)
  45.     {
  46.         int j = 0;
  47.         tablica[i] = bialy;
  48.         j++;
  49.     }
  50.  
  51.     for(int i=8; i <= 14; i+=2)
  52.     {
  53.         int j = 0;
  54.         tablica[i] = bialy;
  55.         j++;
  56.     }
  57.  
  58.     for(int i=17; i <= 24; i+=2)
  59.     {
  60.         int j = 0;
  61.         tablica[i] = bialy;
  62.         j++;
  63.     }
  64.  
  65.     for(int i=40; i <= 47; i+=2)
  66.     {
  67.         int j = 0;
  68.         tablica[i] = czarny;
  69.         j++;
  70.     }
  71.  
  72.     for(int i=49; i <= 55; i+=2)
  73.     {
  74.         int j = 0;
  75.         tablica[i] = czarny;
  76.         j++;
  77.     }
  78.  
  79.     for(int i=56; i <= 63; i+=2)
  80.     {
  81.         int j = 0;
  82.         tablica[i] = czarny;
  83.         j++;
  84.     }
  85. }
  86.  
  87. int main()
  88. {
  89.     int wyborMiejsca, wyborMiejscaNowego;
  90.     plansza tablica[64];
  91.  
  92.     std::cout << "Warcaby gorne od 1 do 24 co drugie miejsce\n";
  93.     std::cout << "Warcaby dolne od 41 do 63 co drugie miejsce\n";
  94.  
  95.     przypisz(tablica, bialy, czarny);
  96.  
  97.     rozgrywka(tablica, wyborMiejsca, wyborMiejscaNowego);
  98.  
  99.     return 0;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement