'Tic Tac Toe with obstruction

I'm trying to code a tic-tac-toe game but with some different functionalities. Once the first and second players are entered "X or O", I need to draw a border around the last selection "X or O", as you can see in the image attached. I created 3 Java files: main.java, position.java, and board.java. The code is running as attached. For now, once I have entered the column and row for the first player, I've provided the "X", but I need a method to draw and obstruct with a border as I mentioned above and shown you in the image. Would you please help me regarding how I can make this? Note: I wanted to share a portion of the code. I couldn't figure out how to add it here for the whole thing.

enter code here

//get row and col from user
        Scanner in = new Scanner(System.in);
        System.out.println("Enter a row between (1...6: ,ex:2/3 ");
        row=  in.nextInt()-1; 
        System.out.println("Enter a col between (1...6: ,ex:2/3 ");
        System.out.println("test2");
        col=  in.nextInt()-1;
            
  //check if row and col are vail - for is not vaild try/catch
        if(row<0 || col<0 || row>5 || col>5) {
            //row and col out of bounds
            System.out.println("Row and Col values are not true..");
        }
            else if (board[row][col] != '-') {
                System.out.println("already move there be careful..");
        }
            else {
                //row and col are valid
            break;
            }
    }
         //setting the position on the board to the player's symbol
            board[row][col] = symbol;
            printBoard();
    }
     
     public void placeToken(int row,int col, char token){
         board[row][col]=token;
         for (int i = -1; i < 5; i++){
             if (board[row+i][col-1] == '-'){
                 board[row+i][col-1] = '*';
             }
             if (board[row+i][col] == '-'){
                 board[row+i][col] = '*';
             }
             if (board[row+i][col+1] == '-'){
                 board[row+i][col+1] = '*';
             }
         }
     }

enter image description here

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source