2017 © Pedro Peláez
 

library pokemath

A PHP library to make calculation in base pokemon

image

gries/pokemath

A PHP library to make calculation in base pokemon

  • Sunday, December 6, 2015
  • by gries
  • Repository
  • 1 Watchers
  • 4 Stars
  • 6 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Pokemath

This PHP-Library can be used to make calculations base pokemon., (*1)

Installation

Pokemath can be installed via. Composer:, (*2)

composer require "gries/pokemath"

Rebuild the classes

In data/pokemon.csv all pokemon-data is stored. (701 pokemon) To rebuild the classes execute., (*3)

php data/generator.php

Usage

<?php

use gries\Pokemath\Numbers\Ivysaur;
use gries\Pokemath\Numbers\Jigglypuff;
use gries\Pokemath\Numbers\Snorlax;
use gries\Pokemath\Numbers\Venusaur;
use gries\Pokemath\Numbers\Wigglytuff;

require_once __DIR__ . '/../vendor/autoload.php';


// small calculation
$ivy = new Ivysaur();
$venu = new Venusaur();

echo $ivy->add($venu)->value()."\n"; // -> charmander

// big calculation
$jiggly = new Jigglypuff();
$wiggly = new Wigglytuff();

echo $jiggly->multiply($wiggly)->value()."\n"; // -> ivysaur-chespin


// make it even bigger
$snorlax = new Snorlax();
echo $snorlax
        ->multiply($snorlax)
        ->multiply($snorlax)
        ->multiply($snorlax)
        ->multiply($snorlax)
        ->multiply($snorlax)
        ->value()."\n"; // -> nidorino-sandslash-klinklang-drifloon-gothita

// make calculations

$calculator = new \gries\Pokemath\PokeCalculator();

$expression = '(ivysaur + ivysaur) * ivysaur#ivysaur';
$result = $calculator->calculate('(ivysaur + ivysaur) * ivysaur#ivysaur');

echo $expression."\n";                                                  
// -> (ivysaur + ivysaur) * ivysaur#ivysaur
echo $calculator->translate($expression);                              
echo ' = '.$result->value(). '('.$result->asDecimalString().")\n";      
// -> (1 + 1) * 701 = venusaur#venusaur(1402)

Author

License

For the full copyright and license information, please view the LICENSE file that was distributed with this source code., (*4)

The Versions

06/12 2015

dev-master

9999999-dev

A PHP library to make calculation in base pokemon

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christoph Rosse

math pokemon numbersystem