Project: A Sliding Tile Game

Project: A Sliding Tile Game#

FiveTwelve is a sliding tile game based on 2048, with a few changes. 2048 was itself based on an earlier game called 1024, which was inspired by the more challenging sliding tile game Threes.

Learning objectives#

  • Using subclasses and inheritance to factor related behavior into shared superclasses. This is a key way object-oriented programming facilitates the DRY (don’t repeat yourself) principle.

  • Using notifiers in the Model-View-Controller (MVC) design pattern to factor game logic from display and interaction. Although related to the DRY principle, this factoring of model component from view component is more concerned with maintainability, portability, and extensibility of complex applications, by allowing modification or substitution of view components (display and interaction) without modifying the model component (game logic and internal representations).

Quite a bit of code is provided in the HOWTO document, but there is still a lot to understand and build. Even if you have gotten away with building some prior projects in a single programming session, you will almost certainly need to spread this project over multiple sessions and multiple days with breaks to clear your brain when it gets clogged with details. Build a little, test a little, debug a lot, and ask for help when you get stuck.