Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.59 KB | None | 0 0
  1. public void ExecuteShipPlacement(string direction, int[] startCoords, ShipTypes ship)
  2.         {
  3.             if(direction == "w")
  4.             {
  5.                 int temp = 0;
  6.                 for (int i = startCoords[0]; i >= 0; i--)
  7.                 {
  8.                     if (Board[i, startCoords[1]] == CellStatus.DECK)
  9.                         throw new System.NotImplementedException();
  10.  
  11.                     Board[i, startCoords[1]] = CellStatus.DECK;
  12.  
  13.                     temp++;
  14.                     if (temp == (int)ship)
  15.                         break;
  16.                 }
  17.             }
  18.  
  19.             if (direction == "s")
  20.             {
  21.                 int temp = 0;
  22.                 for (int i = startCoords[0]; i <= 9; i++)
  23.                 {
  24.                     if (Board[i, startCoords[1]] == CellStatus.DECK)
  25.                         throw new System.NotImplementedException();
  26.  
  27.                     Board[i, startCoords[1]] = CellStatus.DECK;
  28.  
  29.                     temp++;
  30.                     if (temp == (int)ship)
  31.                         break;
  32.                 }
  33.             }
  34.  
  35.             if (direction == "d")
  36.             {
  37.                 int temp = 0;
  38.                 for (int i = startCoords[1]; i <= 9; i++)
  39.                 {
  40.                     if (Board[startCoords[0], i] == CellStatus.DECK)
  41.                         throw new System.NotImplementedException();
  42.  
  43.                     Board[startCoords[0], i] = CellStatus.DECK;
  44.  
  45.                     temp++;
  46.                     if (temp == (int)ship)
  47.                         break;
  48.                 }
  49.             }
  50.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement