send() {
        let board = this.perception;
        // = board
        let size = board.length;
        let available = getEmptyHex(board);
        let nTurn = size * size - available.length;
        //matrix
        if (nTurn == 0) { // First move
            return [Math.floor(size / 2), Math.floor(size / 2) - 1];
        } else if (nTurn == 1){
            return [Math.floor(size / 2), Math.floor(size / 2)];
        }

        var id = this.id
        var auxBoard = board
        let move = available[Math.round(Math.random() * ( available.length -1 ))];
        var alpha = -INFINITY*2;
        var beta = INFINITY*2;
        let nodes = alphabetaminimax([[0,0],alpha], [[0,0],beta], 3, auxBoard, id)
        //console.log(id);
        //console.log(nodes);
        return nodes[0];
    }
/**
     * return a new move. The move is an array of two integers, representing the
     * row and column number of the hex to play. If the given movement is not valid,
     * the Hex controller will perform a random valid movement for the player
     * Example: [1, 1]
     */
return a new move. The move is an array of two integers, representing the
row and column number of the hex to play. If the given movement is not valid,
the Hex controller will perform a random valid movement for the player
Example: [1, 1]
return a new move . The move is an array of two integers representing the row and column number of the hex to play . If the given movement is not valid the Hex controller will perform a random valid movement for the player Example : [ 1 1 ]
send() {
        let board = this.perception;
        let size = board.length;
        let available = getEmptyHex(board);
        let nTurn = size * size - available.length;
        if (nTurn == 0) { 
            return [Math.floor(size / 2), Math.floor(size / 2) - 1];
        } else if (nTurn == 1){
            return [Math.floor(size / 2), Math.floor(size / 2)];
        }
        var id = this.id
        var auxBoard = board
        let move = available[Math.round(Math.random() * ( available.length -1 ))];
        var alpha = -INFINITY*2;
        var beta = INFINITY*2;
        let nodes = alphabetaminimax([[0,0],alpha], [[0,0],beta], 3, auxBoard, id)
        return nodes[0];
    }
send ( ) { let board = this . perception ; let size = board . length ; let available = getEmptyHex ( board ) ; let nTurn = size * size - available . length ; if ( nTurn == 0 ) { return [ Math . floor ( size / 2 ) , Math . floor ( size / 2 ) - 1 ] ; } else if ( nTurn == 1 ) { return [ Math . floor ( size / 2 ) , Math . floor ( size / 2 ) ] ; } var id = this . id var auxBoard = board let move = available [ Math . round ( Math . random ( ) * ( available . length - 1 ) ) ] ; var alpha = - INFINITY * 2 ; var beta = INFINITY * 2 ; let nodes = alphabetaminimax ( [ [ 0 , 0 ] , alpha ] , [ [ 0 , 0 ] , beta ] , 3 , auxBoard , id ) return nodes [ 0 ] ; }
return a new move.
return a new move .
// = board //matrix // First move //console.log(id); //console.log(nodes);