-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
97 lines (88 loc) · 3.43 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Snake</title>
<script src="assets/game.js" defer></script>
<script src="assets/snake.js" defer></script>
<script src="assets/keyboard.js" defer></script>
<script src="assets/food.js" defer></script>
<script src="assets/grid.js" defer></script>
<script src="assets/sidebar.js" defer></script>
<script src="assets/levels.js" defer></script>
<script src="assets/aisnake.js" defer></script>
<script src="assets/aidifficulty.js" defer></script>
<script src="assets/aidirection.js" defer></script>
<script src="assets/aidirection_t.js" defer></script>
<script src="assets/bigfood.js" defer></script>
</head>
<body>
<div class="sidebar">
<!-- 游戏设置部分 -->
<div class="settings-section">
<h2>游戏设置</h2>
<!-- 游戏速度控制 -->
<div class="parameter">
<!-- 标签和input绑定 -->
<label for="snakespeed">速度 (ms):</label>
<input type="range" id="speed" name="speed" min="1" max="20"/>
<label for="aisnakespeed">AI速度 (ms):</label>
<input type="range" id="aisnakespeed" name="aispeed" min="1" max="20"/>
</div>
<!-- 贪吃蛇大小控制 -->
<div class="parameter">
<label for="levelSelect">关卡选择:
<select id="levelSelect" onchange="selectLevel()">
<option value="1">关卡 1</option>
<option value="2">关卡 2</option>
<option value="3">关卡 3</option>
</select>
</label>
</div>
<!-- 贪吃蛇AI选择 -->
<div class="parameter">
<label for="snake-AI">贪吃蛇AI对战:</label>
<label>
<input type="checkbox" id="aiToggle" onchange="toggleAI()"> 启用 AI 对战
</label>
<label>
AI路径算法:
<select id="aiDifficulty" onchange="setAIDifficulty()">
<option value="1">A*算法</option>
<option value="2">贪婪算法</option>
<option value="3">BFS </option>
<option value="4">DFS </option>
</select>
</label>
</div>
<!-- 开始/重置游戏按钮 -->
<button class="start-button" onclick="startGame()">开始游戏/重置游戏</button>
<!-- 暂停/继续游戏按钮 -->
<button class="pause-button" onclick="pauseorContinueGame()">暂停游戏/继续游戏</button>
</div>
<!-- 分数显示部分 -->
<div class="score-section">
<h3>分数</h3>
<p>玩家分数:<p id="playerScore">0</p></p>
<p>AI 分数:<p id="aiScore">0</p></p>
</div>
</div>
<!-- 中间游戏区域 -->
<div class="game-container">
<div id="game-board"></div>
</div>
<!-- 右侧展示栏 -->
<div class="game-gallery">
<h2>选择小游戏</h2>
<div class="game-options">
<button onclick="startSnakeGame()">贪吃蛇</button>
<button onclick="startTicTacToe()">待开发</button>
<button onclick="startMemoryGame()">待开发</button>
<!-- 添加更多按钮 -->
</div>
</div>
</body>
</html>