"Any tips to help figure out what might be causing this?"
If this draw() is printing out all underscores and the board layout is correct even though it is all underscores, it looks like the array must contain all zeros. The only way an underscore would print is when the value is 0. You should look at the contents of the board array. Maybe just print out the array contents as a list. (You might need to insert a sleep command to see it, because of the clear() function. ) Running in in the debugger will also let you view the contents. Also, is it ALWAYS doing this, or does it print the initial array correctly? Does it only do this after a move? That should give you an idea where to look.
As a side note, look at the following:
int swap2 = board[i][j];
swap2 = '_';
The assignment of the board element to swap2 is unnecessary. You could simply do this:
int swap2 = '_'; In fact, you could do it as a char instead of an int (and make the appropriate change in the printf() ).
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)