I am making a domineering game for my coursework, I have been trying to do something new by adding a lot of void functions and now for some weird reason my board isn't working as it is saying identifier "board" is undefined but I have never really had a problem with my board until now and I haven't figured it out yet. The error is in the void playAt() function.
#include <iostream>
#include <Windows.h>
#include <vector>
using namespace std;
int horizontal = 0;
int vertical = 0;
int row = 0;
int column = 0;
int x = row = 0;
int y = column = 0;
bool gameOver;
bool player = horizontal && vertical;
bool islegal;
void Setup()
{
gameOver = false;
}
void Draw()
{
// specifty default value to fill the vector elements
int mapSize = 0;
cout << "Enter the size of board => ";
cin >> mapSize;
vector<vector<char> > board(mapSize, vector<char>(mapSize, 'e'));
for (int i = 0; i < mapSize; i++) {
for (int j = 0; j < mapSize; j++) {
cout << board[i][j] << " ";
}
cout << endl;
}
}
void play()
{
if (player == horizontal) {
cout << ("Horizontal to play");
}
else {
cout << ("Vertical to play");
}
}
void playAt(int row, int column, bool player)
{
board[row][column] = true;
if (player == horizontal) {
board[x][y + 1] = true;
board[x][y + 2] = true;
}
else {
board[x + 1][y] = true;
board[x + 2][y] = true;
}
}
void Input()
{
}
void Logic()
{
}
int main()
{
Setup();
while (!gameOver) {
Draw();
Input();
Logic();
}
}