Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Threes Merge

A Threes-style sliding merge puzzle, built with Flutter -- deliberately distinct from a 2048 clone in its core mechanic, not just its skin.

Gameplay

  • Swipe or use arrow keys. Each tile moves at most one cell per swipe (no sliding all the way to the wall).
  • 1 and 2 are a special pair: they merge into 3. Same-value tiles of 3 or higher merge by addition (3+3=6, 6+6=12, ...) -- but two 1s or two 2s never merge with each other.
  • The game ends when the board is full and no adjacent pair can merge. Best score is saved locally.

Architecture

  • lib/game_logic.dart — pure-Dart ThreesGame engine. The one-cell slide is implemented as a single left-to-right pass per row/column, resolving each adjacent pair once using the state as it stands when that pair's turn comes up -- which is what prevents a tile from cascading multiple cells through a run of empty space in one swipe (a real subtlety worth getting right, verified directly in the tests below). No Flutter imports, fully unit-testable.
  • lib/screens/game_screen.dart — grid UI, keyboard + swipe input.
  • lib/services/score_service.dart — best-score persistence via shared_preferences.
  • lib/theme/app_theme.dart — light Material 3 theme.

Tests

test/widget_test.dart verifies the mechanics directly: a tile moves exactly one cell (not all the way to the wall), the 1+2=3 special merge, same-value merging at 3+, that two 1-tiles do not merge, the no-moves-left end condition (and that any empty cell means moves remain), and that a fully blocked move is rejected and leaves the board untouched -- plus a widget test for the intro overlay.

flutter test

Run

flutter pub get
flutter run -d windows   # or any supported platform

About

Threes-style sliding merge puzzle in Flutter — each tile moves at most one cell per swipe (not a full 2048-style slide), with the signature 1+2=3 special-pair merge rule.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages