1 Star 0 Fork 0

jimgo/Three Plus One Game

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
squ.html 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
jimgo 提交于 2022-05-04 11:47 . PDF
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> 3n + 1 Game </title>
<style>
.cols {
display: flex;
}
.col {
display: flex;
flex-direction: column;
}
.col div {
width: 48px;
text-align: right;
margin: 0;
padding: 0;
color: #999;
}
.col div.prime {
font-weight: bolder;
color: #f33;
}
</style>
</head>
<body>
<div class="cols"></div>
<script src="./primes.js"></script>
<script>
const COLS = document.getElementsByClassName('cols')[0];
let COL = document.createElement("div");
const ODDS = [];
COL.className = "col";
for (let i = 1; i < 10000; i += 1) {
ODDS.push(i);
}
for (let i = 0; i < ODDS.length; i++) {
let div = document.createElement("div");
div.textContent = ODDS[i];
if (PRIMES.has(ODDS[i])) {
div.className = "prime";
}
COL.appendChild(div);
}
const paint = idx => {
let LAST_CHILD = COLS.lastChild.childNodes;
let CP = document.createElement("div");
CP.className = "col";
for (let i = 0; i < LAST_CHILD.length; i += 2) {
CP.appendChild(LAST_CHILD[i].cloneNode(true));
}
// debugger
COLS.appendChild(CP);
}
COLS.appendChild(COL);
for (let i = 1; i < 16; i++) {
paint(i);
}
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/jimgo/ThreePlusOneGame.git
git@gitee.com:jimgo/ThreePlusOneGame.git
jimgo
ThreePlusOneGame
Three Plus One Game
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385