Programming
Fall 2016
Game of Fifteen, a board game developed in C language
Game of Fifteen, also known as the 15 puzzle, is a 4x4 board game with randomly arranged tiles numbered from 1 to 15 and an empty space. The aim is to arrange the tiles in order by making sliding moves using the empty space.
I developed the game of fifteen for an NxN board. First, the game parses the size of the board from the command line arguments. Then, it greets the user as specified in the greet function. The init function initialises the NxN board by arranging the elements in reverse order. Then, an infinite while loop clears the screen, draws the board on the screen, outputs the board to a log file, checks for win by checking if the numbers are in order, asks for the move from the user, moves the corresponding tile, and repeats itself until the user wins or quits.
Bored? Keep your brain busy, play the game of fifteen