/2048-swiftui

2048 game using SwiftUI and Combine

Primary LanguageSwiftMIT LicenseMIT

2048 Game

The 2048 game remake using SwiftUI and Combine

You can find an article explaining the implementation here: Medium


🕹️ The Game

2048 is a single-player sliding block puzzle game designed by Italian web developer Gabriele Cirulli. The game's objective is to slide numbered tiles on a grid to combine them to create a tile with the number 2048. However, one can continue to play the game after reaching the goal, creating tiles with larger numbers.

🚂 Motivation

After watching a series of The Coding Train on how to implement the 2048 game in JavaScript with P5, I got the inspiration to do the same with SwiftUI and Combine. So some of the logics behind matrices manipulation I borrowed from Mr. Daniel Shiffman (Keep inspiring people with your videos <3).

💻 Requirements

  • iOS 13+
  • XCode 11

🤓 How to run

Since this project has zero dependencies on external frameworks, all you need is:

  • ⌘ + R (and that's it)

☑️ Todo

  1. Stats (number of moves, time played, etc)
  2. Work on the animations (there's no animation for shifting tiles along the board for example)
  3. A way to UNDO an action. (thanks @t0a0 for doing that!)