案例:chatGPT生成的生命游戏     状态:可编辑再运行    进入横版
AخA
            grid.children[i * 50 + j].style.backgroundColor = cell ? "#000" : "#fff";
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <title>生命游戏</title>
5
    <style>
6
        #grid {
7
            display: grid;
8
            grid-template-columns: repeat(50, 10px);
9
            grid-template-rows: repeat(50, 10px);
10
            grid-gap: 1px;
11
            background-color: #ddd;
12
        }
13
        .cell {
14
            background-color: #fff;
15
        }
16
    </style>
17
</head>
18
<body>
19
    <button id="start">开始</button>
20
    <button id="stop">停止</button>
21
    <button id="reset">重置</button>
22
    <div id="grid"></div>
23
    <script>
24
    

 运行结果 
 北美留学生论坛