Skip to main content
NL.dev
Back to projects
2025

2048 Game

Browser 2048 puzzle powered by a decoupled ES6+ OOP Game engine and SCSS coordinate-grid styling

  • JavaScript
  • OOP
  • SCSS
  • HTML5
  • BEM
2048 Game

Implementation of the classic 2048 puzzle built with ES6+ JavaScript, SCSS (BEM), and HTML5. A decoupled OOP Game engine class manages 4x4 board state, tile merges, win/loss detection, and scoring independently of DOM rendering, while SCSS @for loops drive tile coordinate positioning and animations.

Key highlights

  • Decoupled ES6+ OOP Game engine class managing 4x4 board state, tile merges, win/loss detection, and scoring independently of DOM rendering.
  • SCSS @for loop coordinate-grid calculation driving smooth tile positioning and animations.
  • localStorage score persistence paired with BEM-structured SCSS styling.

Engineering challenges

  • Problem

    Coupling board-merge logic directly to DOM mutations makes game rules brittle and hard to reason about.

    Solution

    Isolated all 4x4 state transitions, merge rules, and win/loss detection inside a standalone ES6+ OOP Game class.

  • Problem

    Maintaining clean tile coordinates and smooth movement across a 4x4 grid without repetitive CSS rules.

    Solution

    Generated grid coordinate positioning with SCSS @for loops and persisted scores in localStorage.