Vous êtes sur la page 1sur 6

CODE WARRIORS

Game Of Thrones
Hazraat! Hazraat! Hazraat! Gangs of CyberQuest are back: this time to take control
over the entire kingdom. The fight is between Ramadhir Singh and Sardar khan. But
there is a twist in the story. Sardar khan has no intention of shooting Ramadhir Singh,
his motto is
Goli nahi marenge use , Gher k lenge uski.
So he has decided to surround the maximum open area in the city as well as the area
acquired by the followers of Ramadhir Singh. Since these followers only follow the most
powerful , they change their liability to one with the maximum power(area). Ramadhir
singh is also doing the same. Now there can only be one king so whoever gets the
maximum area ultimately will win the war. So its time for all the CYBER PIAs to get
ready with their player and prove the saying
DFS ka, BFS ka, GREEDY ka sab ka use karega tera yeh PLAYER.

Introduction:
Game of Thrones is a board game involving abstract strategy and played by two
players on a board with 19 rows and 19 columns and a set of distinct pieces for each
side. Pieces typically are disks with a red and a blue coloured face, each colour
belonging to one player. The player's goal is to have a majority of their coloured pieces
showing at the end of the game either by converting the opponent pieces into their own
colour or by covering uncovered area by forming a closed loop.

Game Rules:

1)The board has 19 rows and 19 columns . The rows are named from 'A' to 'S' from
top to bottom. The columns are named 'A' to 'S' from left to right.

2)Each time the player is given its colour followed by 19 X 19 board Example
Blue
XXRBBXXXBXXXXXBXRXX
XXXXXXXBXXXXXXXXXXX
XXXXBXXXRXXXXXXXXXX
XXXXBXXXXXXXXRXBXXX
RXBXXXXRXXXXXXXXXXX
XXXRXXXXXRXBXXXXXXX
XXXXRXXXXBXXXXXXXXX
XBXXXXXXXXRXXXXXXBX
XXXXXXXRXXXXXXXXXXX
XBBXXXXXXXXXXXXXXXX
XXXXXXXXXXXXRXBXXXB
XXRXRBXXXXXXXXXXXRB
XXXXXXXXXXXXXXBRXRX
XXXBBXXXXXXRXXXXXBX
XXRXXXXBXXXXXXXXRXX
RXXRXRBXXXXXXXXBRXB
XXXXXBXRXBXXXXXXXXB
XXXRXXXXXXXXRXXRXRB
XXXBXRXBXXXXXRRXRXX
The first line of input can contain one of two strings either Blue or Red denoting
the colour of the move which the player has to make. After that 19 X 19 board
contains only 'X' or 'R' or 'B' character where 'X' denotes empty position . 'R' denotes
that Red coloured disk is at that position and 'B' denotes that Blue coloured disk is
present at that position .

3)Player is supposed to generate a move to any one of the empty position according to
his strategy. The output should contain 2 characters , the first one denotes the row
number and the second one denotes the column number.
Example
output
AD
Above output denotes that player makes a move to row number 'A' and column number
'D'.

4)If a player makes a closed loop then all the disks lying inside the closed region
whether it is of opponent's colour or empty location will get coloured with the colour of
the player making loop.
Closed Loop : A closed polygon formed by joining the vertices of same colour . Here
disk is considered as a vertex. A vertex could be joined to any of its adjacent left , right
, above , below or diagonal vertex.
What I have to do ?

You have to think of a strategy to play the game and code it so as to beat the
opponent player by maximizing the disks of your colour on the board.
You can use either C/C++ language to implement your strategy.

Judging rules:

1. A program is simply disqualified and opponent is declared winner if any of


following conditions holds:
An invalid move is generated by program which includes making a move to
position which is non-empty or generating a move containing characters or
character other than 'A' to 'S' .
When program generates output containing either more than 2 characters or
less than 2 characters.
If a player takes more than a maximum of two seconds from last input to
generate the next move.
Program terminated pre-maturely by any reason
.
2. The game will be finished when
All board places are filled.
In the above condition the player having maximum number of disks will be declared
winner.
Test Cases:
Input :
Blue
XXRBBXXXBXXXXXBXRXX
XXXXXXXBXXXXXXXXXXX
XXXXBXXXRXXXXXXXXXX
XXXXBXXXXXXXXRXBXXX
RXBXXXXRXXXXXXXXXXX
XXXRXXXXXRXBXXXXXXX
XXXXRXXXXBXXXXXXXXX
XBXXXXXXXXRXXXXXXBX
XXXXXXXRXXXXXXXXXXX
XBBXXXXXXXXXXXXXXXX
XXXXXXXXXXXXRXBXXXB

XXRXRBXXXXXXXXXXXRB
XXXXXXXXXXXXXXBRXRX
XXXBBXXXXXXRXXXXXBX
XXRXXXXBXXXXXXXXRXX
RXXRXRBXXXXXXXXBRXB
XXXXXBXRXBXXXXXXXXB
XXXRXXXXXXXXRXXRXRB
XXXBXRXBXXXXXRRXRXX
output:
SA
Input :
Red
XXRBBXXXBXXXXXBXRXX
XXXXXXXBXXXXXXXXXXX
XXXXBXXXRXXXXXXXXXX
XXXXBXXXXXXXXRXBXXX
RXBXXXXRXXXXXXXXXXX
XXXRXXXXXRXBXXXXXXX
XXXXRXXXXBXXXXXXXXX
XBXXXXXXXXRXXXXXXBX
XXXXXXXRXXXXXXXXXXX
XBBXXXXXXXXXXXXXXXX
XXXXXXXXXXXXRXBXXXB
XXRXRBXXXXXXXXXXXRB
XXXXXXXXXXXXXXBRXRX
XXXBBXXXXXXRXXXXXBX
XXRXXXXBXXXXXXXXRXX
RXXRXRBXXXXXXXXBRXB
XXXXXBXRXBXXXXXXXXB
XXXRXXXXXXXXRXXRXRB
BXXBXRXBXXXXXRRXRXX
output:
SB

Explaination of closed loop


Case1: Since white disks surrounds black , forms a cycle
or closed loop as a result all the inner disks get coloured
with white colour.

-----------------
Case 2: Here black disks form closed outer loop in first
fig. (consider diagonal case) . The second one is
resultant figure.

------------------

Case3:Similar to above cases , here white balls form


closed loop.

-----------------

CyberQuest presents Code Warriors

Vous aimerez peut-être aussi