help me out..
this is a game and solve it by c++..how to play it is as follows..
There is a rectangular playing screen initially filled with several kinds of blocks at random. By selecting one of a group of adjoined blocks, a player may remove them from the screen. A column without any blocks will be trimmed away by other columns sliding to the left. The game is over if no more blocks can be removed, as in the right screen of the figure:
........... ...........
. X . . .
.#X X . -->. X .
.XXO#X . .#O#X .
........... ...........
Writing the Program A file containing m*n grid of characters from A-Z (Upper case only) will be given as input to the program. The program has to read the file and construct the grid appropriately and outputs series of coordinates (in the form of x,y) separated by LWS (linear white space) to the output file. Please note that this is NP-complete problem.
For example:
An input file may consist of the following grid.
ABCDEF
AABCDY
BABXYZ
One of the Solution flow:
Stage 1
ABCDEF
AABCDY
BABXYZ
Stage 2
CDEF
BCDY
BBBXYZ
Stage 3
DEF
CDY
CXYZ
Output file may contain
1,1
3,1
(or)
2,1
3,2
etc…
Scoring
Scoring is calculated using formula n^2 – 3*n + 4. Where n is number of adjacent blocks.
For example the score for above grid is 16.
Key Points (1) LWS can be spaces or new-line or tab. (2) Coordinates are represented in the form x,y . Comma is used for separation. (3) Any one of the coordinates can be given in adjacent blocks. (ie while writing to the output file.) (4) There will be no spaces between the input characters in the input file. (5) Index starts from 1. (6) Programs must be able to detect the errors in the input file. For example any character other than A-Z is present or incomplete input file.