title: Checking for valid moves in Reversi for all 8 directions
body: <p>I have a function to check the valid moves in my reversi game. I look at the unoccupied spaces, and check if an adjacent space in any 8 directions are the opposite piece. (If I'm black, I search for white) Now, if I find a piece that's adjacent, I should keep looking towards that direction and see if my own piece is at the end, then I return true, else if its an unoccupied space or off the board boundaries, I return false. </p>
  
  <p>My function doesn't seem to work properly as I print out the wrong moves. </p>
  
  <pre><code>bool checkLegalInDirection(char boardgame[26][26], int size, int row, int col, char color) {
  
  int currentRow, currentCol;
  for (int deltaRow = -1; deltaRow &lt; 2; deltaRow++) {
      for (int deltaCol = -1; deltaCol &lt; 2; deltaCol++) {
          if (deltaRow == 0 &amp;&amp; deltaCol == 0) {
              break; 
          } else {
          row = row + deltaRow;
          col = col + deltaCol;
          if (positionInBounds(size, row, col)) {
              while (boardgame[row][col] == OppositeColor(color)) {
                  currentRow = row + deltaRow;
                  currentCol = col + deltaCol;
  
                  if (positionInBounds(size, currentRow, currentCol)) {
                      if (boardgame[currentRow][currentCol] == color) {
                          return true;
                      } else {
                          return false;
                      }
                  }
              }
          }
      }
  }
  }
  }
  </code></pre>
  
  <p>deltaRow and deltaCol are the increments that go in each direction and add one time to keep searching in a specified location. PositioninBounds is a function I have to make sure my searches are within the board boundaries. My deltarow and deltacol cannot be both 0 at the same time, so somehow I need to skip that step, (which I probably did wrong). Oppositecolor is a function that returns me the opposite color of my own piece. </p>