Guest User

Chess

a guest
Feb 27th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.59 KB | None | 0 0
  1. private void newtile_click(object sender, EventArgs e)
  2.         {
  3.             Tile t = (Tile)sender;
  4.             t.Image = Chess.Properties.Resources.green;
  5.             if (greentile != null)
  6.             {
  7.                 greentile.Image = null;
  8.                 Piece p1 = getpiece(greentile);
  9.                 if (p1 != null)
  10.                 {
  11.                     if (p1.color == Color.White)
  12.                     {
  13.                         if (p1.rank == Piece.type.pawn)
  14.                         {
  15.                             drawpiece(t, "♙");
  16.                         }
  17.                         else if (p1.rank == Piece.type.rook)
  18.                         {
  19.                             drawpiece(t, "♖");
  20.                         }
  21.                         else if (p1.rank == Piece.type.knight)
  22.                         {
  23.                             drawpiece(t, "♘");
  24.                         }
  25.                         else if (p1.rank == Piece.type.bishop)
  26.                         {
  27.                             drawpiece(t, "♗");
  28.                         }
  29.                         else if (p1.rank == Piece.type.queen)
  30.                         {
  31.                             drawpiece(t, "♕");
  32.                         }
  33.                         else if (p1.rank == Piece.type.king)
  34.                         {
  35.                             drawpiece(t, "♔");
  36.                         }
  37.                     }
  38.                     else if (p1.color == Color.Black)
  39.                     {
  40.                         if (p1.rank == Piece.type.pawn)
  41.                         {
  42.                             drawpiece(t, "♟");
  43.                         }
  44.                         else if (p1.rank == Piece.type.rook)
  45.                         {
  46.                             drawpiece(t, "♜");
  47.                         }
  48.                         else if (p1.rank == Piece.type.knight)
  49.                         {
  50.                             drawpiece(t, "♞");
  51.                         }
  52.                         else if (p1.rank == Piece.type.bishop)
  53.                         {
  54.                             drawpiece(t, "♝");
  55.                         }
  56.                         else if (p1.rank == Piece.type.queen)
  57.                         {
  58.                             drawpiece(t, "♛");
  59.                         }
  60.                         else if (p1.rank == Piece.type.king)
  61.                         {
  62.                             drawpiece(t, "♚");
  63.                         }
  64.                     }
  65.                 }
  66.             }
  67.             Piece p = getpiece(t);
  68.             greentile = t;
  69.             p = getpiece(t);
  70.             if (p != null)
  71.             {
  72.                 if (p.color == Color.White)
  73.                 {
  74.                     if (p.rank == Piece.type.pawn)
  75.                     {
  76.                         drawpiece(t, "♙");
  77.                     }
  78.                     else if (p.rank == Piece.type.rook)
  79.                     {
  80.                         drawpiece(t, "♖");
  81.                     }
  82.                     else if (p.rank == Piece.type.knight)
  83.                     {
  84.                         drawpiece(t, "♘");
  85.                     }
  86.                     else if (p.rank == Piece.type.bishop)
  87.                     {
  88.                         drawpiece(t, "♗");
  89.                     }
  90.                     else if (p.rank == Piece.type.queen)
  91.                     {
  92.                         drawpiece(t, "♕");
  93.                     }
  94.                     else if (p.rank == Piece.type.king)
  95.                     {
  96.                         drawpiece(t, "♔");
  97.                     }
  98.                 }
  99.                 else if (p.color == Color.Black)
  100.                 {
  101.                     if (p.rank == Piece.type.pawn)
  102.                     {
  103.                         drawpiece(t, "♟");
  104.                     }
  105.                     else if (p.rank == Piece.type.rook)
  106.                     {
  107.                         drawpiece(t, "♜");
  108.                     }
  109.                     else if (p.rank == Piece.type.knight)
  110.                     {
  111.                         drawpiece(t, "♞");
  112.                     }
  113.                     else if (p.rank == Piece.type.bishop)
  114.                     {
  115.                         drawpiece(t, "♝");
  116.                     }
  117.                     else if (p.rank == Piece.type.queen)
  118.                     {
  119.                         drawpiece(t, "♛");
  120.                     }
  121.                     else if (p.rank == Piece.type.king)
  122.                     {
  123.                         drawpiece(t, "♚");
  124.                     }
  125.                 }
  126.             }
  127.         }
Advertisement
Add Comment
Please, Sign In to add comment