Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
YouTube Security VideosLinus Tech Tips: I Thought These Guys Made Cables(21.09.2026 um 19:15 Uhr)
Sicherheitslücken (CVE)GitHub Actions leaking secrets when Miri output is cached(21.09.2026 um 02:00 Uhr)
Sichere ProgrammierungBuilding a Polymarket TWAP Momentum Reversal Detector(21.09.2026 um 20:02 Uhr)
Sichere ProgrammierungWhy Does RAG Miss Information That's Clearly in the Document?(21.09.2026 um 20:04 Uhr)
YouTube Security VideosLinus Tech Tips: I Thought These Guys Made Cables(21.09.2026 um 19:15 Uhr)
Sicherheitslücken (CVE)GitHub Actions leaking secrets when Miri output is cached(21.09.2026 um 02:00 Uhr)
Sichere ProgrammierungBuilding a Polymarket TWAP Momentum Reversal Detector(21.09.2026 um 20:02 Uhr)
Sichere ProgrammierungWhy Does RAG Miss Information That's Clearly in the Document?(21.09.2026 um 20:04 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

I Built Pac-Man in ~150 Lines of Vanilla JavaScript

Pac-Man looks like it needs serious AI and a physics engine. It needs neither — a maze stored as text, grid movement, and ghosts that just step toward you. About 150 lines of vanilla JavaScript. 🟡 Play it: http…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Pac-Man looks like it needs serious AI and a physics engine. It needs neither — a maze stored as text, grid movement, and ghosts that just step toward you. About 150 lines of vanilla JavaScript.



🟡 Play it: https://dev48v.infy.uk/game/day11-pacman.html






1. The maze is a grid of text






const MAZE = ["#####","#...#","#.#.#"];  // # = wall, . = pellet






Everything — movement, collision, pellets, ghost moves — is a lookup into this grid. The whole level is data you can edit by typing.






2. Grid movement, blocked by walls






if (MAZE[pac.y+dy][pac.x+dx] !== "#") { pac.x += dx; pac.y += dy; }






That one check IS your collision system. No pixel math.






3. Buffered input feels right



Store a wanted direction separately; switch to it when that way opens. That tiny buffer is the difference between responsive and stiff controls.






4. Eat pellets = change the grid






if (grid[y][x] === ".") { grid[y][x] = " "; score += 10; pellets--; }






When pellets hits 0, the maze is cleared.






5. Ghosts: greedy chase



From a ghost's legal moves, pick the one closest to Pac-Man (plus a little randomness so you can escape). Greedy distance-minimising is surprisingly menacing.






The takeaway



A text maze + grid steps + greedy ghosts = the whole arcade icon. Play it — the "Understand" tab walks each step.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten I Built Pac-Man in ~150 Lines of Vanilla JavaScript

Thematisch verwandte Begriffe: Built, PacMan, Lines, Vanilla · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-63416 | draw.io is a configurable diagramming and whiteboarding application. Pri…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick