/premium-minds-test

Pokemon Test from Premium Minds Company

Primary LanguageTypeScriptMIT LicenseMIT

Premium Minds Test

GitHub package.json version (branch)

Pokemon Test from Premium Minds Company

Test Description

Pokemon: Catch them all

Ash is catching Pokemon in a world consisting of an infinite two-dimensional grid of houses. In each house there is exactly one pokemon.

Ash starts by catching the pokemon that is in the house where he starts. Then, move to the house immediately north, south, east or west of where you are and catch the pokemon that is there, and so on. Attention: if he passes a house where he has already passed (and therefore where he has already caught a pokemon), there is no longer a pokemon for him to catch!

What we want to know is: starting with a world full of pokemon's (one in each house!), how many pokemon's does Ash catch for a given sequence of moves?

Input Format

The program must read a line from stdin, which contains a sequence of movements. Each movement is described by a letter N, S, E or O (respectively: north, south, east, west in portuguese).

Technologies

  • NodeJS
  • Jest

Run or Test the Project

To run the project you will need to have installed on your machine NodeJS (if you don't have, download here: NodeJS Official Website) at least the version 16

Commands to run, build and test

Before run, build or test the project you will need to install the node dependencies

yarn install

or

npm install

Use the following command to run the development version

yarn dev

or

npm dev

Use the following command to run the production version

yarn start

or

npm start

Use the following command to build the project

yarn build

or

npm build

Use the following command to run the project tests suit

yarn test

or

npm test