473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

please help meeeeee....

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.
Sep 11 '07 #1
0 854

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Numberwhun | last post by:
Hello everyone! I am trying to learn java and have run into kind of a snag. Here is the code that I have so far: ------ <begin_code> ---------- import javax.swing.*; import...
1
by: HolaGoogle | last post by:
Hi all, Please help me with the following..it's realy urgent and i tried everything i could and i can't get it work properly!! Thanks in advance. Here's what i'm trying to accomplish: in my...
0
by: s_erez | last post by:
Hi, This is a realy tricky one. I have an ASP.NET application where some pages are reading data from a DB and presenting reports. In order for the user to wait while the page is reading data from...
2
by: rked | last post by:
I get nameSPAN1 is undefined when I place cursor in comments box.. <%@ LANGUAGE="VBScript" %> <% DIM ipAddress ipAddress=Request.Servervariables("REMOTE_HOST") %> <html> <head> <meta...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
4
by: pshindle | last post by:
DB2 Team - I just downloaded and unzipped the new Fixpack 9 for DB2 ESE V8 for Windows (FP9_WR21350_ESE.exe). I then burned the unzipped Fixpack files to a CD. I proceded to install this...
6
by: Rik | last post by:
Hello Experts, I have a communication server in VB.NET. It was working fine from last 6 months, but now start giving error message like that. 21-03-2005 07:58:27...
1
PEB
by: PEB | last post by:
POSTING GUIDELINES Please follow these guidelines when posting questions Post your question in a relevant forum Do NOT PM questions to individual experts - This is not fair on them and...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.