Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake_Game_Python — HTML Version (browser edition)

A faithful, install-free browser port of Snake_Game_Python, built with the HTML5 Canvas and vanilla JavaScript ES modules (under js/, mirroring the Python package) — no build step, no dependencies.

Languages: English · 繁體中文 · 简体中文


English

Play online

Live: https://spacesquare640.github.io/Snake_Game_Python/

(Served by GitHub Pages from the HTML_Version branch.)

Play locally

Just open index.html in any modern browser. Because the update check uses a network request, serving it over HTTP avoids browser restrictions:

# from this folder
python -m http.server 8099
# then open http://localhost:8099

What's included

The same game as the desktop edition:

  • 16 modes — Classic, Survival, Battle, Level, AI vs Human, Player Fill (main menu) and ten AI-algorithm showcases in the All-AI menu: AI vs AI, AI Fill, A* Pathfinder, Annealing Master, Greedy (Easy), Drift / Drunk, Minimax vs You, Minimax Duel, Co-op Fill, and Food Rush.
  • Clickable GUI with a Settings menu, an All-AI menu, and an on-screen D-pad for mouse/touch play.
  • Themes (Dark / Neon / Retro CRT / Minimal), sound effects + music (WebAudio), a leaderboard (top-5 per mode), key remapping, an optional FPS counter, a replay system (deterministic, seeded), and an interactive tutorial for new players.
  • Pause (P / ⏸ button) with auto-pause when the tab is hidden, high-DPI crisp rendering, responsive scaling that fits any screen, and a loading splash, and audio that honours the portal's mute switch — wired for the CrazyGames portal (the SDK no-ops elsewhere, so the same build runs anywhere).
  • 3 languages — English, Traditional Chinese, Simplified Chinese.
  • A toolbox of snake AIs — BFS with a survival fallback, a perfect Hamiltonian-cycle fill, plus A*, simulated annealing, greedy best-first, a DFS / random-walk drift, and an adversarial minimax.
  • Saved progress (name, level, XP, colors, high scores) via localStorage.
  • Update check against GitHub Releases, shown in the top-right corner.

Controls

  • Mouse / touch: click menu items, buttons, or the on-screen D-pad.
  • 16 select a mode; A/S open the All-AI / Settings menus.
  • WASD or Arrow keys (and the D-pad) to move; Arrows for Player 2 in Battle.
  • P pause / resume · SPACE start / restart · M menu · ESC back.

繁體中文

線上遊玩

線上版: https://spacesquare640.github.io/Snake_Game_Python/

(由 GitHub Pages 從 HTML_Version 分支提供。)

本機遊玩

用任何現代瀏覽器開啟 index.html 即可。由於更新檢查會發出網路請求,建議以 HTTP 方式提供以避免瀏覽器限制:

# 在此資料夾下
python -m http.server 8099
# 然後開啟 http://localhost:8099

內容

與桌面版相同的遊戲:

  • 16 種模式 — 經典、生存、對戰、關卡、AI 對 玩家、玩家填滿(主選單), 以及全 AI 選單中的 十種 AI 演算法展示:AI 對 AI、AI 填滿、A* 尋路、退火大師、 貪婪(簡單)、漂移/醉酒、Minimax 對你、Minimax 對決、協作填滿、搶食競賽。
  • 可點選的 GUI,含設定選單、全 AI 選單,以及畫面上的 方向鍵(D-pad), 支援滑鼠/觸控。
  • 佈景主題(深色/霓虹/復古 CRT/極簡)、音效+音樂(WebAudio)、排行榜 (各模式前 5 名)、按鍵重新對應,以及可選的 FPS 顯示。
  • 暫停P / ⏸ 按鈕),切到背景分頁時會自動暫停高 DPI 清晰渲染、能 填滿任何螢幕的響應式縮放、載入畫面,以及會遵從平台靜音開關的音訊 —— 已為 CrazyGames 平台接好(SDK 在其他環境會自動空轉,同一份程式到處都能跑)。
  • 3 種語言 — 英文、繁體中文、簡體中文。
  • 整套蛇 AI 工具箱 — BFS 與生存後備策略、完美 漢米頓迴圈 填滿,以及 A*模擬退火貪婪最佳優先DFS/隨機遊走 漂移與對抗式 Minimax
  • 進度儲存(名稱、等級、經驗、顏色、最高分)使用 localStorage
  • 更新檢查:向 GitHub Releases 查詢,顯示於右上角。

操作

  • 滑鼠/觸控: 點選選單項目、按鈕或畫面方向鍵。
  • 16 選擇模式;AS 開啟全 AI/設定選單。
  • WASD方向鍵(及 D-pad)移動;對戰模式玩家2 用 方向鍵
  • P 暫停/繼續 · 空白鍵 開始/重新開始 · M 選單 · ESC 返回。

简体中文

在线游玩

在线版: https://spacesquare640.github.io/Snake_Game_Python/

(由 GitHub Pages 从 HTML_Version 分支提供。)

本地游玩

用任何现代浏览器打开 index.html 即可。由于更新检查会发出网络请求,建议以 HTTP 方式提供以避免浏览器限制:

# 在此文件夹下
python -m http.server 8099
# 然后打开 http://localhost:8099

内容

与桌面版相同的游戏:

  • 16 种模式 — 经典、生存、对战、关卡、AI 对 玩家、玩家填满(主菜单), 以及全 AI 菜单中的 十种 AI 算法展示:AI 对 AI、AI 填满、A* 寻路、退火大师、 贪婪(简单)、漂移/醉酒、Minimax 对你、Minimax 对决、协作填满、抢食竞赛。
  • 可点选的 GUI,含设置菜单、全 AI 菜单,以及画面上的 方向键(D-pad), 支持鼠标/触控。
  • 界面主题(深色/霓虹/复古 CRT/极简)、音效+音乐(WebAudio)、排行榜 (各模式前 5 名)、按键重新映射,以及可选的 FPS 显示。
  • 暂停P / ⏸ 按钮),切到后台标签页时会自动暂停高 DPI 清晰渲染、能 填满任何屏幕的响应式缩放、加载画面,以及会遵从平台静音开关的音频 —— 已为 CrazyGames 平台接好(SDK 在其他环境会自动空转,同一份程序到处都能跑)。
  • 3 种语言 — 英文、繁体中文、简体中文。
  • 整套蛇 AI 工具箱 — BFS 与生存后备策略、完美 哈密顿回路 填满,以及 A*模拟退火贪婪最佳优先DFS/随机游走 漂移与对抗式 Minimax
  • 进度保存(名称、等级、经验、颜色、最高分)使用 localStorage
  • 更新检查:向 GitHub Releases 查询,显示于右上角。

操作

  • 鼠标/触控: 点选菜单项目、按钮或画面方向键。
  • 16 选择模式;AS 打开全 AI/设置菜单。
  • WASD方向键(及 D-pad)移动;对战模式玩家2 用 方向键
  • P 暂停/继续 · 空格键 开始/重新开始 · M 菜单 · ESC 返回。

License / 授權 / 许可

Released under the project's custom license. Any derivative work, modification, or re-upload must clearly credit Creators: SpaceSquare, Claude Code and Owner: SpaceSquare. Provided "As-Is" with no warranty. See the repository LICENSE for full terms.

About

A multi-mode, multi-language Snake game in Python/Pygame — BFS AI, 6 modes, EN/繁/简, player profiles. Packaged builds in Releases.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages