R
R
Roma Biatov2020-12-17 21:29:56
JavaScript
Roma Biatov, 2020-12-17 21:29:56

How can I make my “bot” start walking at random coordinates across the field?

var board = [
    [" ", "1", "2", "3"],
    ["1", "□", "□", "□", "▏"],
    ["2", "□", "□", "□", "▏"],
    ["3", "□", "□", "□", "▏"]
]
function printBoard () {
    console.log(board[0][0], board[0][1], board[0][2], board[0][3]);
    console.log(board[1][0], board[1][1], board[1][2], board[1][3], board[1][4]);
    console.log(board[2][0], board[2][1], board[2][2], board[2][3], board[2][4]);
    console.log(board[3][0], board[3][1], board[3][2], board[3][3], board[3][4]);
}


function randomPCmove(min, max) {
    let rand = min + Math.random() * (max + 1 - min);
    return Math.floor(rand);
}


function makePCmove(x, y) {
 
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question