This commit is contained in:
2018-09-25 11:31:47 -04:00
commit f160b0ae12
2 changed files with 37 additions and 0 deletions

13
index.html Normal file
View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<table id="container"></table>
<script src="index.js"></script>
</body>
</html>

24
index.js Normal file
View File

@@ -0,0 +1,24 @@
// draw a 15 x 15 grid
// if there's exactly three neighbors that are alive -> ALIVE
// if there's four or more -> DEAD
// one or less -> DEADo
container = document.querySelector('#container');
for (let i = 0; i < 15; i++) {
let row = document.createElement('tr');
container.appendChild(row);
for (let j = 0; j < 15; j++) {
let cell = document.createElement('td');
cell.classList.add('dead');
cell.style.height = '50px';
cell.style.width = '50px';
cell.style.border = '1px solid #999';
row.appendChild(cell);
}
}