Professional Documents
Culture Documents
GAME OF TILES
Group Members:
HIMANSHI DWIVEDI,
HARSHIT BHARGAVA,
INDRAJEET SINGH SOLANKI,
HARSH GOEL,
AADHAR KUMAR MISHRA
Declaration
Date: 29.01.2022
Place: BENGALURU
o Harshit
Bhargava(1BI19CS061)
o Himanshi
Dwivedi(1BI19CS065)
o Indrajeet Singh
Solanki(1BI19CS069)
o Harsh Goel(1BI19CS059)
o Aadhar Kumar
Mishra(1BI19CS003
Abstract
The Game of Tiles is a puzzle played on a square, two-dimensional board which can be of
dimensions from 3x3 to 9x9 with numbered tiles that slide. The goal of this puzzle is to
arrange the board’s tiles from smallest to largest, left to right, top to bottom, with an empty
space in board’s bottom-right corner. Here we show an example of 4x4 that has numbers
from 1 to 15 and the bottom-right corner is empty.
Figure A.1
Sliding any tile that borders the board’s empty space in that space constitutes a "move."
Although the configuration above depicts a game already won, notice how the tile
numbered 12 or the tile numbered 15 could be slid into the empty space. Tiles may not be
moved diagonally, though, or forcibly removed from the board.
Although other configurations are possible, we shall assume that this game begins with the
board’s tiles in reverse order, from largest to smallest, left to right, top to bottom, with an
empty space in the board’s bottom-right corner. If, however, and only if the board contains
an odd number of tiles (i.e., the height and width of the board are even), the positions of
tiles numbered 1 and 2 must be swapped, as in the below. The puzzle is solvable from this
configuration.
Figure A.2
The puzzle also has an autocomplete feature available for 3x3 and 4x4 grid. The user will be
able to see the sequence in which the puzzle is solved one move at a time from start to the
solution of the puzzle. We also store the minimum number of moves and time of highscore
for each grid size.
Table of contents
1. Introduction
1.1 Challenges 1
1.2. Motivation for the work 1
3. Implementation
3.1 UNIX and its Commands (min 5) 2
5. Conclusion 3
6. References 3
1
1. Introduction
The Tiles Swap Game is a puzzle played on a square, two-dimensional board with
numbered tiles that slide. The goal of this puzzle is to arrange the board’s tiles from
smallest to largest, left to right, top to bottom, with an empty space in board’s bottom-
right corner.
1.1. Challenges
We started to learn about functions in shell scripting which included the concept of
passing multi-dimensional array to the function as parameters and change this arrays
passed globally. Then we also made database for the game which stores the high
score, which is the lowest number of moves that a user has used to solve the puzzle.
The number of moves and time to complete the game is displayed.
2. Methodology and
Framework
2.1 Requirement
a) Bash shell installed on the system.
b) User must have permission to read, write and make new files.
c) Memory space 4KB
3. Implementation
3.1 List of UNIX commands
a) Sleep: sleeps current thread
b) Date: gives the date
c) Cat: for file operations
d) Head: gives the first n lines of file
e) Sort: sorts the data
f) Exit, break, clear
g) Local, if, while, array declare, functions
h) Expr: for calculations
i) Printf, echo, read, clear
j) Grep, sed
k) Redirection
l) Command line arguments
The user has to move the tiles keeping in mind that the final result should be in
ascending order, and at the end when the ascending order pattern is achieved the game
ends with the number of moves displayed.
3
5. Conclusion
We learned a lot through this project. This project has sharpened our concepts of
UNIX and shell script.
There were many time we almost lost hope but we recovered through constant
concentration and hard work.
If any kind of suggestion, improvements, more efficient development ideas are found,
please feel free to communicate with us.
6. References
[1] Game of fifteen https://docs.cs50.net/problems/fifteen/fifteen.html
[2] Sumitabha Das, Unix Concepts and Applications,