Pella86

Lezione 1 - scacchi

Oct 14th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. /* Piccola applicazione per gli scacchi */
  2.  
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. enum NomePezzo{
  8.     pedone = 0,
  9.     alfiere = 1,
  10.     cavallo = 2,
  11.     torre = 3,
  12.     regina = 4,
  13.     re = 5,
  14. };
  15.  
  16. enum ColorePezzo{
  17.     bianco = 0,
  18.     nero = 1,
  19. };
  20.  
  21. int main()
  22. {
  23.  
  24.     int colore = 0;
  25.  
  26.     while (colore < 2){
  27.  
  28.         int nome = 0;
  29.  
  30.         while(nome < 6){
  31.             int punteggio;
  32.  
  33.             if(nome == pedone){
  34.                 punteggio = 1;
  35.             }
  36.             else if(nome == alfiere || nome == cavallo){
  37.                 punteggio = 3;
  38.             }
  39.             else if(nome == torre){
  40.                 punteggio = 5;
  41.             }
  42.             else if(nome == regina){
  43.                 punteggio = 10;
  44.             }
  45.             else if(nome == re){
  46.                 punteggio = 11;
  47.             }
  48.  
  49.             cout << "pezzo:" << nome << " colore " << colore << " punteggio: " << punteggio << endl;
  50.  
  51.             nome += 1;
  52.         }
  53.  
  54.         colore += 1;
  55.     }
  56.  
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment