var interval; const ip = "http://127.0.0.1"; const port = "35270"; var totalRoll = 0; var quad = false; var prevBoard = []; var pubeval = false; var currentPlayer = 1; var toggled = false; const init_board = [0, 2, 0, 0, 0, 0, -5, 0, -3, 0, 0, 0, 5, -5, 0, 0, 0, 3, 0, 5, 0, 0, 0, 0, -2, 0]; // const init_board = [0,1,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] $(function () { var board = []; const red = "#E83D04"; const white = "#E8E077"; const brown = "#4C2E00"; var color = white; var roll = [Math.floor(Math.random() * 6) + 1, Math.floor(Math.random() * 6) + 1]; var roll = [1, 2]; totalRoll = roll[0] + roll[1]; if (roll[0] == roll[1]) { totalRoll = roll[0] * 4; roll = [roll[0], roll[0], roll[0], roll[0]]; quad = true; } $("#roll").text("roll: " + roll.toString() + " total moves: " + totalRoll.toString()); console.log("Initial roll:"); console.log(roll); // Build pins for (var i = 0; i < 26; i++) { if (i < 13 && 0 < i) { var pos = 'bottom'; } else if (i > 12 && i < 25) { var pos = 'top'; } else { var pos = 'bar'; } if (color == white) { color = red; } else { color = white; } if (i == 0 || i == 25) { color = brown; } var div = $("
").addClass("pin").addClass("pin-" + pos).attr('id', 'pin-' + i); var checkers_div = $("
").addClass("checkers").attr('id', 'checkers-' + i); var checkers_list = $("