This is an old revision of the document!


Regulile oficiale în limba engleză sunt preluate de pe pagina concursului de pe HackerRank. Vă rugăm să ne scuzați că nu le-am tradus și în limba română, dar ne ocupăm și de acest lucru în curând.

În plus, limitele uzuale de timp pentru fiecare mutare de pe HackerRank sunt descrise aici. Dacă acestea vor fi schimbate, acest lucru va fi specificat în această pagină.

Descriere joc Tron Many

Tron is a two player game based on the popular movie Tron. The objective of the game is to cut off players movement through each others motorbikes that leave a wall behind them as they move.

Input Format

Tron takes place on a mxn grid. The top left of the grid is (0,0) and the bottom right of the grid is indexed as (m-1,n-1). The grid is indexed as (row,column) Additional walls are placed as shown in the figure.

###############
#------#------#
#------#------#
#------#------#
#------#------#
#-------------#
#-#----#----#-#
#-##-#####-##-#
#-#----#----#-#
#-------------#
#------#------#
#------#------#
#------#------#
#------#------#
###############

The 1st player is represented by r (ascii value: 114). The 2nd player is represented by g (ascii value: 103).

The first line contains a character representing the current player. The second line consists of four single spaced integers representing the current position of 1st and 2nd players’ bike.

The third line consists of 2 single spaced integers indicating the row size and column size of the grid. row lines follow each line having column characters which represents the grid map. A wall is represented by # (ascii value 35), an empty grid is represented by - (ascii value 45). The wall left behind by the player are represented by their respective characters.

Output Format

Players are allowed to output any one of the following moves as the movement of their bikes.

LEFT RIGHT UP DOWN all in capital letters.

If (x,y) is the current position of the player’s motorbike, then the new position on LEFT would be (x,y-1), RIGHT would be (x, y+1), UP would be (x-1,y) and DOWN would be (x+1,y).

Sample Input

r
7 1 12 8
15 15
###############
#r-----#------#
#r-----#------#
#r-----#------#
#r-----#------#
#r------------#
#r#----#----#-#
#r##-#####-##-#
#-#----#----#-#
#-------------#
#------#------#
#------#------#
#------#g-----#
#------#gggggg#
###############

Sample Output

DOWN

The grid results in the following state.

###############
#r-----#------#
#r-----#------#
#r-----#------#
#r-----#------#
#r------------#
#r#----#----#-#
#r##-#####-##-#
#r#----#----#-#
#-------------#
#------#------#
#------#------#
#------#g-----#
#------#gggggg#
###############

The current player is r whose motor bike is positioned currently at (7,1). Valid moves are DOWN only. The player outputs DOWN.

Note:- At any point during the game play, players aren’t allowed to trace back their moves. i.e., a LEFT is not allowed after a RIGHT and viceversa or an UP isn’t allowed after a DOWN and vice versa.

Game Play

The game play is simultaneous. Both players get the same board state. If both the players move to the same cell in their next move or both hit the walls, the game is considered a draw. The player who is unable to move loses.

pa/reguli-generale-tron.1365369069.txt.gz · Last modified: 2013/04/08 00:11 by traian.rebedea
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0