Esempio n. 1
0
 protected void CatchRivalCheckers(int x, int y, bool color)
 {
     if (x < 5 && !CheckCellFree(x + 1, y) && board[x + 1, y].Checker.color != board[x, y].Checker.color)
     {
         board[x + 1, y].Checker.ChangeOwnerPlayer((x + 1) * 80 + 33, y * 80 + 56);
     }
     if (x < 5 && y < 5 && !CheckCellFree(x + 1, y + 1) && board[x + 1, y + 1].Checker.color != board[x, y].Checker.color)
     {
         board[x + 1, y + 1].Checker.ChangeOwnerPlayer((x + 1) * 80 + 33, (y + 1) * 80 + 56);
     }
     if (y < 5 && !CheckCellFree(x, y + 1) && board[x, y + 1].Checker.color != board[x, y].Checker.color)
     {
         board[x, y + 1].Checker.ChangeOwnerPlayer(x * 80 + 33, (y + 1) * 80 + 56);
     }
     if (x > 0)
     {
         if (!CheckCellFree(x - 1, y) && board[x - 1, y].Checker.color != board[x, y].Checker.color)
         {
             board[x - 1, y].Checker.ChangeOwnerPlayer((x - 1) * 80 + 33, y * 80 + 56);
         }
         if (y < 5 && !CheckCellFree(x - 1, y + 1) && board[x - 1, y + 1].Checker.color != board[x, y].Checker.color)
         {
             board[x - 1, y + 1].Checker.ChangeOwnerPlayer((x - 1) * 80 + 33, (y + 1) * 80 + 56);
         }
     }
     if (y > 0)
     {
         if (!CheckCellFree(x, y - 1) && board[x, y - 1].Checker.color != board[x, y].Checker.color)
         {
             board[x, y - 1].Checker.ChangeOwnerPlayer(x * 80 + 33, (y - 1) * 80 + 56);
         }
         if (x < 5 && !CheckCellFree(x + 1, y - 1) && board[x + 1, y - 1].Checker.color != board[x, y].Checker.color)
         {
             board[x + 1, y - 1].Checker.ChangeOwnerPlayer((x + 1) * 80 + 33, (y - 1) * 80 + 56);
         }
     }
     if (y > 0 && x > 0)
     {
         if (!CheckCellFree(x - 1, y - 1) && board[x - 1, y - 1].Checker.color != board[x, y].Checker.color)
         {
             board[x - 1, y - 1].Checker.ChangeOwnerPlayer((x - 1) * 80 + 33, (y - 1) * 80 + 56);
         }
     }
     ChangeBoardCount.EventHandler(first_player.cells_taken, second_player.cells_taken);
 }
Esempio n. 2
0
 protected virtual void AddPlayers()
 {
     first_player  = new Player(false, ref board, 5, 5, sender, false);
     second_player = new Player(true, ref board, 0, 0, sender, false);
     ChangeBoardCount.EventHandler(first_player.cells_taken, second_player.cells_taken);
 }