w

2048


Technologies: C++, Command Line


Field: Software Engineering


Completed: February 2018

2048 was an individual first-year deliverable as part of EE Software Engineering I modules. The project was designed to introduce us to and apply our knowledge gained from weekly lab sessions, specifically dealing with data structures such as vectors, arrays and list. The game is written purely in C++ and can run on the command line using keypads: w,a,s,d.


We were provided with a full declarative specification for the functions and their signatures. The task was to follow the specification to implement the relevant methods because the assessment was based on an automatic testbench to be run on those functions. This taught us how to break large projects into smaller, easy-to-manage chunks just like the functions that we worked on. We had to ensure our code was robust and functional in edge case scenarios.


The game is designed in a way that the user can load a pre-configured grid as a .txt file. If no file is provided, the game begins with an initialised 4x4 grid with all zeros and single 2 at the bottom right of the grid. Once the grid is loaded, the user can use their keypad to move the grid up, down, left and right just how the original game is played. At each move, a new grid is calculated based on the move and displayed on the command line, ready for another user move. For invalid moves, there is no change to the grid indicating to the user of their move. The aim of the game is to maximise a single cell score before any combinations of their move become invalid.


My key learning in this project was important software engineering skills. It was my first experience of a large project where I learned how to debug effectively. I used to draw the program flow on paper and print variable values, especially because I used many for loops in my program. This gave me a better grasp of key programming concepts. I also used this project to understand different data structures and was able to use this knowledge for my later projects.


A link to the project source code on GitHub can be accessed here.

← Back to Projects