daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Jan 13th, 2018 46 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. // Geeft true als kleur schaak staat
  2. //Kleur (color) is the parameter to decide for what color to check
  3. //if the king of that color is checked
  4. bool game::schaak(zw kleur) {
  5.     //Getting the opposite color
  6.     //If kleur = white (wit), oppositeColor
  7.     //is black (zwart)
  8.     zw oppositeColor = zwart;
  9.  
  10.     //Setting the king (white or black)
  11.     //in variable schaakStuk* king;
  12.     schaakStuk* king = witKoning;
  13.     string color = "Wit staat schaak!!"; //String to display in message
  14.     if (kleur == zwart) {
  15.         //If the color-parameter is black, oppositeColor
  16.         //and king should be changed related to color
  17.         oppositeColor = wit;
  18.         king = zwartKoning;
  19.         color = "Zwart staat schaak!!!";
  20.     }
  21.  
  22.     //Vector holding valid moves (read more below)
  23.     vector<string> v;
  24.     //Iterating over all chess pieces on the board
  25.     for (auto i : schaakStukken) {
  26.         //If chess-piece is of opposite color
  27.         if (i.second->getKleur() == oppositeColor) {
  28.             //Setting all valid moves of chess-piece
  29.             //in current iteration
  30.             v = i.second->geldige_zetten(*this, i.first);
  31.  
  32.             //Iterating over all valid positions of chess-piece
  33.             //in current iteration
  34.             for (auto j : v) {
  35.                 //if one of the valid possible positions equals to
  36.                 //the enemy's king position
  37.                 if (j == king->getCurrentPositie().str()) {
  38.                     //Show message and return
  39.                     QMessageBox joehoe;
  40.                     joehoe.setText(QString::fromStdString(color));
  41.                     joehoe.exec();
  42.  
  43.                     //Outputting all valid positions
  44.                     cout << "j " << j << endl;
  45.  
  46.                     //Temporarily commented out
  47.                     //return true;
  48.                 }
  49.             }
  50.         }
  51.     }
  52.  
  53.     return false;
  54. }
  55.    
  56. MainWindow::setPiece()
  57.    
  58. void MainWindow::update()
  59.    
  60. MainWindow::clicked()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top