danielson/capture-pokemon
Composer 安装命令:
composer require danielson/capture-pokemon
包简介
A game of capturing pokemon passing on houses from directions from the user
README 文档
README
A game of capturing pokemons giving directions to the player. The user send a sequence of characters giving directions as this one:
- N -> player goes north;
- S -> player goes south;
- O -> player goes west;
- E -> player goes east;
- Any other letter player stand still
Each direction take, the player captures a pokemon. But if the player goes into a direction that he already went, then no pokemons captured.
The game returns the number of pokemons that the player took after walking in all those directions.
How to use it
// import the package
use danielsonsilva\CapturePokemon\PokemonGame;
// Create your object
$pokemonGame = new PokemonGame();
// create your paths using the four options provided
$pathOne = "NSOOEESNN";
$pathTwo = "OESSSNNEE";
// Then let the player walk in those directions
$numberCapturedPokemon1 = $pokemonGame->walkDirections($pathOne);
$numberCapturedPokemon2 = $pokemonGame->walkDirections($pathTwo);
// get the number of pokemons
echo $numberCapturedPokemon1; // 5
echo $numberCapturedPokemon2; // 7
Version History
v 1.1.1
- Reset ash position before walking directions
v 1.1.0
- Added private functions: resetMap
- Added a public function to get the current map from the object
- Fix a bug when walking two times without reseting the map
v 1.0.1
- Changed some composer.json properties
v 1.0.0
- Package danielsonsilva/CapturePokemon created;
- Features: walk directions provided to determine number of pokemons captures
- Unit tests to check its effectiveness, memory usage and performance
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-11