Earthcraft prototype X74945


Statement
 

pdf   zip

html

Input The input to your game will be:

  • The size of the map given as maximum rows and columns.
  • Several positions in the map, each of them with only one of the following elements:
    • Empty - represented as ’_’, by default all map is empty.
    • Player - represented as ’p’, it has to be only one.
    • Material - represented as ’m’
    • Enemy - represented as ’e’
  • A dot, this will help to delimitate map setup from movements.
  • A sequence of movements given as a pair (± 1, ± 1), indicating the rows and columns to advance each round.
    • The player can only walk one position at a time in any direction.
    • If the player walks into a material position, it will be collected, when all materials are collected the game ends.
    • If the player walks into an enemy position, it will die and the game ends.

Output

Public test cases
  • Input

    3 3
    0 1 p
    1 1 e
    1 2 m
    2 0 e
    .
    1 1
    

    Output

    Initial state
    _ p _ 
    _ e m 
    e _ _ 
    Materials collected 0/1
    _ _ _ 
    _ e p 
    e _ _ 
    Materials collected 1/1
    You have collected all the materials! Congratulations!
    
  • Information
    Author
    HP CodeWars
    Language
    English
    Official solutions
    Java
    User solutions