Ok, several things to look at:
main
1)
gameMap();
should be called within the while loop to redraw every iteration
2) Do something like
1 2 3 4 5
|
humanRow=10;
humanCol=20;
computerRow=10;
computerCol=40;
|
to initialize these variables after you set
board[10][40]='*';
3) Empty block after
_getch();
is meaningless
humanMove
1) why does it return a value - you don't use it anyway
2) calling crashTest() in every clause makes no sense - you do it anyway in the main loop - you should remove it
computerMove
1)
if (randMove=0)
. You should use the logical operator:
if (randMove == 0)
2) This code has no sense at all - remove all instances
1 2
|
return computerRow,computerCol;
crashTest();
|
3) Also - why do you return something if you don't use it?
4) Last if states
if ( (randMove==0)
- I assume you meant
if ( (randMove==3)
updateGameBoard()
Incorrect usage of logical operator
board[humanRow][humanCol]=='X';
- to assign a value - you should write
board[humanRow][humanCol]='X';
These are just the most prominent problems. There are so many more things you could improve - remove globals, encapsulate player information in a class, etc, etc, but I hope that you will be improving your code along with learning C++.