another stupid test
This commit is contained in:
parent
16e53d5a39
commit
a720345929
16
index.js
16
index.js
@ -1,21 +1,21 @@
|
|||||||
//my personal variables
|
//my personal variables
|
||||||
let w = 10;
|
let w = 10;
|
||||||
let h = 10;
|
let h = 10;
|
||||||
let x = "✕";
|
let x = "✔";
|
||||||
let o = "⬤";
|
let o = "⬤";
|
||||||
let lgrid = new Array(w);
|
let lgrid = new Array(w);
|
||||||
let rgrid = new Array(w);
|
let rgrid = new Array(w);
|
||||||
//Write arrays to html
|
//Write arrays to html
|
||||||
function writegrid(){
|
function writegrid() {
|
||||||
for (let i = 0; i < w; i++){
|
for (let i = 0; i < w; i++) {
|
||||||
for (let j = 0; j < h; j++){
|
for (let j = 0; j < h; j++) {
|
||||||
$('#lc' + i + '-' + j).html(lgrid[i][j]);
|
$('#lc' + i + '-' + j).html(lgrid[i][j]);
|
||||||
$('#rc' + i + '-' + j).html(rgrid[i][j]);
|
$('#rc' + i + '-' + j).html(rgrid[i][j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function () {
|
||||||
for (let i = 0; i < w; i++) {
|
for (let i = 0; i < w; i++) {
|
||||||
//create columns
|
//create columns
|
||||||
$('#local').append('<tr class="column" id="lt' + i + '"></tr>');
|
$('#local').append('<tr class="column" id="lt' + i + '"></tr>');
|
||||||
@ -33,11 +33,11 @@ $(function() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let i = 0; i < w; i++){
|
for (let i = 0; i < w; i++) {
|
||||||
for (let j = 0; j < h; j++){
|
for (let j = 0; j < h; j++) {
|
||||||
//randomly choose between o and x
|
//randomly choose between o and x
|
||||||
let rand = Math.floor(Math.random() * 2);
|
let rand = Math.floor(Math.random() * 2);
|
||||||
if (rand == 0){
|
if (rand == 0) {
|
||||||
lgrid[i][j] = x;
|
lgrid[i][j] = x;
|
||||||
rgrid[i][j] = o;
|
rgrid[i][j] = o;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user