Game Levels 4 Tic Tac Toe (Single Player)

Single Player Game

In single player game you may provide at least three levels, like EASY, MEDIUM and HARD.
 
You know it's a two player game so when the user will select to play with Single Player then the opponent player will be system(like Phone or PC).
So in this game when the player will moves his turn, system will move the turn automatically. No we have to decide that how to instruct the system to move its turn on which blank pad, Now I am going to briefly describe about the instruction for the computer/phone/any system.
 
Label: EASY

In this level you may instruct the system to move its turn randomly on blank pad.
What You should keep in mind at this level:

STEP 1

Count all blank PAD(which is not marked by any player(either by player or phone) and put all blank pads name into:

List<string>

Note: Where pad is a button control. 
[WHERE : PAD denotes all nine boxes on which user marks their move either by O or X ] 
Example

List<string> allBlankPad =new List<string>()

Now put all the blank pad's name into this List of string (allBlankPad) 
STEP 2

Generate random number from 0 to Count(total no of blank pad -1)
 int buttons = randomPad.Next(0, allBlankPad.Count - 1);
STEP 3

Mark the pad at: allBlankPad[buttons]
Here buttons is the random index  of blank pad

Example Code

   
int buttons = randomPad.Next(0, allBlankPad.Count - 1);
string haveToMarkAsMobilePad = allBlankPad[buttons].ToString();

Label: MEDIUM
Label
STEP 1

Find the allBlankPad, allPlayerMarkedPad and SystemMarkedPad and keep them into List<string> or ArrayList

STEP 2

Check all the win condition for opponent , If opponent has two consecutive marked pad then marked the pad to prevent them to won otherwise generate a random number from 0 to total number of blankpad+1 and mark the blank pad which suggested by random number.
You may use the following logic to do it.

Example Code
  1. public string Medium(List<string> playerAllMarkedPad, List<string> allMobileMarkedPad, List<string> allBlankPad)  
  2. {  
  3.       countPad = playerAllMarkedPad.Count;  
  4.       haveToMarkAsMobilePad = "Empty";  
  5.       //IF Total Playe's MArked Pad=1  
  6.       if (countPad == 1)  
  7.       {  
  8.             switch (playerAllMarkedPad[0].ToString())  
  9.             {  
  10.                   case "btnOne": haveToMarkAsMobilePad = "btnFifth"break;  
  11.                   case "btnTwo": haveToMarkAsMobilePad = "btnFifth"break;  
  12.                   case "btnThree": haveToMarkAsMobilePad = "btnFifth"break;  
  13.                   case "btnFourth": haveToMarkAsMobilePad = "btnFifth"break;  
  14.                   case "btnFifth": haveToMarkAsMobilePad = "btnOne"break;  
  15.                   case "btnSixth": haveToMarkAsMobilePad = "btnFifth"break;  
  16.                   case "btnSeventh": haveToMarkAsMobilePad = "btnFifth"break;  
  17.                   case "btnEighth": haveToMarkAsMobilePad = "btnFifth"break;  
  18.                   case "btnNinth": haveToMarkAsMobilePad = "btnFifth"break;  
  19.                   defaultbreak;  
  20.             }  
  21.       }  
  22. //IF Total Playe's MArked Pad=2  
  23.       else if (countPad == 2)  
  24.       {  
  25.             switch (playerAllMarkedPad[0].ToString())  
  26.             {  
  27.                   case "btnOne":  
  28.                   if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  29.                   {  
  30.                         if (allMobileMarkedPad[0].ToString() != "btnThree")  
  31.                         haveToMarkAsMobilePad = "btnThree";  
  32.                         else  
  33.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  34.                   }  
  35.                   else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  36.                   {  
  37.                         if (allMobileMarkedPad[0].ToString() == "btnTwo")  
  38.                         haveToMarkAsMobilePad = "btnTwo";  
  39.                         else  
  40.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  41.                   }  
  42.                   else if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  43.                   {  
  44.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  45.                         haveToMarkAsMobilePad = "btnSeventh";  
  46.                         else  
  47.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  48.                   }  
  49.                   else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  50.                   {  
  51.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  52.                         haveToMarkAsMobilePad = "btnNinth";  
  53.                         else  
  54.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  55.                   }  
  56.                   else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  57.                   {  
  58.                         if (allMobileMarkedPad[0].ToString() != "btnSixth")  
  59.                         haveToMarkAsMobilePad = "btnThree";  
  60.                         else  
  61.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  62.                   }  
  63.                   else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  64.                   {  
  65.                         if (allMobileMarkedPad[0].ToString() != "btnFourth")  
  66.                         haveToMarkAsMobilePad = "btnFourth";  
  67.                         else  
  68.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  69.                   }  
  70.                   else if (playerAllMarkedPad[1].ToString() == "btnEighth")  
  71.                   {  
  72.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  73.                         haveToMarkAsMobilePad = "btnSeventh";  
  74.                         else  
  75.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  76.                   }  
  77.                   else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  78.                   {  
  79.                         if (allMobileMarkedPad[0].ToString() != "btnThree")  
  80.                         haveToMarkAsMobilePad = "btnThree";  
  81.                         else  
  82.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  83.                   }  
  84.                   break;  
  85.                   case "btnTwo":  
  86.                   if (playerAllMarkedPad[1].ToString() == "btnOne")  
  87.                   {  
  88.                         if (allMobileMarkedPad[0].ToString() != "btnThree")  
  89.                         haveToMarkAsMobilePad = "btnThree";  
  90.                         else  
  91.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  92.                   }  
  93.                   else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  94.                   {  
  95.                         if (allMobileMarkedPad[0].ToString() != "btnOne")  
  96.                         haveToMarkAsMobilePad = "btnOne";  
  97.                         else  
  98.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  99.                   }  
  100.                   else if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  101.                   {  
  102.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  103.                         haveToMarkAsMobilePad = "btnSeventh";  
  104.                         else  
  105.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  106.                   }  
  107.                   else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  108.                   {  
  109.                         if (allMobileMarkedPad[0].ToString() != "btnEighth")  
  110.                         haveToMarkAsMobilePad = "btnEighth";  
  111.                         else  
  112.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  113.                   }  
  114.                   else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  115.                   {  
  116.                         if (allMobileMarkedPad[0].ToString() != "btnThree")  
  117.                         haveToMarkAsMobilePad = "btnThree";  
  118.                         else  
  119.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  120.                   }  
  121.                   else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  122.                   {  
  123.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  124.                         haveToMarkAsMobilePad = "btnNinth";  
  125.                         else  
  126.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  127.                   }  
  128.                   else if (playerAllMarkedPad[1].ToString() == "btnEighth")  
  129.                   {  
  130.                         if (allMobileMarkedPad[0].ToString() != "btnFifth")  
  131.                         haveToMarkAsMobilePad = "btnFifth";  
  132.                         else  
  133.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  134.                   }  
  135.                   else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  136.                   {  
  137.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  138.                         haveToMarkAsMobilePad = "btnSeventh";  
  139.                         else  
  140.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  141.                   }  
  142.                   break;  
  143.                   case "btnThree":  
  144.                   if (playerAllMarkedPad[1].ToString() == "btnOne")  
  145.                   {  
  146.                         if (allMobileMarkedPad[0].ToString() != "btnTwo")  
  147.                         haveToMarkAsMobilePad = "btnTwo";  
  148.                         else  
  149.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  150.                   }  
  151.                   else if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  152.                   {  
  153.                         if (allMobileMarkedPad[0].ToString() != "btnOne")  
  154.                         haveToMarkAsMobilePad = "btnOne";  
  155.                         else  
  156.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  157.                   }  
  158.                   else if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  159.                   {  
  160.                         if (allMobileMarkedPad[0].ToString() != "btnSixth")  
  161.                         haveToMarkAsMobilePad = "btnSixth";  
  162.                         else  
  163.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  164.                   }  
  165.                   else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  166.                   {  
  167.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  168.                         haveToMarkAsMobilePad = "btnSeventh";  
  169.                         else  
  170.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  171.                   }  
  172.                   else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  173.                   {  
  174.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  175.                         haveToMarkAsMobilePad = "btnNinth";  
  176.                         else  
  177.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  178.                   }  
  179.                   else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  180.                   {  
  181.                         if (allMobileMarkedPad[0].ToString() != "btnFifth")  
  182.                         haveToMarkAsMobilePad = "btnFifth";  
  183.                         else  
  184.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  185.                   }        
  186.                   else if (playerAllMarkedPad[1].ToString() == "btnEighth")  
  187.                   {  
  188.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  189.                         haveToMarkAsMobilePad = "btnNinth";  
  190.                         else  
  191.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  192.                   }  
  193.                  else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  194.                  {  
  195.                         if (allMobileMarkedPad[0].ToString() != "btnSixth")  
  196.                         haveToMarkAsMobilePad = "btnSixth";  
  197.                         else  
  198.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  199.                   }  
  200.                   break;  
  201.                   case "btnFourth":  
  202.                   if (playerAllMarkedPad[1].ToString() == "btnOne")  
  203.                   {  
  204.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  205.                         haveToMarkAsMobilePad = "btnSeventh";  
  206.                         else  
  207.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  208.                   }  
  209.                   else if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  210.                   {  
  211.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  212.                         haveToMarkAsMobilePad = "btnNinth";  
  213.                         else  
  214.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  215.                   }  
  216.                   else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  217.                   {  
  218.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  219.                         haveToMarkAsMobilePad = "btnSeventh";  
  220.                         else  
  221.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  222.                   }  
  223.                   else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  224.                   {  
  225.                         if (allMobileMarkedPad[0].ToString() != "btnSixth")  
  226.                         haveToMarkAsMobilePad = "btnSixth";  
  227.                         else  
  228.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  229.                   }  
  230.                   else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  231.                   {  
  232.                         if (allMobileMarkedPad[0].ToString() != "btnFifth")  
  233.                        haveToMarkAsMobilePad = "btnFifth";  
  234.                         else  
  235.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  236.                   }  
  237.                   else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  238.                   {  
  239.                         if (allMobileMarkedPad[0].ToString() != "btnOne")  
  240.                         haveToMarkAsMobilePad = "btnOne";  
  241.                         else  
  242.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  243.                   }  
  244.                   else if (playerAllMarkedPad[1].ToString() == "btnEighth")  
  245.                   {  
  246.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  247.                         haveToMarkAsMobilePad = "btnSeventh";  
  248.                         else  
  249.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  250.                   }  
  251.                   else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  252.                   {  
  253.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  254.                         haveToMarkAsMobilePad = "btnSeventh";  
  255.                         else  
  256.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  257.                   }  
  258.                   break;  
  259.                      case "btnFifth":  
  260.                   if (playerAllMarkedPad[1].ToString() == "btnOne")  
  261.                   {  
  262.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  263.                         haveToMarkAsMobilePad = "btnNinth";  
  264.                         else  
  265.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  266.                   }  
  267.                   else if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  268.                   {  
  269.                         if (allMobileMarkedPad[0].ToString() != "btnEighth")  
  270.                         haveToMarkAsMobilePad = "btnEighth";  
  271.                         else  
  272.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  273.                   }  
  274.                   else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  275.                   {  
  276.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  277.                         haveToMarkAsMobilePad = "btnSeventh";  
  278.                         else  
  279.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  280.                   }  
  281.                   else if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  282.                   {  
  283.                         if (allMobileMarkedPad[0].ToString() != "btnSixth")  
  284.                         haveToMarkAsMobilePad = "btnSixth";  
  285.                         else  
  286.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  287.                   }  
  288.                   else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  289.                   {  
  290.                         if (allMobileMarkedPad[0].ToString() != "btnFourth")  
  291.                         haveToMarkAsMobilePad = "btnFourth";  
  292.                         else  
  293.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  294.                   }  
  295.                   else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  296.                   {  
  297.                         if (allMobileMarkedPad[0].ToString() != "btnThree")  
  298.                         haveToMarkAsMobilePad = "btnThree";  
  299.                         else  
  300.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  301.                   }  
  302.                   else if (playerAllMarkedPad[1].ToString() == "btnEighth")  
  303.                   {  
  304.                         if (allMobileMarkedPad[0].ToString() != "btnTwo")  
  305.                         haveToMarkAsMobilePad = "btnTwo";  
  306.                         else  
  307.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  308.                   }  
  309.                   else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  310.                   {  
  311.                         if (allMobileMarkedPad[0].ToString() != "btnOne")  
  312.                         haveToMarkAsMobilePad = "btnOne";  
  313.                         else  
  314.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  315.                   }  
  316.                   break;  
  317.                   case "btnSixth":  
  318.                   if (playerAllMarkedPad[1].ToString() == "btnOne")  
  319.                   {  
  320.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  321.                         haveToMarkAsMobilePad = "btnSeventh";  
  322.                         else  
  323.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  324.                   }  
  325.                   else if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  326.                   {  
  327.                         if (allMobileMarkedPad[0].ToString() != "btnThree")  
  328.                         haveToMarkAsMobilePad = "btnThree";  
  329.                         else  
  330.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  331.                   }  
  332.                   else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  333.                   {  
  334.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  335.                         haveToMarkAsMobilePad = "btnNinth";  
  336.                         else  
  337.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  338.                   }  
  339.                   else if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  340.                   {  
  341.                         if (allMobileMarkedPad[0].ToString() != "btnFifth")  
  342.                         haveToMarkAsMobilePad = "btnFifth";  
  343.                         else  
  344.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  345.                   }        
  346.                   else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  347.                   {  
  348.                         if (allMobileMarkedPad[0].ToString() != "btnFourth")  
  349.                         haveToMarkAsMobilePad = "btnFourth";  
  350.                         else  
  351.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  352.                   }  
  353.                   else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  354.                   {  
  355.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  356.                         haveToMarkAsMobilePad = "btnNinth";  
  357.                         else  
  358.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  359.                   }  
  360.                   else if (playerAllMarkedPad[1].ToString() == "btnEighth")  
  361.                   {  
  362.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  363.                         haveToMarkAsMobilePad = "btnNinth";  
  364.                         else  
  365.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  366.                   }  
  367.                   else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  368.                   {  
  369.                         if (allMobileMarkedPad[0].ToString() != "btnThree")  
  370.                         haveToMarkAsMobilePad = "btnThree";  
  371.                         else  
  372.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  373.                   }  
  374.                   break;  
  375.                   case "btnSeventh":  
  376.                   if (playerAllMarkedPad[1].ToString() == "btnOne")  
  377.                   {  
  378.                         if (allMobileMarkedPad[0].ToString() != "btnFourth")  
  379.                         haveToMarkAsMobilePad = "btnFourth";  
  380.                         else  
  381.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  382.                   }  
  383.                   else if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  384.                   {  
  385.                         if (allMobileMarkedPad[0].ToString() != "btnOne")  
  386.                         haveToMarkAsMobilePad = "btnOne";  
  387.                         else  
  388.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  389.                   }  
  390.                   else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  391.                   {  
  392.                         if (allMobileMarkedPad[0].ToString() != "btnFifth")  
  393.                         haveToMarkAsMobilePad = "btnFifth";  
  394.                         else  
  395.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  396.                   }  
  397.                   else if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  398.                   {  
  399.                         if (allMobileMarkedPad[0].ToString() != "btnOne")  
  400.                         haveToMarkAsMobilePad = "btnOne";  
  401.                         else  
  402.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  403.                   }  
  404.                   else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  405.                   {  
  406.                      if (allMobileMarkedPad[0].ToString() != "btnThree")  
  407.                         haveToMarkAsMobilePad = "btnThree";  
  408.                         else  
  409.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  410.                   }  
  411.                   else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  412.                   {  
  413.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  414.                         haveToMarkAsMobilePad = "btnNinth";  
  415.                         else  
  416.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  417.                   }  
  418.                   else if (playerAllMarkedPad[1].ToString() == "btnEighth")  
  419.                   {  
  420.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  421.                         haveToMarkAsMobilePad = "btnNinth";  
  422.                         else  
  423.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  424.                   }  
  425.                   else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  426.                   {  
  427.                         if (allMobileMarkedPad[0].ToString() != "btnEighth")  
  428.                         haveToMarkAsMobilePad = "btnEighth";  
  429.                         else  
  430.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  431.                   }  
  432.                   break;  
  433.                   case "btnEighth":  
  434.                   if (playerAllMarkedPad[1].ToString() == "btnOne")  
  435.                   {  
  436.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  437.                         haveToMarkAsMobilePad = "btnSeventh";  
  438.                         else  
  439.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  440.                   }  
  441.                   else if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  442.                   {  
  443.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  444.                         haveToMarkAsMobilePad = "btnNinth";  
  445.                         else  
  446.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  447.                   }  
  448.                   else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  449.                   {  
  450.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  451.                         haveToMarkAsMobilePad = "btnNinth";  
  452.                         else  
  453.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  454.                   }  
  455.                   else if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  456.                   {  
  457.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  458.                         haveToMarkAsMobilePad = "btnSeventh";  
  459.                         else  
  460.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  461.                   }  
  462.                   else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  463.                   {  
  464.                         if (allMobileMarkedPad[0].ToString() != "btnTwo")  
  465.                         haveToMarkAsMobilePad = "btnTwo";  
  466.                         else  
  467.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  468.                   }  
  469.                   else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  470.                   {  
  471.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  472.                         haveToMarkAsMobilePad = "btnNinth";  
  473.                         else  
  474.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  475.                   }  
  476.                   else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  477.                   {  
  478.                         if (allMobileMarkedPad[0].ToString() != "btnNinth")  
  479.                         haveToMarkAsMobilePad = "btnNinth";  
  480.                         else  
  481.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  482.                   }  
  483.                   else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  484.                   {  
  485.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  486.                         haveToMarkAsMobilePad = "btnSeventh";  
  487.                         else  
  488.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  489.                   }  
  490.                   break;  
  491.                   case "btnNinth":  
  492.                   if (playerAllMarkedPad[1].ToString() == "btnOne")  
  493.                   {  
  494.                         if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  495.                         haveToMarkAsMobilePad = "btnSeventh";  
  496.                         else  
  497.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  498.                   }  
  499.                   else if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  500.                   {  
  501.                         if (allMobileMarkedPad[0].ToString() != "btnThree")  
  502.                         haveToMarkAsMobilePad = "btnThree";  
  503.                         else  
  504.                         haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  505.                   }  
  506.                   else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  507.                   {     
  508.                         if (allMobileMarkedPad[0].ToString() != "btnSixth")  
  509.                         haveToMarkAsMobilePad = "btnSixth";  
  510.                         else  
  511.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  512.             }  
  513.             else if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  514.             {  
  515.                   if (allMobileMarkedPad[0].ToString() != "btnSeventh")  
  516.                   haveToMarkAsMobilePad = "btnSeventh";  
  517.                   else  
  518.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  519.             }  
  520.             else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  521.             {  
  522.                   if (allMobileMarkedPad[0].ToString() != "btnThree")  
  523.                   haveToMarkAsMobilePad = "btnThree";  
  524.                   else  
  525.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  526.             }  
  527.             else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  528.             {  
  529.                   if (allMobileMarkedPad[0].ToString() != "btnThree")  
  530.                   haveToMarkAsMobilePad = "btnThree";  
  531.                   else  
  532.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  533.             }  
  534.             else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  535.             {  
  536.                   if (allMobileMarkedPad[0].ToString() != "btnEighth")  
  537.                   haveToMarkAsMobilePad = "btnEighth";  
  538.                   else  
  539.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  540.             }  
  541.             break;  
  542.       }  
  543. }  
  544. //IF Total Playe's MArked Pad=2  
  545. else if (countPad == 3)  
  546. {  
  547.       switch (playerAllMarkedPad[0].ToString())  
  548.       {  
  549.       case "btnOne":  
  550.       //All Possible Wind Condition with btnOne[ 123,159,147 ]  
  551.       //[1. For 123 position ]  
  552.       if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  553.       {  
  554.             haveToMarkAsMobilePad = "btnThree";  
  555.             if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  556.             haveToMarkAsMobilePad = "btnThree";  
  557.             else  
  558.             haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  559.             }  
  560.             else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  561.             {  
  562.                   haveToMarkAsMobilePad = "btnTwo";  
  563.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  564.                   haveToMarkAsMobilePad = "btnTwo";  
  565.                   else  
  566.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  567.             }  
  568.             //[2. For 147 position  
  569.             else if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  570.             {  
  571.                   haveToMarkAsMobilePad = "btnSeventh";  
  572.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  573.                   haveToMarkAsMobilePad = "btnSeventh";  
  574.                   else  
  575.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  576.             }  
  577.             else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  578.             {  
  579.                   haveToMarkAsMobilePad = "btnFourth";  
  580.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  581.                   haveToMarkAsMobilePad = "btnFourth";  
  582.                   else  
  583.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  584.             }  
  585.             //[3. For 159 position ]  
  586.             else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  587.             {  
  588.                   haveToMarkAsMobilePad = "btnNinth";  
  589.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  590.                   haveToMarkAsMobilePad = "btnNinth";  
  591.                   else  
  592.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  593.             }  
  594.             else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  595.             {  
  596.                   haveToMarkAsMobilePad = "btnFifth";  
  597.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  598.                   haveToMarkAsMobilePad = "btnFifth";  
  599.                   else  
  600.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  601.             }  
  602.             else  
  603.             {  
  604.                   index = randomPad.Next(1, allBlankPad.Count - 1);  
  605.                   haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  606.             }  
  607.             break;  
  608.             case "btnTwo":  
  609.             //All Possible Wind Condition with btnOne[ 258,123 ]  
  610.             //[1. For 258 position ]  
  611.             if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  612.             {  
  613.                   haveToMarkAsMobilePad = "btnEighth";  
  614.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  615.                   haveToMarkAsMobilePad = "btnEighth";  
  616.                   else  
  617.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  618.             }  
  619.             else if (playerAllMarkedPad[1].ToString() == "btnEighth")  
  620.             {  
  621.                   haveToMarkAsMobilePad = "btnFifth";  
  622.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  623.                   haveToMarkAsMobilePad = "btnFifth";  
  624.                   else  
  625.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  626.             }  
  627.             //[2. For 123 position ]  
  628.             else if (playerAllMarkedPad[1].ToString() == "btnOne")  
  629.             {  
  630.                   haveToMarkAsMobilePad = "btnFifth";  
  631.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  632.                   haveToMarkAsMobilePad = "btnThree";  
  633.                   else  
  634.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  635.             }  
  636.             else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  637.             {  
  638.                   if (playerAllMarkedPad[2].ToString() != "btnOne")  
  639.                   haveToMarkAsMobilePad = "btnOne";  
  640.                   else  
  641.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  642.             }  
  643.             else  
  644.             {  
  645.                   index = randomPad.Next(1, allBlankPad.Count - 1);  
  646.                   haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  647.             }  
  648.             break;  
  649.             case "btnThree":  
  650.             //All Possible Wind Condition with btnOne[ 123,357,369 ]  
  651.             //[1. For 123 position ]  
  652.             if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  653.             {  
  654.                   haveToMarkAsMobilePad = "btnOne";  
  655.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  656.                   haveToMarkAsMobilePad = "btnOne";  
  657.                   else  
  658.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  659.             }  
  660.             else if (playerAllMarkedPad[1].ToString() == "btnOne")  
  661.             {  
  662.                   haveToMarkAsMobilePad = "btnTwo";  
  663.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  664.                   haveToMarkAsMobilePad = "btnTwo";  
  665.                   else  
  666.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  667.             }  
  668.             //[2. For 357 position ]  
  669.             else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  670.             {  
  671.                   haveToMarkAsMobilePad = "btnSeventh";  
  672.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  673.                   haveToMarkAsMobilePad = "btnSeventh";  
  674.                   else  
  675.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  676.             }  
  677.             else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  678.             {  
  679.                   haveToMarkAsMobilePad = "btnFifth";  
  680.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  681.                   haveToMarkAsMobilePad = "btnFifth";  
  682.                   else  
  683.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  684.             }  
  685.             else  
  686.             {  
  687.                   index = randomPad.Next(1, allBlankPad.Count - 1);  
  688.                   haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  689.             }  
  690.             break;  
  691.             case "btnFourth":  
  692.             //All Possible Wind Condition with btnOne[ 147,456 ]  
  693.             //[1. For 147 position ]  
  694.             if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  695.             {  
  696.                   haveToMarkAsMobilePad = "btnOne";  
  697.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  698.                   haveToMarkAsMobilePad = "btnOne";  
  699.                   else  
  700.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  701.             }  
  702.             else if (playerAllMarkedPad[1].ToString() == "btnOne")  
  703.             {  
  704.                   haveToMarkAsMobilePad = "btnSeventh";  
  705.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  706.                   haveToMarkAsMobilePad = "btnSeventh";  
  707.                   else  
  708.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  709.             }  
  710.             //[1. For 456 position ]  
  711.             else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  712.             {  
  713.                   haveToMarkAsMobilePad = "btnSixth";  
  714.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  715.                   haveToMarkAsMobilePad = "btnSixth";  
  716.                   else  
  717.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  718.             }  
  719.             else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  720.             {  
  721.                   haveToMarkAsMobilePad = "btnFifth";  
  722.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  723.                   haveToMarkAsMobilePad = "btnFifth";  
  724.                   else  
  725.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  726.             }  
  727.             else  
  728.             {  
  729.                   index = randomPad.Next(1, allBlankPad.Count - 1);  
  730.                   haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  731.             }  
  732.             break;  
  733.             case "btnFifth":  
  734.             //All posible win condition [456, 257]  
  735.             //[1. For 456 position ]  
  736.             if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  737.             {  
  738.                   haveToMarkAsMobilePad = "btnSixth";  
  739.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  740.                   haveToMarkAsMobilePad = "btnSixth";  
  741.                   else  
  742.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  743.             }  
  744.             else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  745.             {  
  746.                   haveToMarkAsMobilePad = "btnFourth";  
  747.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  748.                   haveToMarkAsMobilePad = "btnFourth";  
  749.                   else  
  750.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  751.             }  
  752.             //[ for 258 position ]  
  753.             else if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  754.             {  
  755.                   haveToMarkAsMobilePad = "btnEighth";  
  756.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  757.                   haveToMarkAsMobilePad = "btnEighth";  
  758.                   else  
  759.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  760.             }  
  761.             else if (playerAllMarkedPad[1].ToString() == "btnEighth")  
  762.             {  
  763.                   haveToMarkAsMobilePad = "btnTwo";  
  764.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  765.                   haveToMarkAsMobilePad = "btnTwo";  
  766.                   else  
  767.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  768.             }  
  769.             else  
  770.             {  
  771.                   index = randomPad.Next(1, allBlankPad.Count - 1);  
  772.                   haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  773.             }  
  774.             break;  
  775.             case "btnSixth":  
  776.             //For all wind condition with 6  
  777.             //[1. For 456 position ]  
  778.             if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  779.             {  
  780.                   haveToMarkAsMobilePad = "btnFifth";  
  781.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  782.                   haveToMarkAsMobilePad = "btnFifth";  
  783.                   else  
  784.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  785.             }  
  786.             else if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  787.             {  
  788.                   haveToMarkAsMobilePad = "btnFourth";  
  789.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  790.                   haveToMarkAsMobilePad = "btnFourth";  
  791.                   else  
  792.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  793.             }  
  794.             //[ For 3,6,6 position ]  
  795.             else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  796.             {  
  797.                   haveToMarkAsMobilePad = "btnNinth";  
  798.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  799.                   haveToMarkAsMobilePad = "btnNinth";  
  800.                   else  
  801.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  802.             }  
  803.             else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  804.             {  
  805.                   haveToMarkAsMobilePad = "btnThree";  
  806.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  807.                   haveToMarkAsMobilePad = "btnThree";  
  808.                   else  
  809.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  810.             }  
  811.             else  
  812.             {  
  813.                   index = randomPad.Next(1, allBlankPad.Count - 1);  
  814.                   haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  815.             }  
  816.             break;  
  817.             case "btnSeventh":  
  818.             //[1. For 147 position ]  
  819.             if (playerAllMarkedPad[1].ToString() == "btnFourth")  
  820.             {  
  821.                   haveToMarkAsMobilePad = "btnOne";  
  822.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  823.                   haveToMarkAsMobilePad = "btnOne";  
  824.                   else  
  825.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  826.             }  
  827.             else if (playerAllMarkedPad[1].ToString() == "btnOne")  
  828.             {  
  829.                   haveToMarkAsMobilePad = "btnFourth";  
  830.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  831.                   haveToMarkAsMobilePad = "btnFourth";  
  832.                   else  
  833.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  834.             }  
  835.             //[1. For 789 position ]  
  836.             else if (playerAllMarkedPad[1].ToString() == "btnEighth")  
  837.             {  
  838.                   haveToMarkAsMobilePad = "btnNinth";  
  839.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  840.                   haveToMarkAsMobilePad = "btnNinth";  
  841.                   else  
  842.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  843.             }  
  844.             else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  845.             {  
  846.                   haveToMarkAsMobilePad = "btnEighth";  
  847.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  848.                   haveToMarkAsMobilePad = "btnEighth";  
  849.                   else  
  850.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  851.             }  
  852.             else  
  853.             {  
  854.                   index = randomPad.Next(1, allBlankPad.Count - 1);  
  855.                   haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  856.             }  
  857.             break;  
  858.             case "btnEighth":  
  859.             //All posible win conditions with 8  
  860.             //[1. For 258 position ]  
  861.             if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  862.             {  
  863.                   haveToMarkAsMobilePad = "btnTwo";  
  864.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  865.                   haveToMarkAsMobilePad = "btnTwo";  
  866.                   else  
  867.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  868.             }  
  869.             else if (playerAllMarkedPad[1].ToString() == "btnTwo")  
  870.             {  
  871.                   haveToMarkAsMobilePad = "btnFifth";  
  872.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  873.                   haveToMarkAsMobilePad = "btnFifth";  
  874.                   else  
  875.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  876.             }  
  877.             //[1. For 789 position ]  
  878.             else if (playerAllMarkedPad[1].ToString() == "btnSeventh")  
  879.             {  
  880.                   haveToMarkAsMobilePad = "btnNinth";  
  881.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  882.                   haveToMarkAsMobilePad = "btnNinth";  
  883.                   else  
  884.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  885.             }  
  886.             else if (playerAllMarkedPad[1].ToString() == "btnNinth")  
  887.             {  
  888.                   haveToMarkAsMobilePad = "btnSeventh";  
  889.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  890.                   haveToMarkAsMobilePad = "btnSeventh";  
  891.                   else  
  892.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  893.             }  
  894.             else  
  895.             {  
  896.                   index = randomPad.Next(1, allBlankPad.Count - 1);  
  897.                   haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  898.             }  
  899.             break;  
  900.             case "btnNinth":  
  901.             //All posible win conditions with 9  
  902.             //[1. For 159 position ]  
  903.             if (playerAllMarkedPad[1].ToString() == "btnFifth")  
  904.             {  
  905.                   haveToMarkAsMobilePad = "btnOne";  
  906.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  907.                   haveToMarkAsMobilePad = "btnOne";  
  908.                   else  
  909.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  910.             }  
  911.             else if (playerAllMarkedPad[1].ToString() == "btnOne")  
  912.             {  
  913.                   haveToMarkAsMobilePad = "btnFifth";  
  914.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  915.                   haveToMarkAsMobilePad = "btnFifth";  
  916.                   else  
  917.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  918.             }  
  919.             //For 369 positions ]  
  920.             else if (playerAllMarkedPad[1].ToString() == "btnSixth")  
  921.             {  
  922.                   haveToMarkAsMobilePad = "btnThree";  
  923.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  924.                   haveToMarkAsMobilePad = "btnThree";  
  925.                   else  
  926.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  927.             }  
  928.             else if (playerAllMarkedPad[1].ToString() == "btnThree")  
  929.             {  
  930.                   haveToMarkAsMobilePad = "btnSixth";  
  931.                   if (allBlankPad.Contains(haveToMarkAsMobilePad))  
  932.                   haveToMarkAsMobilePad = "btnSixth";  
  933.                   else  
  934.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  935.             }  
  936.             else  
  937.             {  
  938.                   index = randomPad.Next(1, allBlankPad.Count - 1);  
  939.                   haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  940.             }  
  941.             break;  
  942.       }  
  943. }  
  944. //IF Total Playe's MArked Pad=2  
  945. else if (countPad == 4)  
  946. {  
  947.       if (allBlankPad.Count != 0)  
  948.       {  
  949.             switch (allBlankPad[0].ToString())  
  950.             {  
  951.                   case "btnOne":  
  952.                   if (playerAllMarkedPad.Contains("btnTwo"))  
  953.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  954.                   else if (playerAllMarkedPad.Contains("btnThree"))  
  955.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  956.                   else if (playerAllMarkedPad.Contains("btnFourth"))  
  957.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  958.                   else if (playerAllMarkedPad.Contains("btnSeventh"))  
  959.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  960.                   else if (playerAllMarkedPad.Contains("btnNinth"))  
  961.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  962.                   else if (playerAllMarkedPad.Contains("btnFifth"))  
  963.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  964.                   else  
  965.                   {  
  966.                         index = randomPad.Next(1, allBlankPad.Count - 1);  
  967.                         haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  968.                   }  
  969.                   break;  
  970.                   case "btnTwo":  
  971.                   if (playerAllMarkedPad.Contains("btnTwo"))  
  972.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  973.                   else if (playerAllMarkedPad.Contains("btnThree"))  
  974.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  975.                   else if (playerAllMarkedPad.Contains("btnFourth"))  
  976.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  977.                   else if (playerAllMarkedPad.Contains("btnSeventh"))  
  978.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  979.                   else if (playerAllMarkedPad.Contains("btnNinth"))  
  980.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  981.                   else if (playerAllMarkedPad.Contains("btnFifth"))  
  982.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  983.                   else  
  984.                   {  
  985.                         index = randomPad.Next(1, allBlankPad.Count - 1);  
  986.                         haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  987.                   }  
  988.                   break;  
  989.                   case "btnThree":  
  990.                   if (playerAllMarkedPad.Contains("btnTwo"))  
  991.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  992.                   else if (playerAllMarkedPad.Contains("btnOne"))  
  993.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  994.                   else if (playerAllMarkedPad.Contains("btnSixth"))  
  995.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  996.                   else if (playerAllMarkedPad.Contains("btnNinth"))  
  997.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  998.                   else if (playerAllMarkedPad.Contains("btnSeventh"))  
  999.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1000.                   else if (playerAllMarkedPad.Contains("btnFifth"))  
  1001.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1002.                   else  
  1003.                   {  
  1004.                         index = randomPad.Next(1, allBlankPad.Count - 1);  
  1005.                         haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  1006.                   }  
  1007.                   break;  
  1008.                   case "btnFourth":  
  1009.                   if (playerAllMarkedPad.Contains("btnOne"))  
  1010.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1011.                   else if (playerAllMarkedPad.Contains("btnSeventh"))  
  1012.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1013.                   else if (playerAllMarkedPad.Contains("btnSixth"))  
  1014.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1015.                   else if (playerAllMarkedPad.Contains("btnFifth"))  
  1016.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1017.                   else  
  1018.                   {  
  1019.                         index = randomPad.Next(1, allBlankPad.Count - 1);  
  1020.                         haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  1021.                   }  
  1022.                   break;  
  1023.                   case "btnFifth":  
  1024.                   if (playerAllMarkedPad.Contains("btnSixth"))  
  1025.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1026.                   else if (playerAllMarkedPad.Contains("btnFourth"))  
  1027.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1028.                   else if (playerAllMarkedPad.Contains("btnTwo"))  
  1029.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1030.                   else if (playerAllMarkedPad.Contains("btnEighth"))  
  1031.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1032.                   else if (playerAllMarkedPad.Contains("btnSeventh"))  
  1033.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1034.                   else if (playerAllMarkedPad.Contains("btnNinth"))  
  1035.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1036.                   else  
  1037.                   {  
  1038.                         index = randomPad.Next(1, allBlankPad.Count - 1);  
  1039.                         haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  1040.                   }  
  1041.                   break;  
  1042.                   case "btnSixth":  
  1043.                   if (playerAllMarkedPad.Contains("btnTwo"))  
  1044.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1045.                   else if (playerAllMarkedPad.Contains("btnNinth"))  
  1046.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1047.                   else if (playerAllMarkedPad.Contains("btnFifth"))  
  1048.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1049.                   else if (playerAllMarkedPad.Contains("btnFourth"))  
  1050.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1051.                   else  
  1052.                   {  
  1053.                         index = randomPad.Next(1, allBlankPad.Count - 1);  
  1054.                         haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  1055.                   }  
  1056.                   break;  
  1057.                   case "btnSeventh":  
  1058.                   if (playerAllMarkedPad.Contains("btnEighth"))  
  1059.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1060.                   else if (playerAllMarkedPad.Contains("btnNinth"))  
  1061.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1062.                   else if (playerAllMarkedPad.Contains("btnTwo"))  
  1063.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1064.                   else if (playerAllMarkedPad.Contains("btnFourth"))  
  1065.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1066.                   else if (playerAllMarkedPad.Contains("btnFifth"))  
  1067.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1068.                   else if (playerAllMarkedPad.Contains("btnThree"))  
  1069.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1070.                   else  
  1071.                   {  
  1072.                         index = randomPad.Next(1, allBlankPad.Count - 1);  
  1073.                         haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  1074.                   }  
  1075.                   break;  
  1076.                   case "btnEighth":  
  1077.                   if (playerAllMarkedPad.Contains("btnNinth"))  
  1078.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1079.                   else if (playerAllMarkedPad.Contains("btnSeventh"))  
  1080.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1081.                   else if (playerAllMarkedPad.Contains("btnTwo"))  
  1082.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1083.                   else if (playerAllMarkedPad.Contains("btnFifth"))  
  1084.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1085.                   else  
  1086.                   {  
  1087.                         index = randomPad.Next(1, allBlankPad.Count - 1);  
  1088.                         haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  1089.                   }  
  1090.                   break;  
  1091.                   case "btnNinth":  
  1092.                   if (playerAllMarkedPad.Contains("btnEighth"))  
  1093.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1094.                   else if (playerAllMarkedPad.Contains("btnSeventh"))  
  1095.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1096.                   else if (playerAllMarkedPad.Contains("btnSixth"))  
  1097.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1098.                   else if (playerAllMarkedPad.Contains("btnThree"))  
  1099.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1100.                   else if (playerAllMarkedPad.Contains("btnFifth"))  
  1101.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1102.                   else if (playerAllMarkedPad.Contains("btnOne"))  
  1103.                   haveToMarkAsMobilePad = allBlankPad[0].ToString();  
  1104.                   else  
  1105.                   { 
  1106.                          index = randomPad.Next(1, allBlankPad.Count - 1);  
  1107.                         haveToMarkAsMobilePad = allBlankPad[index].ToString();  
  1108.                   }  
  1109.                   break;  
  1110.             }
  1111.             //Switch End  
  1112.       }  
  1113. }  
  1114. return haveToMarkAsMobilePad;  
  1115. }//End Medium Level MEthod                                                                                                                                     

Lable: HARD

In hard level do the steps of MEDIUM Level but when the opponent has no two consecutive marked pad then think on you move by which the phone could win and if any now possibility to win the make move which could help to win on next turn

Note:  Most of  the code will be same as  level MEDIUM except the random move because in medium level we are checking the win condition of opponent , if it is then we were marking those pad by which opponent could not win on next turn other wise we were marking any blank pad using random selection of blank pad.

But in this level we won't marked  any pad randomly. If opponent has no chance to win at next turn then phone will think about its win condition, if any possibility available to win then marked that pad to become winner or try to marked that pad which will help you to win at future turn.
Thanks!