another stupid test

This commit is contained in:
Bruno Rybársky 2022-01-16 11:29:28 +01:00
parent 16e53d5a39
commit a720345929

@ -1,21 +1,21 @@
//my personal variables
let w = 10;
let h = 10;
let x = "✕";
let x = "✔";
let o = "⬤";
let lgrid = new Array(w);
let rgrid = new Array(w);
//Write arrays to html
function writegrid(){
for (let i = 0; i < w; i++){
for (let j = 0; j < h; j++){
function writegrid() {
for (let i = 0; i < w; i++) {
for (let j = 0; j < h; j++) {
$('#lc' + i + '-' + j).html(lgrid[i][j]);
$('#rc' + i + '-' + j).html(rgrid[i][j]);
}
}
}
$(function() {
$(function () {
for (let i = 0; i < w; i++) {
//create columns
$('#local').append('<tr class="column" id="lt' + i + '"></tr>');
@ -33,11 +33,11 @@ $(function() {
}
}
for (let i = 0; i < w; i++){
for (let j = 0; j < h; j++){
for (let i = 0; i < w; i++) {
for (let j = 0; j < h; j++) {
//randomly choose between o and x
let rand = Math.floor(Math.random() * 2);
if (rand == 0){
if (rand == 0) {
lgrid[i][j] = x;
rgrid[i][j] = o;
} else {