You are on page 1of 4

CSE  Programming Competition – 2009  29 January 2009 

                   
 
 

You are a traveler hunting for treasures in a weird island where amazing treasures pop up at various 
places at various times. But the place is full of obstacles and pitfalls. 

• If you fall into a pit, sorry you can never come out!!! 

• If you meet with an obstacle, you are penalized. 

• If the treasures are over or if all the travelers have fallen into pits or the time for the 
hunt is over, The Hunt will end!!! 

• By the time the hunt is over if you have got the highest amount of treasures, then, You 
Are the Winner!!! 

Prizes for the winners:  

  The champion     ‐  Rs.10,000/= 

  Runner up    ‐   Rs.  7,000/= 

  Second runner up  ‐   Rs   5,000/= 

You have to come up with a client program to visualize this weird and wonderful island of treasures the 
way you like according to the messages passed by the game server. Client should play the game without 
the user interaction. 

Positions in the map are given by coordinates. ‘0,0’ is the top left corner of the square map. 

You have only 4 movements and the commands are UP, DOWN, RIGHT, and LEFT. 

You can't occupy another player’s cell. 

    1/4 
CSE  Programming Competition – 2009  29 January 2009 

How to join the game 

You must first request to join the game server using the command, JOIN. Once the first player has joined 
others are allowed to join within an allocated time, until 5 players have joined.   

If you are allowed to join the game, the server will reply with your Player ID and map details in the 
following syntax: 

    Example:‐ P1:10:5,5;4,5;0,3:1,1;2,2;3,3 ‐ colon delimits the different sets 

      P1 ‐ player ID 

      10 ‐ map size (10x10) 

      5,5;4,5;0,3 ‐ Pitfall locations 

      1,1;2,2;3,3 ‐ Obstacle location 

If you do not see a message like the above one of following messages will be received: 

• PLAYERS_FULL: The maximum number of players are already added 

• ALREADY_ADDED: The player is already added 

• GAME_ALREADY_STARTED: The player tries to join an already started game 

How to move 

When issue UP/DOWN/LEFT/RIGHT command you will receive one of following replies from the server: 

• x,y;A   

A message of this format means that your move is a valid one where x is your new X 
coordinate ,y is your new Y coordinate, and A is the points earned if there is any 
treasure at that position. 

•  PITFALL  

You have fallen in a pit 

• OBSTACLE;A  

You have hit against an obstacle which will reduce your points by A, i.e. A is the 
Obstacle Penalty 

• CELL_OCCUPIED  

    2/4 
CSE  Programming Competition – 2009  29 January 2009 

You have tried to go into another player's cell 

• DEAD   

You have tried to move while being in a pit  

• TOO_QUICK 

You must leave a time gap of 5 sec between moves. If you have sent the command 
before the wait period you will get this message.  

• INVALID_CELL 

The cell you have requested to move to is outside the map  

• GAME_HAS_FINISHED 

Game is already finished 

• GAME_NOT_STARTED_YET   

Game has not yet started  

• NOT_A_VALID_CONTESTANT 

Not a valid player 

Where are the treasures 

Whenever a treasure appears the details are broadcast by the server so that you will receive a message 
like the one below; 

    x,y;aaaa;bbb    

where  

x,y ‐ Treasure Point  

aaaa ‐ milliseconds before disappear  

bbb – marks 

    3/4 
CSE  Programming Competition – 2009  29 January 2009 

Where are the competitors 

Every 10 sec, updates about all the players are sent to you by the server. The message is of the following 
format;  

  PX;aaaa:PY;bbbb:…  

PX,PY,... ‐ player IDs  

aaaa,bbbb ‐points that each player has earned 

Other messages 

• REQUEST_ERROR  

If the request is not understood by the server 

• SERVER_ERROR  

If the server has some error   

It is up to you to;  

• Be creative with your client  

• Make your program efficient 

• Have strategic game plan  

The extra effort will help you secure a better place among other groups in tight situations such as when 
several groups have scored equals points. 

Keep in touch with the Moodle course for latest updates!!! 

    4/4 

You might also like