The game won't run

Below is my code for Tic Tac Toe, but I can't seem to be able to start the game. Using a vector to set alphabetical positions to each square in the board, it's been set. I compile it and run it with one position from the letters 'a' through 'i', but it won't display 'x' as the first player's letter. So it just ends.

#include <iostream>
#include <vector>

using namespace std;

const bool CLEAR_SCREEN = true;
/// @brief Utilizes an escape character sequence to clear the screen

void clearScreen()
{
cout << endl;
if (CLEAR_SCREEN)
{
cout << "\033c";
}
cout << endl;
}

void drawBoard(const vector < char >&board)
{
clearScreen();
for (int i = 0; i < 9; i += 3)
{
cout << " " << board.at(i) << " | " << board.at(i + 1) << " | "
<< board.at(i + 2) << " " << endl;
if (i < 6)
cout << "-----|-----|-----" << endl;
}
cout << endl;
}

void initVector(vector<char> &v)
{
string mapA = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < v.size(); i++)
{
v.at(i) = mapA.at(i);
}
}

int convertPosition(char position)
{
string mapA = "abcdefghijklmnopqrstuvwxyz";
return mapA.find(position);
}

bool validPlacement(const vector <char> &board, int position)
{
if (position > 8 || position < 0)
return false;
else if(board[position] == 'x' || board[position] == 'o')
return false;

return true;
}

bool gameWon(const vector <char> &board)
{
return true;
}

bool boardFull(const vector <char> &board)
{
return true;
}

int getPlay(const vector <char> &board)
{
char play;
cout << "Please choose a position: ";
cin >> play;
cout << endl;
int pos = convertPosition(play);
if (validPlacement(board, pos))
{
return pos;
}
}

const int PLAYER1 = 0;
const int PLAYER2 = 1;

int main()
{
vector <char> board(9);
int curPlay;
int turn = PLAYER1;
initVector(board);
drawBoard(board);
getPlay(board);
return 0;
}
Topic archived. No new replies allowed.