Contact Information:

Email: nhortness (at) gmail.com

Add Em Up C Program

For our Intro to Computer Programming course, students were tasked with creating a version of Add'em Up! a game which combines strategy and concentration to solve mathematically based puzzles. This project proved to be a fantastic learning tool as it forced us look beyond the information provided in the course text book to find solutions to complex problems. It also granted us the opportunity to find solutions in creative ways. Most importantly though this project allowed us to improve our programming skills by tackling a project with a much grander scope than previous projects required.


The program allows the user to import their own game board or have the program generate one for them. This required that the program have a means of importing and storing data from an external file in an array or generate its own array of data. As each game must be different from the last the generation of data needed to be random and this requirement proved to be one of the more complex aspects of the program design.


The user was allowed to choose the size of the board and the number of tiles they wish to have filled. For a human user a larger board simply provides a greater challenge but the option to have the program solve the puzzle automatically also existed and as such a larger board required substantially more computing power. For this reason it was necessary to put a great deal of thought into program optimization to ensure that the program was able to work efficiently and complete the puzzle in as little time as possible.


When the game begins, you have a user or program generated board and a program generated queue of numbers.  The object of the game is to place numbers on the boards so that all the numbers surrounding it add up to the same value as the number placed. This will cause the number placed and all the surrounding numbers to disappear. Once the board is cleared -- you win. The goal is to complete the game in as few moves as possible.


Again, this game is fully playable by a human user but the truly challenging aspect is to write programming so that the computer will solve the puzzle on its own. When the game begins, the computer scans the game board to determine how many tiles are filled.  It then enters into an elimination mode reducing the maximum number of tiles with each number played. Once the tiles left are reduced to a specific threshold (determined by the board size) the computer will switch to a more intensive mode in which it will scan the board for a solution with the numbers in queue.  If no solution is available the game will continue eliminating and searching for a solution until the game is complete.

This project was the work of four students including myself and we divided our tasks among members to concentrate on specific sections while maintaining a continuously compiled master copy to ensure synergy between different sections. Our final build tied for fourth out of 45 teams in a school competition to complete a 24 by 24 pregenerated board using as few turns as possible.

This project was a valuable learning tool in that it improved my programming skills exponentially and provided me with a new and powerful means with which to solve problems. I have no doubt that the skills obtained here will be of great use in future projects and in industry. Manufacturing is to a large extent about optimization - optimizing production times, optimizing material usage, etc. The lessons learned here should prove quite useful since solving this game and solving a design issue share many of the same goals such as finding a solution using as few resources and within as short a time frame as possible.