Build me a complete Snake game - AI
Specs:
- Grid: 20×20 cells on a square canvas
- Color theme: neon on dark — deep navy background (#080b14), bright cyan snake body (#45f5ff), green snake head (#8cff6a), pink/magenta food (#ff4fd8), cyan glowing border around the board
- Title "SNAKE" in glowing cyan above the board, with live SCORE and BEST counters top-right
- Starting speed: 145 ms per move, speeding up by 10 ms every 5 foods eaten, capped at 62 ms minimum
- Controls: Arrow Keys + WASD on desktop; swipe gestures + on-screen d-pad buttons on mobile/touch screens
- The snake cannot reverse directly into itself; a small input queue prevents missed keypresses
- Wall collision and self-collision both trigger game over
- Game-over: dark blurred overlay with final score, best score, and a prompt to restart (Enter/Space/arrow key on desktop, tap on mobile)
- Persistent high score saved to localStorage
- Uses requestAnimationFrame with a fixed time-step accumulator so speed is frame-rate independent
- On-screen hint showing available controls, auto-updated to show swipe/tap instructions on touch devices
- All CSS, JS, and HTML in one file — no imports, no frameworks, no external fonts or images
How to Install and Configure iSponsorBlockTV on UGREEN NAS (DXP4800 Plus) via Docker
iSponsorBlockTV is a lightweight Docker utility that automatically skips sponsored segments, self-promotions, and skippable YouTube ads on your smart TV or streaming device.
Because the official iSponsorBlockTV Docker image uses a minimal container environment without /bin/bash or /bin/sh, attempting to open a web terminal directly inside the UGOS Docker UI throws an Invalid terminal command! error. Additionally, the v2 image will exit every 10 seconds until a valid config.json file is generated and properly mounted to /app/data.
This guide walks through creating the data directory, generating your configuration via SSH, and deploying the container cleanly on a UGREEN NAS running UGOS.
Prerequisites
- A UGREEN NAS (e.g., DXP4800 Plus) with the Docker app installed from the UGOS App Center.
- A smart TV or streaming stick with the YouTube app installed on the same local network.
- SSH access enabled temporarily on your NAS to run the interactive setup wizard.
Step 1: Create the Persistent Data Folder on Your NAS
Before running the setup wizard, create a dedicated folder on your NAS so your configuration persists across container updates and restarts.
- Open the Files app in your UGOS web interface.
- Navigate to your shared Docker directory (typically
/volume1/docker). - Create a new folder named
isponsorblocktv. - Right-click the
isponsorblocktvfolder, open Properties, and note the exact full path (for example:/volume1/docker/isponsorblocktv).
Step 2: Enable SSH and Run the Interactive Setup Wizard
Because the iSponsorBlockTV v2 image lacks an interactive shell for the UGOS web terminal, running a temporary one-time container over SSH is the cleanest way to generate config.json and link your TV.
- In UGOS, go to Control Panel > Terminal, check Enable SSH service (default port
22), and click Apply. - Open Terminal (macOS/Linux) or PowerShell / Command Prompt (Windows) on your computer and connect to your NAS:
ssh@ - Run the temporary setup container, making sure to mount the exact folder path from Step 1 to
/app/data:sudo docker run --rm -it --network=host -v /volume1/docker/isponsorblocktv:/app/data ghcr.io/dmunozv04/isponsorblocktv --setup-cli - Get your pairing code on your TV: open the YouTube app, navigate to Settings > Link with TV code, and copy the 12-digit code shown on screen.
- Complete the CLI wizard prompts in your terminal:
No config file found, using defaults. Config will be saved to data/config.json Blank config file created Welcome to the iSponsorBlockTV cli setup wizard Do you want to use system-wide proxy? (y/N) n Paired with 0 Device(s). Add more? (y/N) y Enter pairing code (found in Settings - Link with TV code): <12_DIGIT_TV_CODE> Pairing... Paired device: YouTube on TV Paired with 1 Device(s). Add more? (y/N) n API key only needed for the channel whitelist function. Add it? (y/N) n Enter skip categories (space or comma sepparated) Options: [sponsor, selfpromo, exclusive_access, interaction, intro, outro, preview, filler, music_offtopic, hook]:Do you want to whitelist any channels from being ad-blocked? (y/N) n Do you want to specify a minimum length of segment to skip? (y/N) n Do you want to report skipped segments to sponsorblock. Only the segment UUID will be sent? (Y/n) n Do you want to mute native YouTube ads automatically? (y/N) n Do you want to skip native YouTube ads automatically? (y/N) y Do you want to enable autoplay? (Y/n) Enter SponsorBlock API URL (default: https://sponsor.ajay.app/api/): Config finished - Confirm that
config.jsonwas saved inside/volume1/docker/isponsorblocktv. (Optional: Disable SSH again in Control Panel > Terminal once setup is complete.)
Step 3: Deploy the Container via UGOS Docker Compose
Now that config.json is saved in your NAS folder, deploy the permanent container using a Docker Compose project.
- Open the Docker app in UGOS and select Project > Create.
- Set the project name to
isponsorblocktv. - Paste the following YAML configuration into the editor, ensuring the host volume path matches Step 1 and Step 2:
services: iSponsorBlockTV: image: ghcr.io/dmunozv04/isponsorblocktv:latest container_name: iSponsorBlockTV restart: unless-stopped network_mode: host volumes: - /volume1/docker/isponsorblocktv:/app/dataImportant: Make sure the host directory path before:/app/datais identical to the folder whereconfig.jsonwas generated. If the volume mount does not match, the container will logRunning in docker without mounting the data dirand exit every 10 seconds. - Click Deploy to pull the image and start the container.
Step 4: Verify Everything Is Working
- In the UGOS Docker app, open the Container tab and verify that iSponsorBlockTV shows a green Running status without restarting.
- Click the container and open its Log tab—you should see confirmation that it loaded your configuration and connected to
YouTube on TV. - Play a YouTube video with a known sponsor segment or skippable ad on your TV; playback will automatically jump past the sponsored segment without requiring any remote input.
Key combinations table of Keychron K10
fn + Keys
| Keys | Function |
|---|---|
| fn + 1 | Select Bluetooth device #1 |
| fn + 2 | Select Bluetooth device #2 |
| fn + 3 | Select Bluetooth device #3 |
| fn + 1 (long press for 3s) | Pair with Bluetooth device #1 |
| fn + 2 (long press for 3s) | Pair with Bluetooth device #2 |
| fn + 3 (long press for 3s) | Pair with Bluetooth device #3 |
| fn + Light Effect Key | Turn On / Off the Backlight |
| fn + Right Arrow (Only works for RGB-backlit version) | Change The Backlight Color |
| fn + Left Arrow (Only works for RGB-backlit version) | Change The Backlight Color |
| fn + F1 (Mac mode) | F1 |
| fn + F2 (Mac mode) | F2 |
| fn + F3 (Mac mode) | F3 |
| fn + F4 (Mac mode) | F4 |
| fn + F5 (Mac mode) | F5 |
| fn + F6 (Mac mode) | F6 |
| fn + F7 (Mac mode) | F7 |
| fn + F8 (Mac mode) | F8 |
| fn + F9 (Mac mode) | F9 |
| fn + F10 (Mac mode) | F10 |
| fn + F11 (Mac mode) | F11 |
| fn + F12 (Mac mode) | F12 |
| fn + F1 (Windows mode) | Screen Brightness Down |
| fn + F2 (Windows mode) | Screen Brightness Up |
| fn + F3 (Windows mode) | Launches Mission Control |
| fn + F4 (Windows mode) | Launchpad |
| fn + F5 (Windows mode) | Keyboard Backlight Down |
| fn + F6 (Windows mode) | Keyboard Backlight Up |
| fn + F7 (Windows mode) | Rewind |
| fn + F8 (Windows mode) | Play / Pause |
| fn + F9 (Windows mode) | Fast Forward |
| fn + F10 (Windows mode) | Sound: Volume Mute |
| fn + F11 (Windows mode) | Sound: Volume Down |
| fn + F12 (Windows mode) | Sound: Volume Up |
| fn + Win (Windows mode, long press for 3s) | Lock / Unlock the Win Key |
| fn + - | RGB Speed Decrease |
| fn + = | RGB Speed Increase |
| Keys | Function |
|---|---|
| fn + B | Check Battery (Still in Beta, not 100% accurate) RGB-Backlight Version Backlight Red = 0~30% Power Backlight Blue = 30%~70% Power Backlight Green = 70%~100% Power White-Backlight Version Two Rows Backlight off & the Other On = 0~30% Power One Row Backlight off & the Other On= 30%~70% Power All Backlight On = 70%~100% Power |
| fn+ L + Light Effect Key (long press for 3s) | Lock / Unlock the Backlight Effect |
| fn + S + O (Bluetooth mode, long press for 3s) | Disable / Enable the Auto Sleep Mode |
| fn + S + L + R (Bluetooth mode, long press for 3s) | Auto Sleep in 10 Minutes Without Typing |
| fn + S + L + T (Bluetooth mode, long press for 3s) | Auto Sleep in 20 Minutes Without Typing |
| fn + S + L + Y (Bluetooth mode, long press for 3s) | Auto Sleep in 30 Minutes Without Typing |
| fn + J + Z (long press for 3s) | Reset the Keyboard |
| fn + X + L (Windows mode, long press for 3s) | Switch Between Function Keys and Multimedia keys (F1-F12) |
| fn + K + C (Mac mode, long press for 3s) | Switch Between Function Keys and Multimedia Keys (Only works for F5 and F6) |