I am writing an agent that will play a game of Tron. This was one of the Google AI challenges.
I have been trying to use a Flood Fill to calculate the area I have to move my sprite. combined with the minimax algorithm I should be able to look out for areas that block my agent in.
However my flood fill always appears to be returning zero and I cant work out why. It's 5am here so I think it might be my logic, can someone check it for me? I'd love to see this thing running before I go to sleep.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
int Board::FloodFill(int playerX, int playerY, vector<vector<int>>board)
int area = 0;
if(!isFree(playerX, playerY)) return area;
board[playerY][playerX] = WALL;
area += FloodFill(playerX - 1, playerY, board); //west
area += FloodFill(playerX + 1, playerY, board); //east
area += FloodFill(playerX, playerY - 1, board); //north
area += FloodFill(playerX, playerY + 1, board); //south