Exemple #1
0
 public static Piece construct(string nom, int horizontal, int vertical, bool color)
 {
     Piece obj;
     switch (nom)
     {
         case "Pion":
             obj = new Pion(horizontal, vertical, color);
             break;
         case "Tour":
             obj = new Tour(horizontal, vertical, color);
             break;
         case "Fou":
             obj = new Fou(horizontal, vertical, color);
             break;
         case "Cavalier":
             obj = new Cavalier(horizontal, vertical, color);
             break;
         case "Roi":
             obj = new Roi(horizontal, vertical, color);
             break;
         case "Dame":
             obj = new Dame(horizontal, vertical, color);
             break;
         default:
             obj = null;
             break;
     }
     return obj;
 }
Exemple #2
0
 public static void initPiece(int ligne, bool color)
 {
     plateau[ligne, 0] = new Tour(ligne, 0, color);
     plateau[ligne, 1] = new Cavalier(ligne, 1, color);
     plateau[ligne, 2] = new Fou(ligne, 2, color);
     plateau[ligne, 3] = new Dame(ligne, 3, color);
     plateau[ligne, 4] = new Roi(ligne, 4, color);
     plateau[ligne, 5] = new Fou(ligne, 5, color);
     plateau[ligne, 6] = new Cavalier(ligne, 6, color);
     plateau[ligne, 7] = new Tour(ligne, 7, color);
 }